• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Problem: PDF Kit generates hugh PDF files.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem: PDF Kit generates hugh PDF files.


  • Subject: Re: Problem: PDF Kit generates hugh PDF files.
  • From: Nik Youdale <email@hidden>
  • Date: Thu, 13 Dec 2007 10:52:15 +1100

Not an expert on this, but im guessing the jpegs are being decompressed into a bitmap format here:

nextImage = [[NSImage alloc] initWithContentsOfFile:(NSString*) [fileNameList objectAtIndex:i]];

And then you are simply adding that bitmap to the pdf. Sounds like you need to find some way of re-compressing the image data when you add it to the pdf.

Cheers
Nik

On 12/12/2007, at 11:46 AM, Jerry LeVan wrote:

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


  • Follow-Ups:
    • Re: Problem: PDF Kit generates hugh PDF files.
      • From: Jerry LeVan <email@hidden>
References: 
 >Problem: PDF Kit generates hugh PDF files. (From: Jerry LeVan <email@hidden>)

  • Prev by Date: Re: Leopard syncing
  • Next by Date: Re: Problem: PDF Kit generates hugh PDF files.
  • Previous by thread: Problem: PDF Kit generates hugh PDF files.
  • Next by thread: Re: Problem: PDF Kit generates hugh PDF files.
  • Index(es):
    • Date
    • Thread