gpt4 book ai didi

ios - 使用 CoreGraphics 创建多页 PDF 文件在控制台上显示错误

转载 作者:可可西里 更新时间:2023-11-01 03:58:53 24 4
gpt4 key购买 nike

我在创建多页 PDF 时遇到问题。我正在使用 NSMutableData 来存储 PDF 数据。当我使用以下代码绘制新页面时

CGContextSetRGBFillColor(context, 0.0, 0.0, 0.0, 1.0);
** Error Line **

UIGraphicsBeginPDFPageWithInfo(CGRectMake(0, 0, 595, 841), 零);

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

它在控制台上显示以下错误

<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.

请有人帮我解决这个错误。

Here is the link which i reffered previously for the same error

它说核心图形日志的值变得令人困惑,但我没有得到错误的解决方案谢谢。

最佳答案

我可以重现错误并显然修复它。自 2013 年以来,我在 App Store 上有一个应用程序。该应用程序创建了一些 PDF 文件,并且该错误在 iOS 10 中首次显示。

我追踪到了这个片段

    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];

要修复它,请在段落样式中引入行高:

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

关于ios - 使用 CoreGraphics 创建多页 PDF 文件在控制台上显示错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39695371/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com