there4 / markdown-resume

Generate a responsive CSS3 and HTML5 resume with Markdown, with optional PDF output.
MIT License
1.77k stars 519 forks source link

Make PDF File Size Smaller #33

Closed jsorge closed 9 years ago

jsorge commented 9 years ago

Is there any way to compress the size of the generated PDF output? I'm getting a file that's 1.7MB for a single file, and a few sites I've tried to upload to (Nordstrom, Dice) are rejecting it because their systems can't handle files that large.

Thanks!

there4 commented 9 years ago

Internally, the project uses wkhtmltopdf for PDF generation. I've really not looked too deeply into it. There may be some options that could be added. If you have time, try processing the html output file with wkhtmltopdf and see if you can get a smaller or better output.

Keep me posted and we can make a PR or change. Thanks!

https://github.com/there4/markdown-resume/blob/master/src/Resume/Command/PdfCommand.php#L72

there4 commented 9 years ago

There is some info here that might indicate it's worth trying out some different font options and perhaps a new wkthmltopdf build: https://github.com/wkhtmltopdf/wkhtmltopdf/issues/1747

edit: wkhtmltopdf 0.12.2-dev-5dea253 is generating significantly smaller file sizes, and generates selectable text. However, in the modern template, I'm seeing a couple of stray unicode squares that I'm not sure of the source of.

jsorge commented 9 years ago

I was able to get the 32-bit version, and it made my PDF so much smaller (from 1.7MB to about 35k). There were a few weird boxes that showed up as a result of some character encoding I think, but I masked them easily enough in PDFPen.

Thanks for the tip!

oflannabhra commented 9 years ago

Just an FYI, this issue persists on OS X, due to an underlying bug in QT (one of wkhtmltopdf's dependencies). Unfortunately for OS X, there is no v0.12 beta to download. The only (apparent) solution until v0.13 is released is to build from source with a patched version of QT. Both of those linked pages have outdated build instructions, however. I did discover a binary available for OS X 10.9, but have not tested. If you do decide to build from source, expect to lose 6 hours.