iphone - PDF generation using data -
In my iPhone application, I have many data items. I want to generate a PDF file using these data items and Attaching PDF file to email. What do I know, I have to use Quartz 2D to attract PDF files. Is there a sample code or suggestion about PDF drawing?
The following is what I have created a NSDT object in which PDF is presenting some quartz graphics:
NSMutableData * pdfData = [[NSMUtableData Allok] Init]; CGDataConsumerRef Data Consumer = CGDContactorContentCFData ((CFMutableDataRef) pdfData); Constrict CGRact mediabox = CGRactMake (0.0f, 0.0f, self bounds .width, self.boundsskies.highth); CGContextRef pdfContext = CGPDFontactTat (Data Consumer, and Mediabox, Faucet); UIGraphicsPushContext (pdfContext); CGContextBeginPage (pdfContext, and Mediabox); // Your quartz drawing code goes here CGContextEndPage (pdfContext); CGPDFContextClose (pdfContext); UIGraphicsPopContext (); CGContextRelease (pdfContext); CGDataConsumerRelease (dataConsumer);
Then you can save this PDF data to disk or add it as an attachment in your email message, you can remember it when it's over.
Comments
Post a Comment