Forum How do I...?

File Size is large, can it be reduced?

steve
Sorry if this question has been answered before. I did search the forums but couldn't find an answer.

I create a pdf using PrinceXML and php. The file created is approximately 680k in size. The total size of the elements (graphics and small amount of text) shouldn't exceed 150k. I've taken the pdf file and used acrobat to reduce the file size to 76k.

My question is, how can I reduce the file size to say 150k or smaller programmatically? I am automating the sending of these created pdf files and the file size needs to be as close to 150k as possible.

Thanks for you help in advance.
Steve
mikeday
The bulk of the PDF file is probably embedded fonts. If you are only using common fonts such as Times New Roman, Arial, etc. then you don't really need to embed fonts, as the reader will already have them installed. You can disable font embedding by using the --no-embed-fonts command line option.
steve
Thanks I'll give this a try.

Using the php script from Prince, I assume I would define this in the $config = array. But what would the line look like?

Thanks
mikeday
Actually, the Prince PHP script does not have a method to disable font embedding; that is an oversight on our part. You will need to edit prince.php and add ' --no-embed-fonts' to the $pathAndArgs variable in the convert method that you are using.
steve
Perfect that worked!

Thanks for the help... Great product by the way!
StoneCypher
It is worth looking into tools which perform PDF compression. PDFtk is one good, free such tool.

John Haugeland is http://fullof.bs/

mcgillion
Mike

Is there a planned date for the version of Prince which would contain only the characters/glyphs that are actually used in the pdf (to reduce the doc size)?

Thanks
Mark
mikeday
Hi Mark,

Support for TrueType font subsetting is on the development roadmap. We don't have an exact date for it yet, as we have a few other things to do first, but if we make one release a month it could be ready in August or September.

Best regards,

Michael
pkmiec
Would these qualify as common fonts?

"Lucida Grande"
"Lucida Sans Unicode"
"Sans-serif"

I would be nice to use the --no-embed-fonts.
mikeday
Those fonts are not installed by default on Windows, which means they may not be considered as common if you are creating PDF files intended to be read by people running Windows.
mikeday
Okay, I said August or September and now it's actually October, but the new Prince 6.0 rev 4 release does include support for TrueType font subsetting. :)