Summary: | Support rendering a part (subrectangle) of a document | ||
---|---|---|---|
Product: | Ghostscript | Reporter: | whiskey |
Component: | General | Assignee: | Default assignee <ghostpdl-bugs> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | P4 | ||
Version: | 8.71 | ||
Hardware: | PC | ||
OS: | Linux | ||
Customer: | Word Size: | --- |
Description
whiskey
2011-06-12 12:19:20 UTC
If the document is an EPS file that has %%BoundingBox: comments, then -dEPSCrop will do this automatically. For general PostScript you can set the page size to a a width height using -gWxH (where W and H are in pixels). You can move the origin up to the interesting port part of the page by using the 'translate' operator to move the graphics down. If the 100,100 lower region in the example was in points (1/72 inch) and the 400,500 is the upper right corner (also in points), then the origin needs to be at (100*96/72=133.3333) assuming -r96 is being used for the png and the page size in pixels will be 400 by 534 pixels (rounding 533.333 up) thus this command line would be used: gs -q -sDEVICE=png16m -r96 -g400x534 -dNOPLATFONTS -dTextAlphaBits=4 \ -dGraphicsAlphaBits=4 -o /tmp/x.png \ -c "<< /Install { -133.3333 dup translate } >> setpagedevice" x.ps The magic "Install" procedure establishes the 'initgraphics' CTM for PS and is standard PostScript straight out of the PLRM. This isn't a bug, so closing as "FIXED" by this example. Next time try asking someone on comp.lang.postscript or IRC #ghostscript or stackoverflow. |