Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Added access to the the document info dictionary. #35

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions ILPDFKit/Model/PDFDocument.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 5 additions & 1 deletion ILPDFKit/Model/PDFDocument.m
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down