diff --git a/ILPDFKit/Model/PDFDocument.h b/ILPDFKit/Model/PDFDocument.h old mode 100644 new mode 100755 index 6d5ee1c..a26c014 --- a/ILPDFKit/Model/PDFDocument.h +++ b/ILPDFKit/Model/PDFDocument.h @@ -118,6 +118,13 @@ */ - (NSData *)savedStaticPDFData; +/** Flattens the interactive elements, rendering the form values directly in the PDF. + Useful for saving a PDF with forms that have been filled out. + @return The data for the static flattened PDF with the document info dictionary. + */ + +- (NSData *)savedStaticPDFDataWithInfo:(NSDictionary *) documentInfo ; + /** @param docToAppend @return The PDF data of the result when the passed document is appended to the receiver. diff --git a/ILPDFKit/Model/PDFDocument.m b/ILPDFKit/Model/PDFDocument.m old mode 100644 new mode 100755 index 461d5e6..df47d9d --- a/ILPDFKit/Model/PDFDocument.m +++ b/ILPDFKit/Model/PDFDocument.m @@ -161,9 +161,13 @@ - (NSString *)formXML { } - (NSData *)savedStaticPDFData { + return [self savedStaticPDFDataWithInfo:nil]; +} + +- (NSData *)savedStaticPDFDataWithInfo:(NSDictionary *) documentInfo { NSUInteger numberOfPages = [self numberOfPages]; NSMutableData *pageData = [NSMutableData data]; - UIGraphicsBeginPDFContextToData(pageData, CGRectZero , nil); + UIGraphicsBeginPDFContextToData(pageData, CGRectZero , documentInfo); CGContextRef ctx = UIGraphicsGetCurrentContext(); for (NSUInteger page = 1; page <= numberOfPages; page++) { renderPage(page, ctx, _document, self.forms);