Problem: PDF Kit generates hugh PDF files.
Problem: PDF Kit generates hugh PDF files.
- Subject: Problem: PDF Kit generates hugh PDF files.
- From: Jerry LeVan <email@hidden>
- Date: Tue, 11 Dec 2007 19:46:59 -0500
Hi,
This post evidently did not make it to the list, at least
it has not appeared in the Digest that I receive...
I am having a problem with the PDF Kit, the generated pdfs are
up to seven ( or more ) times the size of the same pdfs generated
with the same data as Acrobat and other applications
I have a "book" made out of 14 jpeg images totaling about 8384KB.
Here are some results for the conversion to pdf
Jomix 8.2 MB
Acrobat 8.3 MB
MakePDF 54.4 MB
How can I reduce the size of the pdf generated by the following code ?
Thanks
Jerry
-(IBAction) MakePDF:(id)sender
{
PDFDocument* myBook;
PDFPage * nextPDFPage;
NSImage* nextImage;
int i;
NSBundle *thisBundle = [NSBundle bundleForClass:[self class]];
NSString * emptypdf = [thisBundle pathForResource:@"Empty.pdf"
ofType:nil] ;
myBook = [[PDFDocument alloc] initWithData:[NSData
dataWithContentsOfFile:emptypdf]];
if (myBook == NULL){
NSLog(@"Create PDF Failed");
return;
}
[myBook removePageAtIndex:0];
// loop to build pdf
int cnt = [ fileNameList count];
for (i=0; i< cnt ; i++) {
nextImage = [[NSImage alloc] initWithContentsOfFile:(NSString*)
[fileNameList objectAtIndex:i]];
nextPDFPage = [[PDFPage alloc] initWithImage:nextImage];
[myBook insertPage: nextPDFPage atIndex: i];
[nextImage release];
[nextPDFPage release];
}
[myBook writeToFile:@"/Users/jerry/Desktop/Book.pdf"];
[myBook release];
return;
}
_______________________________________________
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:
This email sent to email@hidden