生成 PDF:低分辨率(如何使其更高分辨率?)
我通过以下方式生成 PDF(代码片段):
UIView *displayView = self.view;
//displayView.contentScaleFactor = 3.0;
CGRect pageRect = displayView.bounds;
if (UIGraphicsBeginPDFContextToFile(path, pageRect, [self pdfContextDictionary]) == NO) {
return nil; // error
}
UIGraphicsBeginPDFPage();
CGContextRef context = UIGraphicsGetCurrentContext();
CALayer *layer = displayView.layer;
//layer.contentsScale = 3.0;
[layer renderInContext:context];
UIGraphicsEndPDFContext();
注释掉的两行是使视图以更高分辨率渲染的两种不同尝试。我看到其他人评论说要使视图变得更大,这将是我的下一步,除非有人知道任何魔法咒语来强制 renderInContext:
生成更高的分辨率输出。
I am generating a PDF in the following manner (code snippet):
UIView *displayView = self.view;
//displayView.contentScaleFactor = 3.0;
CGRect pageRect = displayView.bounds;
if (UIGraphicsBeginPDFContextToFile(path, pageRect, [self pdfContextDictionary]) == NO) {
return nil; // error
}
UIGraphicsBeginPDFPage();
CGContextRef context = UIGraphicsGetCurrentContext();
CALayer *layer = displayView.layer;
//layer.contentsScale = 3.0;
[layer renderInContext:context];
UIGraphicsEndPDFContext();
both of the commented out lines were two different attempts to get the view to render at a higher resolution. i've seen others comment about making the view much larger, which will be my next step unless anyone knows any magic incantation to force the renderInContext:
to generate a higher res output.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论