Mark A Barr
Mark A Barr

Reputation: 77

IOS PDF Doesn't Print Text

Guys I have a really weird one

I use the following code to create a pdf in my documents directory It has one line of text and 1 image

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

The Pdf Creates fine and when I view on my mac it looks perfect but when I go to print the pdf (from Preview) the Printer preview comes up and it shows the page with text and graphic but when I press print all that is printed on the paper is the graphics and not the text

I have tried different ways of drawing the text but it still won't physically print out

Any Ideas?

Your help greatly appreciated

Mark

Upvotes: 0

Views: 267

Answers (1)

Mark A Barr
Mark A Barr

Reputation: 77

Word to the wise check your printer before asking questions that make you look an idiot

SORRY

Mark

Upvotes: 2

Related Questions