Size of PDF file grows much more than expected

Discussions about PDF management.
Post Reply
PineDev
Posts: 3
Joined: Wed Oct 09, 2013 10:50 am

Size of PDF file grows much more than expected

Post by PineDev » Wed Oct 09, 2013 11:16 am

Hello

We are in the process of testing GD Picture for use in a workflow where we need to add, move and delete pages in a PDF file. The plugin works very well in regards with time spend on commands and the quility of the resulting PDF.

However the size of the PDF growns after each command is saved.

I have tried used the code of the post 'Reducing PDF size by altering the embedded images [UPDATED]'
but the resulting size is the same.
The PDF is created in InDesign and consist of shapes with different fill color and text.

Is there anything I need to be doing for the size to be smaller ?

I'm using a month old version of the 9 series.

Thanks in advance
Torben Nielsen

Code: Select all


[code]String const_src = @"C:\Udvikling\high_src.pdf"; 
String dst = @"C:\Udvikling\high_dst.pdf";

// At this point the files are the same size: 32.888 bytes


GdPicturePDF pdf = new GdPicturePDF();
pdf.LoadFromFile(const_src, true);

GdPicturePDF pdf2 = new GdPicturePDF();
pdf2.LoadFromFile(dst, true);

// CLONE PAGE
pdf.ClonePage(pdf2, 1);
pdf.SaveToFile(dst);

// At this point the destination file is: 153.687 bytes

// MOVE PAGE
pdf.MovePage(pdf.GetPageCount(), 2);
pdf.SaveToFile(dst);

// At this point the destination file is: 258.883 bytes

// DELETE PAGE
pdf.DeletePage(2);
pdf.SaveToFile(dst);

// At this point the destination file is: 348.677 bytes

// CLONE PAGE
pdf.ClonePage(pdf2, 1);
pdf.SaveToFile(dst);

// At this point the destination file is: 459.199 bytes

// MOVE PAGE
pdf.MovePage(pdf.GetPageCount(), 2);
pdf.SaveToFile(dst);

// At this point the destination file is: 564.395 bytes

// DELETE PAGE
pdf.DeletePage(2);
pdf.SaveToFile(dst);[

// At this point I have added, moved and deleted a page 2 times.
// At this point the document only consist of the original pages
// The size of the PDF has grown from 32.888 bytes to 654.192 bytes

pdf.Dispose();
pdf2.Dispose();

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Size of PDF file grows much more than expected

Post by Loïc » Wed Oct 09, 2013 4:16 pm

Hello Torben,

Could you please create a ticket through http://support.orpalis.com ?

We will need the code snippet and the input PDF used to reproduce the error.

With best regards,

Loïc

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Size of PDF file grows much more than expected

Post by Loïc » Wed Oct 09, 2013 10:09 pm

Hello again,

Quick remark:

you should replace,

Code: Select all

pdf.SaveToFile(dst);
by:

Code: Select all

pdf.SaveToFile(dst, true);
This way you will pack the produced PDF by removing unused objects.

Regards,

Loïc

PineDev
Posts: 3
Joined: Wed Oct 09, 2013 10:50 am

Re: Size of PDF file grows much more than expected

Post by PineDev » Thu Oct 10, 2013 9:32 am

Hi Loïc

When using true the size grows from 32888 to 566149
Without this parameter the result is 654192

I'm in the process of gathering files and testing the snippet I'll sent to your support.

Kind Regard
Torben Nielsen

PineDev
Posts: 3
Joined: Wed Oct 09, 2013 10:50 am

Re: Size of PDF file grows much more than expected

Post by PineDev » Thu Oct 10, 2013 10:23 am

Hi Loïc

I found the cause of this issue

Our demo license had expired which I just ignored and continued our test. :oops:
In order for us to summit a support ticket a valid demo license was need, which I just recieved.

Using a proper license the size actually ends up being smaller than the original size.

So the issue was related to using an invalid or no license at all.

Kind Regards

Torben Nielsen

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Size of PDF file grows much more than expected

Post by Loïc » Thu Oct 10, 2013 10:34 am

Thank you for the return Torben,

So the extra size was caused by the added demo watermark :wink:

Best,

Loïc

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests