The most recent problem I've faced involved producing a PDF from an SVG file (authored using Inkscape) which included linked digital photos. The SVG file itself is just 77kB in size, and the five photos it links to total just over 7MB. Even if the images were simply included as is, I wouldn't expect the resulting PDF to be more than 8MB in size, although I would hope that some reasonable down sampling would be applied. Printing to a PDF from within Inkscape, however, results in a file of 22MB in size! That's over three times the size of the included photos, which is just ridiculous. Exporting to a PDF instead of printing, results in a file of the same size so isn't much help.
Now I don't know enough about the inner workings of a PDF file, but a 22MB file (which is incidentally a single A4 page) just isn't right, and certainly isn't sensible for trying to send around via e-mail etc. I've tried searching the web for suggestions, but none of the ideas I've found have turned out to be much use; either they don't alter the size of the file, or they reduce the quality so far that the text becomes unreadable.
The first alternative I tried was to produce a PNG image from the SVG instead of a PDF. While an image file wasn't really what I wanted I thought it might be a good place to start. Using Inkscape to produce a 300 DPI image resulted in a file of just 1.7MB in size; a file, I should add, with a quality that is perfectly adequate. The problem with an image file is that it is easy to alter and can be a pain to print at the right size, so I'd still like to use a PDF file. Fortunately, on linux at least, it is easy to create a PDF from a PNG, using the simple command
convert input.png output.pdfGiven that Inkscape can also be controlled from the command line I can easily write a reusable script that converts an SVG direct to a PDF of a reasonable size:
#!/bin/sh inkscape -f "$1.svg" -e out.png -C -d 300 convert out.png "$1.pdf" rm out.pngI can then use this by passing in the name of the SVG file (minus the
.svg
extension) and out will pop a PDF file. Now I know this approach isn't perfect but given my requirements (a PDF of a reasonable size that is really only needed for printing) this works well. I'm intending to see if I can find a better solution (one that will keep the text as text) so if you have any suggestions please feel free to leave a comment.
Mark you are always way ahead of me and sort my problems.
ReplyDeleteHave you not thought of GIFF. I don't know what it does but what I put in I get out. It loads fast. I'm sure you have but I find anything will do for the web.
I am looking at Adobe supported file formats. Adobe are efficient. Expensive but good.
I doubt I have helped but I personally need help.
WMP files also seem to do the job. I am a numpty consumer. I will also be wanting help when the new machine arrives.....Fancy a break in Scotland?
DeleteGIF files are good, but I was really wanting a PDF as I wanted something that was clearly a single A4 page rather than an image which could be any scale/size. i was tempted to just stick with the PNG image but went with the PDF for that very reason.
DeleteSaying no to a holiday in Scotland would be very difficult indeed, so don't tempt me! Do let me know if you need anything when the new laptop arrives though and I'll do my best to help.