IOS PDF 不打印文本
IOS PDF Doesn't Print Text
伙计们,我有一个很奇怪的人
我使用以下代码在我的文档目录中创建一个 pdf 它有一行文本和 1 个图像
NSString *documentsDirectory = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSString *filename = @"test.pdf";
NSURL *fileURL = [NSURL fileURLWithPathComponents:[NSArray arrayWithObjects:documentsDirectory, filename, nil]];
// Create PDF context
CGContextRef pdfContext = CGPDFContextCreateWithURL((CFURLRef)fileURL, NULL, NULL);
CGPDFContextBeginPage(pdfContext, NULL);
UIGraphicsPushContext(pdfContext);
// Flip coordinate system
CGRect bounds = CGContextGetClipBoundingBox(pdfContext);
CGContextScaleCTM(pdfContext, 1.0, -1.0);
CGContextTranslateCTM(pdfContext, 0.0, -bounds.size.height);
// Drawing commands
[@"Hello World!" drawAtPoint:CGPointMake(100, 100) withFont:[UIFont boldSystemFontOfSize:72.0f]];
// DRAW IMAGE
UIImage *anImage1 = [UIImage imageNamed:@"sdxlogo.png"];
[self myImage:anImage1 :400 :50 :125 :41];
// Clean up
UIGraphicsPopContext();
CGPDFContextEndPage(pdfContext);
CGPDFContextClose(pdfContext);
Pdf 创建良好,当我在 mac 上查看时,它看起来很完美,但是当我打印 pdf(来自预览)时,打印机预览出现,它显示带有文本和图形的页面,但是当我按下打印时,打印在纸上的只是图形而不是文字
我已经尝试了不同的方式来绘制文本,但它仍然无法打印出来
有什么想法吗?
非常感谢您的帮助
马克
明智的做法是在提出让您看起来像白痴的问题之前检查您的打印机
对不起
马克
伙计们,我有一个很奇怪的人
我使用以下代码在我的文档目录中创建一个 pdf 它有一行文本和 1 个图像
NSString *documentsDirectory = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSString *filename = @"test.pdf";
NSURL *fileURL = [NSURL fileURLWithPathComponents:[NSArray arrayWithObjects:documentsDirectory, filename, nil]];
// Create PDF context
CGContextRef pdfContext = CGPDFContextCreateWithURL((CFURLRef)fileURL, NULL, NULL);
CGPDFContextBeginPage(pdfContext, NULL);
UIGraphicsPushContext(pdfContext);
// Flip coordinate system
CGRect bounds = CGContextGetClipBoundingBox(pdfContext);
CGContextScaleCTM(pdfContext, 1.0, -1.0);
CGContextTranslateCTM(pdfContext, 0.0, -bounds.size.height);
// Drawing commands
[@"Hello World!" drawAtPoint:CGPointMake(100, 100) withFont:[UIFont boldSystemFontOfSize:72.0f]];
// DRAW IMAGE
UIImage *anImage1 = [UIImage imageNamed:@"sdxlogo.png"];
[self myImage:anImage1 :400 :50 :125 :41];
// Clean up
UIGraphicsPopContext();
CGPDFContextEndPage(pdfContext);
CGPDFContextClose(pdfContext);
Pdf 创建良好,当我在 mac 上查看时,它看起来很完美,但是当我打印 pdf(来自预览)时,打印机预览出现,它显示带有文本和图形的页面,但是当我按下打印时,打印在纸上的只是图形而不是文字
我已经尝试了不同的方式来绘制文本,但它仍然无法打印出来
有什么想法吗?
非常感谢您的帮助
马克
明智的做法是在提出让您看起来像白痴的问题之前检查您的打印机
对不起
马克