We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If you'd be interested in expanding MTPDF to create PDFs using UIImages I'd like to share this code as a starting point:
+ (MTPDF *)PDFWithImageArray: (NSArray /* <UIImage> */*)imageArray { NSMutableData *pdfData = [[NSMutableData alloc] init]; CGDataConsumerRef pdfConsumer = CGDataConsumerCreateWithCFData((__bridge CFMutableDataRef) pdfData); CGContextRef pdfContext = CGPDFContextCreate(pdfConsumer, NULL, NULL); for (NSUInteger i = 0; i < imageArray.count; i++) { UIImage *image = imageArray[i]; CGFloat pageWidth = image.size.width; CGFloat pageHeight = image.size.height; CGRect pageRect = CGRectMake(0, 0, pageWidth, pageHeight); CGContextBeginPage(pdfContext,&pageRect); CGContextDrawImage(pdfContext, pageRect, image.CGImage); CGContextEndPage(pdfContext); } CGContextRelease(pdfContext); CGDataConsumerRelease(pdfConsumer); return [MTPDF PDFWithData:pdfData]; }
The text was updated successfully, but these errors were encountered:
Thanks!
Sorry, something went wrong.
No branches or pull requests
If you'd be interested in expanding MTPDF to create PDFs using UIImages I'd like to share this code as a starting point:
The text was updated successfully, but these errors were encountered: