Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Compress PDF



On Jul 29, 2007, at 9:03 AM, Dominik Pich wrote:
Now I want to take the generated PDF and resave it as a compressed PDF. (like automator can do)

How can I do that?
I looked into PDFKit and read about CGPdfContext but didnt find anything.

If this is Leopard, it is pretty straightforward. You need to create a QuatzFilter that does the compression (look in Quartz.framework/ Frameworks/QuartzFilters/ for the headers).


You can pass this QuartzFilter in a dictionary to -[PDFDocument writeFile/URL: withOptions:] (a class in PDF Kit). I think the header file for PDFDocument on Leopard has some comments to this effect. Here:

// Methods to record the current state of the PDFDocument as data or a file. Passing a QuartzFilter object in the
// options dictionary with the key @"QuartzFilter" will allow you to have the filter applied when saving the PDF.
- (NSData *) dataRepresentation;
- (BOOL) writeToFile: (NSString *) path;
- (BOOL) writeToFile: (NSString *) path withOptions: (NSDictionary *) options;
- (BOOL) writeToURL: (NSURL *) url;
- (BOOL) writeToURL: (NSURL *) url withOptions: (NSDictionary *) options;


john calhoun—_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Compress PDF (From: Dominik Pich <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.