Creating a multi-page PDF using CoreGraphics shows an error on the console

I had a problem creating a multi-page PDF file. I am using NSMutableData to store PDF data. When I draw 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), zero);

 [self drawPageAtIndex:self.numberOfPages+1 inRect:CGRectMake(0, 0, pageWidth, pageHeight)]; [self drawBorder];//draws Border to the page 

It shows me the following error on the 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 help me solve this problem.

Here is the link I stated earlier for the same error

it says that major graphical magazines are confusing values, but I don't get permission to error Thank you.

+6
source share
2 answers

I could reproduce the error and apparently fix it. I have had an app in the App Store since 2013. The application creates some PDF files, and the error is displayed for the first time in iOS 10.

I traced it to this fragment

     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 this, enter line heights in the paragraph style:

     paragraphStyle.minimumLineHeight = theFont.pointSize;
     paragraphStyle.maximumLineHeight = theFont.pointSize;

+1
source

This is mistake -

Open the radar link: http://www.openradar.me/28250871

0
source

All Articles