Create PDF for on-line distribution?

Post questions on how to use or achieve an effect in Inkscape.
ciradrak
Posts: 5
Joined: Fri Sep 25, 2009 3:23 am

Create PDF for on-line distribution?

Postby ciradrak » Fri Sep 25, 2009 3:56 am

So... I need to create small file sized pdf versions of my Inkscape work. Specifically, I have an 11 page 11x17" document and I've been slapped with a max 5MiB-pdf-file requirement. I've been exporting the pages as pdfs and composing them into one document with Acrobat pro. I'm winding up with multi-hundred MB documents. Any ideas on what to try? Also, I've been working recently under OSX, if that matters. My svg document is 280KiB.

Have tried:
Apache's Batik -- it croaks with an error on Inkscape's svg (Is this normal?)
Optimizing Inkscape PDFs in Acrobat pro -- seems to have no impact (changing res of images to 72dpi, compressing doc structure, etc -> same file size?!)

Going to try:
Latest dev code of Inkscape
Ask ppl at Cairo (pdf export system in Inkscape)

I've used the Inkscape code for my work since the early days of Sodi-Podi and have done so on linux/win/osx. Usually I just send things to print which works fine. Or keep things as SVGs or PNGs which works great. I searched the forums, but didn't notice the answer.

Any suggestions? I'd rather not have to re-do everything in InDesign...

-ciradrak, wandering in pdf hell.

User avatar
tomh
Posts: 218
Joined: Sat Feb 14, 2009 10:14 pm

Re: Create PDF for on-line distribution?

Postby tomh » Fri Sep 25, 2009 9:41 am

Just to give a better idea of what the svg's are like:

what file size are the svg files you are trying to convert? Are they complex?
Have you used any blur/filters in the svg (these have to be converted to bitmats when exported to pdf's, due to the pdf spec not supporting them)
Do you make heavy use of clones? don't think this should matter in practice, but in svg clones are cheep for file size, whereas on export they are converted to copies not references)

Are the individual page pdf's large, or does the file size balloon when combining them?

+ have you tried any of the 0.47pre builds, I think the PDF export has improved a bit (like not trying to rasterise more than necessary)

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: Create PDF for on-line distribution?

Postby ~suv » Sat Sep 26, 2009 2:59 am

ciradrak wrote:I'm winding up with multi-hundred MB documents.
Do you have text objects in the SVG files? Are they converted to paths before or during export? This would increase the size of your PDF files tremendously.

ciradrak
Posts: 5
Joined: Fri Sep 25, 2009 3:23 am

Re: Create PDF for on-line distribution?

Postby ciradrak » Sat Sep 26, 2009 3:22 am

Sure:

The svg file size (that was in the first post) is 280KiB.

This doc is relatively simple, a few rectangles, a little transparency, some png and jpeg images, and about five fonts. No nifty blurs or filters in this one, fairly straight forward. No clones.

Yes, there is quite a bit of text-graphic, but I did try not activating 'convert text to paths'; though I do usually use it as the flow and spacing typically changes when I go to print. If there was a change it was less that 1MB.

Each individual page, as exported to pdf, becomes 20-80MiB. So, yes, the individual pages are huge.

I tried to deduce which version of the Cairo library was being used in 0.46, but `otool -L` on the libraries:
/Applications/Inkscape.app/Contents/Resources/lib/libcairo.2.dylib
/Applications/Inkscape.app/Contents/Resources/lib/libcairomm-1.0.1.dylib
/Applications/Inkscape.app/Contents/Resources/lib/libpangocairo-1.0.0.dylib
was claiming version 17.0 ...whatever. http://cairographics.org/news/ doesn't concur.

There was an improvement using the 2009 July test release at:
http://inkscape.modevia.com/macosx-snap/?C=M;O=D
My test page went from 75MiB to 60MiB. Still, no where close enough to what I need though. The source images are only 16MiB, are they being re-rasterized to a higher resolution instead of a lower one?

Unfortunately, after the test export the 0.47pre (21714-10.5-i386) burst a seam and something bad happened in my X11. 0.46 no longer launches on this system. If I can't fix it with only a little tweaking I'm going to flip to WinXP as the As the prereleases are the most current.

I was most of the way through the compilation process for the OSX build of Inkscape, 2009 Sept 24, tar ball; when X11 cracked. So I'm waiting on that to see what it will take to fix X11 on this system.

Meanwhile, the deadline on this thing is looming, so I'm going to have to redo it in InDesign, while I unravel this. bleck.

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: Create PDF for on-line distribution?

Postby ~suv » Sat Sep 26, 2009 3:28 am

ciradrak wrote:Unfortunately, after the test export the 0.47pre (21714-10.5-i386) burst a seam and something bad happened in my X11. 0.46 no longer launches on this system.
which version of X11/XQuartz are you using? Do you have MacPorts installed?

first try to fix it: clear the font cache - quit Inkscape, quit X11, open terminal and type

Code: Select all

rm ~/.fontconfig/*
restart Inkscape 0.46. Does it still hang when trying to rebuild the font cache?

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: Create PDF for on-line distribution?

Postby ~suv » Sat Sep 26, 2009 3:31 am

And if you want to try a prerelease version - you might want to get the most recent build from sf.net - Inkscape 0.47pre2-3 Leopard+

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: Create PDF for on-line distribution?

Postby ~suv » Sat Sep 26, 2009 3:33 am

ciradrak wrote:I tried to deduce which version of the Cairo library was being used in 0.46
open the exported PDF in Preview.app, use 'Tools > Inspector' - it usually tells you the cairo version used (at least when created with recent Inkscape builds)

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: Create PDF for on-line distribution?

Postby ~suv » Mon Sep 28, 2009 12:07 am

sorry - I missed this last time I read your details:
ciradrak wrote:I was most of the way through the compilation process for the OSX build of Inkscape, 2009 Sept 24, tar ball; when X11 cracked. So I'm waiting on that to see what it will take to fix X11 on this system.
I assume you have MacPorts installed with the default prefix and made a port selfupdate before installing the required dependencies for Inkscape? This installs a newer version of fontconfig into the MacPorts tree which can be incompatible with older fontcache configurations stored inside the application bundle of Inkscape 0.46 up to 0.47pre1-1. If you still have the issue: this is reported on the bug tracker, fixed in the prerelease source and recent pre-built packages from sf.net, but not in 0.46-2 Leopard.

You find details and instructions in Bug #400165 in Inkscape: “Binary Inkscape dist crashes when MacPorts is installed” and in its duplicates.

Basically you have to edit the 'fonts.conf' file inside the 0.46 Inkscape.app package and comment out or delete a line that links to the fontcache directory in the macports tree:
Open 'Inkscape.app/Contents/Resources/etc/fonts.conf' and remove line 73

Code: Select all

   <cachedir>/opt/local/var/cache/fontconfig</cachedir>
save and restart Inkscape 0.46 after cleaning the font cache as mentioned before.

hth, ~suv

ciradrak
Posts: 5
Joined: Fri Sep 25, 2009 3:23 am

Re: Create PDF for on-line distribution?

Postby ciradrak » Thu Oct 01, 2009 5:55 am

~suv wrote:
ciradrak wrote:I tried to deduce which version of the Cairo library was being used in 0.46
open the exported PDF in Preview.app, use 'Tools > Inspector' - it usually tells you the cairo version used (at least when created with recent Inkscape builds)


Oh, that's too easy. ;) The OSX Finder's Get Info pane also lists it under 'More Info:' Content Creator. Sometimes knowing too much makes the task more difficult!


~suv wrote:
ciradrak wrote:Unfortunately, after the test export the 0.47pre (21714-10.5-i386) burst a seam and something bad happened in my X11. 0.46 no longer launches on this system.
which version of X11/XQuartz are you using? Do you have MacPorts installed?


X11 -> About X11 says: Xquartz 2.1.5 - (xorg-server 1.3.0-apple22) (2.1.5)


~suv wrote:first try to fix it: clear the font cache - quit Inkscape, quit X11, open terminal and type

Code: Select all

rm ~/.fontconfig/*
restart Inkscape 0.46. Does it still hang when trying to rebuild the font cache?


The behavior of the crash is changed but it still doesn't work when I move ~/.fontconfig/ aside.

na@ascana:/Users/na
7 $ /Applications/Inkscape.0.46.app/Contents/MacOS/Inkscape
2009-09-29 20:47:01.704 Inkscape[3781:10b] Error loading /Library/ScriptingAdditions/24U Appearance OSAX.osax/Contents/MacOS/24U Appearance OSAX: dlopen(/Library/ScriptingAdditions/24U Appearance OSAX.osax/Contents/MacOS/24U Appearance OSAX, 262): no suitable image found. Did find:
/Library/ScriptingAdditions/24U Appearance OSAX.osax/Contents/MacOS/24U Appearance OSAX: mach-o, but wrong architecture
Inkscape: OpenScripting.framework - scripting addition /Library/ScriptingAdditions/24U Appearance OSAX.osax declares no loadable handlers.
2009-09-29 20:47:01.954 defaults[3802:10b]
The domain/default pair of (kCFPreferencesAnyApplication, AppleAquaColorVariant) does not exist
2009-09-29 20:47:01.983 defaults[3803:10b]
The domain/default pair of (kCFPreferencesAnyApplication, AppleHighlightColor) does not exist

(inkscape-bin:3782): Gtk-WARNING **: Locale not supported by C library.
Using the fallback 'C' locale.

Emergency save activated!
Emergency save completed. Inkscape will close now.
If you can reproduce this crash, please file a bug at http://www.inkscape.org
with a detailed description of the steps leading to the crash, so we can fix it.
^C
na@ascana:/Users/na
8 $



If I move .fontconfig out of the way I get something different:

5 $ /Applications/Inkscape.0.46.app/Contents/MacOS/Inkscape
2009-09-30 13:13:47.659 Inkscape[384:10b] Error loading /Library/ScriptingAdditions/24U Appearance OSAX.osax/Contents/MacOS/24U Appearance OSAX: dlopen(/Library/ScriptingAdditions/24U Appearance OSAX.osax/Contents/MacOS/24U Appearance OSAX, 262): no suitable image found. Did find:
/Library/ScriptingAdditions/24U Appearance OSAX.osax/Contents/MacOS/24U Appearance OSAX: mach-o, but wrong architecture
Inkscape: OpenScripting.framework - scripting addition /Library/ScriptingAdditions/24U Appearance OSAX.osax declares no loadable handlers.
na@w02-129-24-42-141:/Users/na
6 $



Moving .inkscape/ and .inkscape-etc/ out of the way does not seem to make a difference.


It looks like a problem with this library rather than an fonts issue, but I'll try <!--commenting--> out that line you mentioned in fonts.conf inside Inkscape first.... no change.


I'll try grabbing a copy of 0.47pre2-3 from sourceforge next.

Also, thank you very much for helping out by suggesting things to try! Sorry I didn't get right back on Friday. I had to find another way to finish the project without this working yet.

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: Create PDF for on-line distribution?

Postby ~suv » Thu Oct 01, 2009 6:09 am

ciradrak wrote:X11 -> About X11 says: Xquartz 2.1.5 - (xorg-server 1.3.0-apple22) (2.1.5)
pardon my ignorance - you have Leopard OS X 10.5.5 and never updated to 10.5.8?

ciradrak wrote:The behavior of the crash is changed but it still doesn't work when I move ~/.fontconfig/ aside.
because I didn't say to 'move ~/.fontconfig', but the remove its contents ;-)

Due to a bug in the launcher script Inkscape cannot recreate that folder if it's missing. Please try again:

Code: Select all

mv ~/.fontconfig ~/.fontconfig.prev
mkdir ~/.fontconfig
and restart Inkscape by double-click in the finder, not on the command line (you still see the log messages in Console.app)

Any changes?
Last edited by ~suv on Thu Oct 01, 2009 6:11 am, edited 1 time in total.

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: Create PDF for on-line distribution?

Postby ~suv » Thu Oct 01, 2009 6:11 am

~suv wrote:Do you have MacPorts installed?
You didn't answer that ;-)

if you don't use MacPorts - there is no need to tinker with the 'fonts.conf' file inside the Inkscape.app package.

ciradrak
Posts: 5
Joined: Fri Sep 25, 2009 3:23 am

Re: Create PDF for on-line distribution?

Postby ciradrak » Thu Oct 01, 2009 6:49 am

Ok, 0.47pre2-3 does work. And all the same complaints still show up on the command line, so none of them were critical.

I'm guessing that something changed when I ran `port selfupdate` (yes MacPorts is installed) working on compiling from source. Then the older version was no longer compatible while the more recent one was. I expect that when I get the compile done it too will work.

That being said I'd like to share what I did to get the pdf file size down.

First, because my OSX Inkscape was broken I switched to Linux. I needed my fonts to make the document work, so I brought them over using FontForge. I then generated pdfs from my svg work. Then I took the pdfs back to OSX and opened them in Adobe's AcrobatPro (CS3) and saved them out as postscript files. This resulted in huge ps files. I then opened Acrobat Distiller and dropped the huge postscript files in. Distiller did it's thing and gave me back pdfs averaging 500KiB. I then took those back into Acrobat and composed the pages together into my final file.

It would be nice to be able to do this using open source tools, but at least I was able to get my Inkscape generated pdf down to about 5MB.

>whew<

ciradrak
Posts: 5
Joined: Fri Sep 25, 2009 3:23 am

Re: Create PDF for on-line distribution?

Postby ciradrak » Thu Oct 01, 2009 8:30 am

~suv wrote:
ciradrak wrote:X11 -> About X11 says: Xquartz 2.1.5 - (xorg-server 1.3.0-apple22) (2.1.5)
pardon my ignorance - you have Leopard OS X 10.5.5 and never updated to 10.5.8?


I'm slow.

~suv wrote:
ciradrak wrote:The behavior of the crash is changed but it still doesn't work when I move ~/.fontconfig/ aside.
because I didn't say to 'move ~/.fontconfig', but the remove its contents ;-)

Due to a bug in the launcher script Inkscape cannot recreate that folder if it's missing.


It's nice that has been fixed in 0.47pre2

~suv wrote:Please try again:

Code: Select all

mv ~/.fontconfig ~/.fontconfig.prev
mkdir ~/.fontconfig
and restart Inkscape by double-click in the finder, not on the command line (you still see the log messages in Console.app)

Any changes?


No, it doesn't change the behavior of 0.46 to give it an empty ~/.fontconfig/

na@w02-129-24-42-141:/Users/na
20 $ /Applications/Inkscape.0.46.app/Contents/MacOS/Inkscape
2009-09-30 16:17:53.226 Inkscape[1004:10b] Error loading /Library/ScriptingAdditions/24U Appearance OSAX.osax/Contents/MacOS/24U Appearance OSAX: dlopen(/Library/ScriptingAdditions/24U Appearance OSAX.osax/Contents/MacOS/24U Appearance OSAX, 262): no suitable image found. Did find:
/Library/ScriptingAdditions/24U Appearance OSAX.osax/Contents/MacOS/24U Appearance OSAX: mach-o, but wrong architecture
Inkscape: OpenScripting.framework - scripting addition /Library/ScriptingAdditions/24U Appearance OSAX.osax declares no loadable handlers.
2009-09-30 16:17:53.419 defaults[1025:10b]
The domain/default pair of (kCFPreferencesAnyApplication, AppleAquaColorVariant) does not exist
2009-09-30 16:17:53.449 defaults[1026:10b]
The domain/default pair of (kCFPreferencesAnyApplication, AppleHighlightColor) does not exist

(inkscape-bin:1005): Gtk-WARNING **: Locale not supported by C library.
Using the fallback 'C' locale.

Emergency save activated!
Emergency save completed. Inkscape will close now.
If you can reproduce this crash, please file a bug at http://www.inkscape.org
with a detailed description of the steps leading to the crash, so we can fix it.
^C
na@w02-129-24-42-141:/Users/na
21 $

Is there a difference between starting from within the Finder and on the command line? I don't see one, (besides that console.app gives you time stamps and multiple copies of its error messages) :)

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: Create PDF for on-line distribution?

Postby ~suv » Thu Oct 01, 2009 11:25 am

ciradrak wrote:It's nice that has been fixed in 0.47pre2
You're slow again ;-) Inkscape 0.47pre3-2 is out already…

ciradrak wrote:Is there a difference between starting from within the Finder and on the command line? I don't see one, (besides that console.app gives you time stamps and multiple copies of its error messages) :)
Yes - if you start Inkscape from the command line the shell launch scripts ('Contents/Resources/script' and 'Contents/Resources/bin/inkscape') inherit your shell environment (defined in the shell startup files like ~/.profile, ~/.bash_profile and ~/.bashrc etc.). Otherwise (double-click on icon method) Inkscape starts with a reduced initial shell environment (the same for all applications started by 'launchd') and sets the necessary environmant variables in 'Contents/Resources/bin/inkscape'. There is the possibility of unforseen conflicts (e.g. regarding $PATH, $PYTHONPATH, $PYTHONHOME and the way the extension system finds the called resources).

ciradrak wrote:No, it doesn't change the behavior of 0.46 to give it an empty ~/.fontconfig/
grrmble... the console messages (what the heck is this '24U Appearance OSAX.osax' doing in watching Inkscape's launches? ;-) are not revealing why it crashes. If you need both 0.46 and 0.47pre functional - please try the changes to 'Contents/Resources/etc/fonts/fonts.conf' (quit any running Inkscape and X11 first).

If this doesn't work either - there's still another way to figure out where Inkscape hangs: start with double-click (yes, I know ;-) - does Inkscape stay active in the dock unless you force quit it? Well, don't force-quit it but open 'Activity Monitor.app', select the process 'inkscape-bin' (sometimes it is listed as 'inkscape') and take a 'sample' (Option+Cmd+S), and/or 'inspect' (Cmd+I) it (this is like a GUI for 'lsof'), and look at the whole list of open files and ports: does it load any files from the MacPorts tree? (it definitely should not). Attach the list + sample if the other fix doesn't help.

BTW - Congrats to the successful PDF shrinking process - still wondering what blew up the Inkscape/Cairo PDF files that much...

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: Create PDF for on-line distribution?

Postby ~suv » Thu Oct 01, 2009 11:35 am

ciradrak wrote:24U Appearance OSAX: mach-o, but wrong architecture
On their website they offer universal binaries for current versions - so I don't understand why you see this error message...
Can you temporarily disable the AppleScript Scripting Additions to confirm that they have not influence on Inkscape crash?

ciradrak wrote:2009-09-30 16:17:53.419 defaults[1025:10b] The domain/default pair of (kCFPreferencesAnyApplication, AppleAquaColorVariant) does not exist
2009-09-30 16:17:53.449 defaults[1026:10b] The domain/default pair of (kCFPreferencesAnyApplication, AppleHighlightColor) does not exist

(inkscape-bin:1005): Gtk-WARNING **: Locale not supported by C library.
Using the fallback 'C' locale.
these are warnings only, nothing out of the ordinary.


Return to “Help with using Inkscape”