I am having a problem in creating the multi page PDF. I am using NSMutableData for storing the PDF data. When I am drawing a new page using the following code
CGContextSetRGBFillColor(context, 0.0, 0.0, 0.0, 1.0);
**    Error Line   **
UIGraphicsBeginPDFPageWithInfo(CGRectMake(0, 0, 595, 841), nil);
[self drawPageAtIndex:self.numberOfPages+1 inRect:CGRectMake(0, 0, pageWidth, pageHeight)];
[self drawBorder];//draws Border to the page
It shows me following error on console
<Error>: replacing +/-infinity with -2147483648.
<Error>: replacing +/-infinity with 2147483647.
<Error>: replacing +/-infinity with -2147483648.
<Error>: replacing +/-infinity with 2147483647.
<Error>: replacing +/-infinity with -2147483648.
<Error>: replacing +/-infinity with 2147483647.
<Error>: replacing +/-infinity with -2147483648.
<Error>: replacing +/-infinity with 2147483647.
Please can someone help me to resolve the error.
it says that core graphics logs are getting confusing values but i am not getting a resolution on the error Thank You.
I could reproduce the error and apparently fix it. I have an app on the App Store since 2013. The app creates some PDF files and the error showed for the first time in iOS 10.
I traced it to this snippet
    NSString* pgStr = [some text];        
    UIFont* theFont = [some font];
    NSMutableParagraphStyle * paragraphStyle = [[NSMutableParagraphStyle defaultParagraphStyle] mutableCopy];
    paragraphStyle.lineBreakMode = NSLineBreakByWordWrapping;
    paragraphStyle.alignment = NSTextAlignmentCenter;
    NSDictionary * attributes = @{NSFontAttributeName:theFont, NSParagraphStyleAttributeName:paragraphStyle
                                          };
    // ERROR        
    [pgStr drawInRect:[some frame] withAttributes:attributes];
To fix it, introduce line heights to the paragraph style:
    paragraphStyle.minimumLineHeight = theFont.pointSize;
    paragraphStyle.maximumLineHeight = theFont.pointSize;
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With