¡@

Home 

2014/10/15 ¤U¤È 10:11:20

iphone Programming Glossary: mediabox

PDF generation using data

http://stackoverflow.com/questions/1864597/pdf-generation-using-data

alloc init CGDataConsumerRef dataConsumer CGDataConsumerCreateWithCFData CFMutableDataRef pdfData const CGRect mediaBox CGRectMake 0.0f 0.0f self.bounds.size.width self.bounds.size.height CGContextRef pdfContext CGPDFContextCreate dataConsumer.. 0.0f 0.0f self.bounds.size.width self.bounds.size.height CGContextRef pdfContext CGPDFContextCreate dataConsumer mediaBox NULL UIGraphicsPushContext pdfContext CGContextBeginPage pdfContext mediaBox Your Quartz drawing code goes here CGContextEndPage.. CGPDFContextCreate dataConsumer mediaBox NULL UIGraphicsPushContext pdfContext CGContextBeginPage pdfContext mediaBox Your Quartz drawing code goes here CGContextEndPage pdfContext CGPDFContextClose pdfContext UIGraphicsPopContext CGContextRelease..

Get a PDF/PNG as output from a UIWebView or UIView

http://stackoverflow.com/questions/2454309/get-a-pdf-png-as-output-from-a-uiwebview-or-uiview

#import QuartzCore QuartzCore.h @implementation UIView PDFWritingAdditions void renderInPDFFile NSString path CGRect mediaBox self.bounds CGContextRef ctx CGPDFContextCreateWithURL CFURLRef NSURL fileURLWithPath path mediaBox NULL CGPDFContextBeginPage.. path CGRect mediaBox self.bounds CGContextRef ctx CGPDFContextCreateWithURL CFURLRef NSURL fileURLWithPath path mediaBox NULL CGPDFContextBeginPage ctx NULL CGContextScaleCTM ctx 1 1 CGContextTranslateCTM ctx 0 mediaBox.size.height self.layer.. path mediaBox NULL CGPDFContextBeginPage ctx NULL CGContextScaleCTM ctx 1 1 CGContextTranslateCTM ctx 0 mediaBox.size.height self.layer renderInContext ctx CGPDFContextEndPage ctx CFRelease ctx @end Bad news UIWebView does not create..

Merge PDF files on iOS

http://stackoverflow.com/questions/6553540/merge-pdf-files-on-ios

CGContextRef writeContext CGPDFContextCreateWithURL pdfURLOutput NULL NULL Loop variables CGPDFPageRef page CGRect mediaBox Read the first PDF and generate the output pages NSLog @ GENERATING PAGES FROM PDF 1 i ... numberOfPages1 for int i 1 i.. @ GENERATING PAGES FROM PDF 1 i ... numberOfPages1 for int i 1 i numberOfPages1 i page CGPDFDocumentGetPage pdfRef1 i mediaBox CGPDFPageGetBoxRect page kCGPDFMediaBox CGContextBeginPage writeContext mediaBox CGContextDrawPDFPage writeContext page.. i page CGPDFDocumentGetPage pdfRef1 i mediaBox CGPDFPageGetBoxRect page kCGPDFMediaBox CGContextBeginPage writeContext mediaBox CGContextDrawPDFPage writeContext page CGContextEndPage writeContext Read the second PDF and generate the output pages NSLog..