R (Chandra) Chandrasekhar ha scritto:
R (Chandra) Chandrasekhar wrote:
Is this a bug, and if so, is there a workaround?
I still do not know whether this is a bug, but the workaround is:
Skip the "Fit page to selection" step and export as PDF; and
Use the pdfcrop utility, written by Heiko Oberdiek, and available from:
to crop the file saved in (1) to the correct bounding box dimensions.
System requirements for pdfcrop are also given at the above address.
The resulting bounding box and PDF file is accurate when viewed at 6400% with Acroread.
Or you may export to eps and use epstopdf, which computes the correct bounding box and IMHO creates a nicer PDF. I've written a simple extension to automate this process, you can find it attached to this post. Beware, it's my first extension and I haven't been using python for a long time; anyway, it works for me.
Davide davide125@...152...
<inkscape-extension> <name>PDF Output (epstopdf)</name> <id>org.inkscape.output.epstopdf</id> <dependency type="extension">org.inkscape.output.eps</dependency> <dependency type="executable" location="extensions">eps2pdf.py</dependency> <dependency type="executable">epstopdf</dependency> <output> <extension>.pdf</extension> <mimetype>image/x-portable-document-format</mimetype> <filetypename>PDF via epstopdf (*.pdf)</filetypename> <filetypetooltip>Adobe Portable Document Format (via epstopdf)</filetypetooltip> </output> <script> <command reldir="extensions" interpreter="python">eps2pdf.py</command> <helper_extension>org.inkscape.output.eps</helper_extension> </script> </inkscape-extension>
#!/usr/bin/env python ''' Copyright (C) 2007 Davide Cavalca <davide125@...152...>
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA '''
import inkex import sys, os
# Win32's stdout must be set in binary mode to write PDF data # http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65443 if sys.platform == "win32": import msvcrt msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
class MyEffect(inkex.Effect): def __init__(self): inkex.Effect.__init__(self) def output(self): pass def effect(self): eps_file = self.args[-1] command = "epstopdf --filter" eps_in = open(eps_file,'rb') cin, cout = os.popen2(command,'b') cin.write(eps_in.read()) eps_in.close() cin.close() sys.stdout.write(cout.read()) cout.close() sys.stdout.flush()
# I'm not using affect() because it calls parse() which attempts to parse input # file (which is eps, not svg since we depend from the eps filter e = MyEffect() e.getoptions() e.effect()