Skip to content

Support to export the PDF data for iOS && macOS. iOS need iOS 11+ for keeping vector format. #1

New issue

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

Merged
merged 2 commits into from
May 12, 2019

Conversation

dreampiggy
Copy link
Collaborator

PR descrition

This PR support to export the vector PDF data, from UIImage/NSImage instance. Which keep the original vector data (may loss PDF metadata on iOS only, macOS does not impact).

See the result:

NSData *pdfData = [image sd_imageDataAsFormat:SDImageFormatPDF];
[pdfData writeToFile:@"/tmp/1.pdf" atomically:YES];

image

@@ -149,7 +183,7 @@ - (UIImage *)createBitmapPDFWithData:(nonnull NSData *)data pageNumber:(NSUInteg
return nil;
}

CGPDFBox box = kCGPDFCropBox;
CGPDFBox box = kCGPDFMediaBox;
Copy link
Collaborator Author

@dreampiggy dreampiggy May 12, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, we should use mediabox for general usage. The PDF with cropbox may contains conflict issue when using on iOS with alignmentInsets. If user want, they can do post-processing using transformer. Or this may become a extra decoding options in the future.

@dreampiggy dreampiggy force-pushed the feature_export_pdf_data branch 3 times, most recently from ec544b5 to d0b5e40 Compare May 12, 2019 07:55
@dreampiggy dreampiggy force-pushed the feature_export_pdf_data branch from d0b5e40 to c0b3140 Compare May 12, 2019 08:03
@dreampiggy dreampiggy merged commit d4a6345 into master May 12, 2019
@dreampiggy dreampiggy deleted the feature_export_pdf_data branch May 12, 2019 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant