ps2eps-1.70~github/0000755000175000017500000000000014023250615012416 5ustar mcymcyps2eps-1.70~github/LICENSE.txt0000644000175000017500000004312714023250615014250 0ustar mcymcy GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy 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 Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19yy name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. ps2eps-1.70~github/README.md0000644000175000017500000000522514023250615013701 0ustar mcymcy# ps2eps ps2eps - calculate correct bounding boxes for PostScript and PDF files ## Description ps2eps is a tool (written in Perl) to produce Encapsulated PostScript Files (EPS/EPSF) from usual one-paged Postscript documents. It calculates correct Bounding Boxes for those EPS files and filters some special postscript command sequences that can produce erroneous results on printers. EPS files are often needed for including (scalable) graphics of high quality into TeX/LaTeX (or even Word) documents. Included graphics can be clipped to their bounding box. Nowadays PDF is more widely used, but the original problems described below still exist: pdfcrop sometimes does not produce the correct bounding box. This program can be used together with pdfcrop in order to produce reliable bounding boxes for PDF files, too. Other programs like ps2epsi do not calculate the bounding box always correctly (because the values are put on the postscript stack which may get corrupted by bad postscript code) or rounded it off so that clipping the EPS cut off some part of the image. ps2eps uses a double precision resolution of 144 dpi and appropriate rounding to get a proper bounding box. The internal bbox device of ghostscript generates different values (sometimes even incorrect), so using the provided bbox should be more robust. However, because normal clipping has only a resolution of 1/72dpi (postscript point), the clipping process may still erase parts of your EPS image. In this case please use the -l option to add an additional point of white space around the tight bounding box. ## Documentation Please see documentation in the manpage or doc/ sub directory. Note that the manpage may have an older version number in it, which is nothing to worry about since there may have been minor changes incorporated into ps2eps not requiring any update of the documentation. ## Installation see doc/INSTALL.md ## Updates See the git repository: https://github.com/roland-bless/ps2eps ## License (GNU GPL 2.0) 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 ps2eps-1.70~github/doc/0000755000175000017500000000000014023250615013163 5ustar mcymcyps2eps-1.70~github/doc/INSTALL.md0000644000175000017500000000427014023250615014616 0ustar mcymcy# INSTALLATION ## Prerequisites you need: * perl (an interpreter for the perl language, see http://www.perl.com) * ghostscript (an interpreter/raster image processor for the PostScript language, see https://www.ghostscript.com/) * maybe an ANSI-C compiler if the provided binaries for bbox do not work for you. Sorry for the inconvenience, but I tried to write a bbox equivalent in perl and it was terribly slow. Therefore I stick to C, because of much better performance. *Alternatively* you can use ps2eps option -g, then no bbox binary is required. ## How to install Please check that you have working perl and ghostscript packages. ### Linux/UNIX-based platform 1. install bbox If a bbox binary is included for your platform you simply move it into any directory of the system search path. Otherwise, you have to compile bbox.c first by invoking ``` cc -o bbox bbox.c. ``` (sometimes "make bbox" also works). Please make sure that bbox is executable (chmod a+x bbox). If you already have a working perl and a working ghostscript, you're finished here, else you have to install them first. 2. install ps2eps On Unix platforms you simply move the perl script ps2eps into a directory which is included in the system or personal search path (e.g., /usr/local/bin, $home/bin). Please make sure that ps2eps is executable (chmod a+x ps2eps). ### Windows-based platform Use the command line interpreter: Copy bbox.exe into a directory that is in your's or the system's search path for executables. Please try to invoke bbox -h afterwards. The best possibility is to use associated file types under Windows: 1. rename ps2eps to ps2eps.pl and 2. SET PATHEXT=.pl;%PATHEXT% or use the settings -> control panel -> system -> "advanced" tab -> environment variables and edit the PATHEXT entry accordingly. 3. then simply typing ps2eps should invoke ps2eps correctly Another option is to call perl directly: ``` perl ps2eps ... ``` The script assumes that you have "gswin32c" as postscript interpreter in your path. Under Windows ps2eps can perform wildcard expansion on its own. ps2eps-1.70~github/doc/Makefile0000644000175000017500000000261714023250615014631 0ustar mcymcy# -----------------------------------*- mode: Makefile; -*-- # Makefile for ps2eps documentation # ---------------------------------------------------------- # $Id: Makefile 139 2012-06-14 08:40:32Z bless $ # $Source: /home/bless/src/ps2eps/cvs-repository/ps2eps/doc/Makefile,v $ # ---------------------------------------------------------- # `$@' The file name of the target of the rule. # `$%' The target member name, when the target is an archive member. # `$<' The name of the first prerequisite. # `$?' The names of all the prerequisites that are newer than the target, with spaces between them. # `$^' The names of all the prerequisites, with spaces between them. .PHONY: manpages pdf html DOCBOOK_FLAGS=-c /usr/share/sgml/docbook/dtd/catalog DOCBOOK_TO_MAN=docbook2man DOCBOOK_TO_HTML=docbook2html DOCBOOK_TO_PDF=docbook2pdf #needs pdfjadetex MANPAGES=ps2eps.1 bbox.1 PDF=ps2eps.pdf bbox.pdf HTML=ps2eps.html bbox.html all: manpages pdf html manpages: $(MANPAGES) pdf: $(PDF) html: $(HTML) %.pdf : %.1 groff -m mandoc $< | ps2pdf - $@ # when having .1 # $(DOCBOOK_TO_PDF) $(DOCBOOK_FLAGS) $< %.html : %.sgml # groff -m mandoc -Thtml $< >$@ # when having .1 $(DOCBOOK_TO_HTML) $(DOCBOOK_FLAGS) $< mv index.html $@ %.1 : %.sgml $(RM) $@ $(DOCBOOK_TO_MAN) $(DOCBOOK_FLAGS) $< clean: rm $(MANPAGES) $(PDF) $(HTML) manpage.refs manpage.links # -------------------------------------------------------- ps2eps-1.70~github/doc/bbox.10000644000175000017500000000441714023250615014205 0ustar mcymcy.\" This manpage has been automatically generated by docbook2man .\" from a DocBook document. This tool can be found at: .\" .\" Please send any bug reports, improvements, comments, patches, .\" etc. to Steve Cheng . .TH "BBOX" "1" "January 22, 2004" "" "" .SH NAME bbox \- prints out the bounding box of a rawppm or rawpbm image .SH SYNOPSIS \fBbbox\fR [ \fB-l\fR ] [ \fB-r\fR ] [ \fB-h\fR ] [ \fB-V\fR ] [ \fB\fIrawpbmfile\fB\fR ] .SH "DESCRIPTION" .PP \fBbbox\fR reads a rawppm or rawpbm file and prints out the bounding box of the image (as postscript comment and in postscript points, i.e. 1/72dpi) as well as the high resolution bounding box. Input is read from standard input if no filename is specified. Example output: .nf %%BoundingBox: 12 253 829 837 %%HiResBoundingBox: 12.500000 253.000000 828.500000 837.00000 .fi .PP \fBbbox\fR has only very limited memory requirements as it reads the input line by line and thus needs to store only one picture line in memory. .SH "OPTIONS" .TP \fB-h | --help \fR Show summary of options. .TP \fB-V \fR Show version of program. .TP \fB-r \fR resolution of picture in dpi .TP \fB-l \fR loose bounding box (integer bounding box is expanded by 1 point, hires bounding box is expanded by 0.5 points) .SH "SEE ALSO" .PP ps2eps (1) .SH "AUTHOR" .PP \fBbbox\fR was written by Roland Bless. .SS "ACKNOWLEDGMENTS" .PP Special thanks goes to Michael Sharpe from UCSD who suggested a lot of improvements for bbox to become more precise and robust, especially for small drawings. .PP An earlier version of this manual page was originally written by Rafael Laboissiere for the Debian system. Thank you Rafael! Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts and no Back-Cover Texts. .SH "BUGS" .PP Though the code is quite small and the probability for bugs is now small, there may be some left somewhere between the lines. In case you find one, please send a short description with \fBbbox\fR version number to (please allow some time to reply). ps2eps-1.70~github/doc/bbox.html0000644000175000017500000000716114023250615015010 0ustar mcymcy bbox

bbox

Name

bbox --  prints out the bounding box of a rawppm or rawpbm image

Synopsis

bbox [-l] [-r] [-h] [-V] [rawpbmfile]

DESCRIPTION

bbox reads a rawppm or rawpbm file and prints out the bounding box of the image (as postscript comment and in postscript points, i.e. 1/72dpi) as well as the high resolution bounding box. Input is read from standard input if no filename is specified. Example output:

	  %%BoundingBox: 12 253 829 837
	  %%HiResBoundingBox: 12.500000 253.000000 828.500000 837.00000
	  

bbox has only very limited memory requirements as it reads the input line by line and thus needs to store only one picture line in memory.

OPTIONS

-h | --help

Show summary of options.

-V

Show version of program.

-r

resolution of picture in dpi

-l

loose bounding box (integer bounding box is expanded by 1 point, hires bounding box is expanded by 0.5 points)

SEE ALSO

ps2eps (1)

AUTHOR

bbox was written by Roland Bless.

ACKNOWLEDGMENTS

Special thanks goes to Michael Sharpe from UCSD who suggested a lot of improvements for bbox to become more precise and robust, especially for small drawings.

An earlier version of this manual page was originally written by Rafael Laboissiere for the Debian system. Thank you Rafael! Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts and no Back-Cover Texts.

BUGS

Though the code is quite small and the probability for bugs is now small, there may be some left somewhere between the lines. In case you find one, please send a short description with bbox version number to (please allow some time to reply).

ps2eps-1.70~github/doc/bbox.pdf0000644000175000017500000004502614023250615014617 0ustar mcymcy%PDF-1.4 %쏢 %%Invocation: path/gs -P- -dSAFER -dCompatibilityLevel=1.4 -q -P- -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sstdout=? -sOutputFile=? -P- -dSAFER -dCompatibilityLevel=1.4 - 5 0 obj <> stream xXr6,c"nS;qRw;k)ݱ`-I0Y3}JqHqvfH&qιL<ʈ?粘xd=/ [P2]>MAK=/-r!4 ɝjR)eU Yecr8F7|#rRx ɨ@N9~♛l!*6*G~QrQVo LkUݤIB.-uViTxwJ.rEnyCZT,Dc)}S;k8S8 lJA8#-<6\U{jZYIY#W_kyYC, L&'l5)U jj#5>(Zef[Kk`b=C_kèXTr7WG6j#s{\!EBBhj: y_\\^vKO^ge@Uu&{l@P QmcylУ)r>ғ;/4Qe=~aqzvxxkT@:rB1HJXjS9[ @҉Vu_ɪq;;is ]넧%ig:^$bl7EZn!g6]k Ƣ u[Ix L*^7+4i%YZRUOY w?,f}9@Kyl%z+(c^m/(xD!d]{CjZ:Ny7^5Z# u2٢ z)+P~oR)ѤW)H"H h ݍk>Y}̖:eF® \HKn_9:t>JOމuG><#8htQL\}_R+ax]fRK0ltlw}6S^rĿ={'Dd=ߨ-XZyN`U6;UE򬱺#l7^@# ;q_OX N$XAF-}cY*T-rٙ $zì%`Mb;\d£B}0a>!pgZ|F YI{gB!ԟw|k~e\njj(ƌ[Cmƀf XajT]gm,F !Uƒ:sjoh`ٜuf4C 'Vendstream endobj 6 0 obj 2051 endobj 4 0 obj <> /Contents 5 0 R >> endobj 3 0 obj << /Type /Pages /Kids [ 4 0 R ] /Count 1 >> endobj 1 0 obj <> endobj 13 0 obj <> endobj 11 0 obj <> endobj 17 0 obj <> endobj 9 0 obj <> endobj 7 0 obj <> endobj 18 0 obj <> endobj 12 0 obj <> endobj 14 0 obj <>stream xRYpSei,5Qb <D)R6m$-$mr%{%6t%`-meQmyo}0.3Ù93;|KO$#kZ2]M@L".O|~f@dǗghcg!.%;V{jMk^XL[ƚ*TcZF1{e=cP}LVÊl  +؂~,kDI_ڦ)20-2d9uiyO0jDT!)J]:2߲GYau{MpݽwoYRr1sP d2ic`!tW!Y;3͋<[TA\)H#]cSs}Cqͻ(%|`cw()-/r7W)B=*pzҞ`6vb#e1_h/,͹ә-Z؈EyH-Vs/*B!o+x;|L83x{F1CL(Xk_p \nC愾iqfUgS \ ZS Th?L;ʜ5H6Z$AWKрdIӡ%:$,|iΤXuu^KD`( + } Cx3t%Rh'zqۈpwe FqWɮgTh+O #т9aY{?O|DޜczG\tQ"*´YfaI@h﬌4o\Ӈ/mU]UW{ T[>qow"*Rb=4>CLM\)=hd[%-{tw쵎P{tݿ̂oSo' h{͍} `<sd5VDeφC FPskj9 ' we\qw7kE>#)^~e)+W?VeWzkQve ur~|HNSEVn_34xI6|DgX&p5v^5Ѕ5)ܶS݄Z&t?SZ)|\Ƽj8ey3p3ڎ|p- ԣh5éQF|yKz\리D+;p+sS'NqUGddp$DБi)Tjay*;Zlx>,W݅`^Fg|t%ˈ=qCu`L f!]447MBT|<)`TXA5=1cTw3 7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4eLVNh.~f0 E t:bE2u P;970n}RTtD. b :Z bͤ.HCv 꾲v@WSgʮfHK57hK5-"LiN*Pч͠[(8mN1NDŽ)WB RݒCnjW/ ҼE(ҸK](e} &jQ#0vHZZuifi+Rۙӝ[Z4@6"تN>m۝bEyCz9Tl\gh)V(J r+ë;F.O.?Ot,HB^, A/6mDL҆aZAnewB#^prf݁l6 OY\WS'4K-Bz0#Qʟ{8I W7a[ǪȆF ӂ\t"K'qW>| Φ:-f DK6mp =L熾` `Rgi'*Sv7W, 8JO,, 6_9ɕǵI­ᛗc/s}1m6adb}o݁ ֖=~p֣O(,0M=`B9cޑBsxezx>=cN#clXM`$M~{8 hGCup:ZfnXМ@ wch8'x )+C( vpҫu2KmQ#؄Z72f~jmŌRB- Ѿ?0}w'!]> &1u 'Z 4ǽvхOcv`17[~*2BP\]ņCf@oyHWS$H0Yhn;D-E3w}VЅ/]P1˕ٍ{koR$2$HA-?D <.v\v-WU KMLܕyɛ\8*Y9Qhz}xǬe#56pޤG# 7-b% :1d|u CRף:ݒ?ߋՏ6\k;l Fba4I~] vͻsp:~zop]NxT_-3Z`S?|cp입ܱ {B:|h-rGp#z s'5hST4wspRdB]P|˅ۺD -lߥ%[!)!f>stream 2021-03-13T22:47:22+01:00 2021-03-13T22:47:22+01:00 groff version 1.22.4 Untitled endstream endobj 2 0 obj <>endobj xref 0 20 0000000000 65535 f 0000002524 00000 n 0000018258 00000 n 0000002465 00000 n 0000002323 00000 n 0000000182 00000 n 0000002303 00000 n 0000003385 00000 n 0000009418 00000 n 0000002979 00000 n 0000005928 00000 n 0000002639 00000 n 0000004054 00000 n 0000002589 00000 n 0000004305 00000 n 0000006231 00000 n 0000009903 00000 n 0000002894 00000 n 0000003959 00000 n 0000016999 00000 n trailer << /Size 20 /Root 1 0 R /Info 2 0 R /ID [<2437B4294E349AF932F9B4B55228AC60><2437B4294E349AF932F9B4B55228AC60>] >> startxref 18412 %%EOF ps2eps-1.70~github/doc/bbox.sgml0000644000175000017500000001157614023250615015013 0ustar mcymcy Roland"> Bless"> January 22, 2004"> 1"> roland@bless.de"> bbox"> bbox"> Debian"> GNU"> GPL"> ]>
&dhemail;
&dhfirstname; &dhsurname; 2003 &dhusername; &dhdate;
&dhucpackage; &dhsection; &dhpackage; prints out the bounding box of a rawppm or rawpbm image &bbox; rawpbmfile DESCRIPTION &bbox; reads a rawppm or rawpbm file and prints out the bounding box of the image (as postscript comment and in postscript points, i.e. 1/72dpi) as well as the high resolution bounding box. Input is read from standard input if no filename is specified. Example output: %%BoundingBox: 12 253 829 837 %%HiResBoundingBox: 12.500000 253.000000 828.500000 837.00000 &bbox; has only very limited memory requirements as it reads the input line by line and thus needs to store only one picture line in memory. OPTIONS Show summary of options. Show version of program. resolution of picture in dpi loose bounding box (integer bounding box is expanded by 1 point, hires bounding box is expanded by 0.5 points) SEE ALSO ps2eps (1) AUTHOR &bbox; was written by &dhusername;. ACKNOWLEDGMENTS Special thanks goes to Michael Sharpe from UCSD who suggested a lot of improvements for bbox to become more precise and robust, especially for small drawings. An earlier version of this manual page was originally written by Rafael Laboissiere rafael@debian.org for the &debian; system. Thank you Rafael! Permission is granted to copy, distribute and/or modify this document under the terms of the &gnu; Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts and no Back-Cover Texts. BUGS Though the code is quite small and the probability for bugs is now small, there may be some left somewhere between the lines. In case you find one, please send a short description with &bbox; version number to &dhemail; (please allow some time to reply).
ps2eps-1.70~github/doc/ps2eps.10000644000175000017500000004231314023250615014464 0ustar mcymcy.\" This manpage has been automatically generated by docbook2man .\" from a DocBook document. This tool can be found at: .\" .\" Please send any bug reports, improvements, comments, patches, .\" etc. to Steve Cheng . .TH "PS2EPS" "1" "September 1st, 2018" "" "" .SH NAME ps2eps \- convert PostScript to EPS (Encapsulated PostScript) files .SH SYNOPSIS \fBps2eps\fR [ \fB-f\fR ] [ \fB-q\fR ] [ \fB-N\fR ] [ \fB-O\fR ] [ \fB-X\fR ] [ \fB-n\fR ] [ \fB-P\fR ] [ \fB-c\fR ] [ \fB-C\fR ] [ \fB-m\fR ] [ \fB-B\fR ] [ \fB-E\fR ] [ \fB-s \fIpagedim\fB\fR ] [ \fB-t \fIoffset\fB\fR ] [ \fB-r \fIresolution\fB\fR ] [ \fB-R \fI+|-|^\fB\fR ] [ \fB-l\fR ] [ \fB-g\fR ] [ \fB-H\fR ] [ \fB-d\fR ] [ \fB-h|--help\fR ] [ \fB-a\fR ] [ \fB-W\fR ] [ \fB-L\fR ] [ \fB-V|--version\fR ] [ \fB--\fR ] [ \fB\fIpsfile1\fB\fR ] [ \fB\fIpsfile2\fB\fR ] [ \fB\fI\&...\fB\fR ] .SH "DESCRIPTION" .PP This manual page documents \fBps2eps\fR version 1.70. .PP \fBps2eps\fR is a tool (written in Perl) to produce Encapsulated PostScript Files (EPS/EPSF) from usual one-paged Postscript documents. It calculates correct Bounding Boxes for those EPS files and filters some special postscript command sequences that can produce erroneous results on printers. EPS files are often needed for including (scalable) graphics of high quality into TeX/LaTeX (or even Word) documents. It can also be used to calculate correct BoundingBoxes for PDF files by using the option \fB--BBonly\fR\&. However, it cannot produce a PDF file, but it can be used together with \fBpdfcrop\fR\&. .PP Without any argument, ps2eps reads from standard input and writes to standard output. If filenames are given as arguments they are processed one by one and output files are written to filenames with extension \fI\&.eps\fR\&. If input filenames have the extension \fI\&.ps\fR or \fI\&.prn\fR, this extension is replaced with \fI\&.eps\fR\&. In all other cases \fI\&.eps\fR is appended to the input filename. Please note that PostScript files for input should contain only one single page (you can possibly use the \fBpsselect\fR from the psutils package to extract a single page from a document that contains multiple pages). .PP If BoundingBox in output seems to be wrong, please try options \fB--size\fR or \fB--ignoreBB\fR\&. See also section TROUBLESHOOTING. .SH "OPTIONS" .PP \fBps2eps\fR follows the usual GNU command line syntax, with long options starting with two dashes (`-'). A summary of options is included below. .TP \fB-h, --help \fR Show summary of options. .TP \fB-V, --version \fR Show version of program. .TP \fB-f, --force \fR Force overwriting existing files. \fBps2eps\fR will not overwrite files by default to avoid deleting original EPS files accidently. .TP \fB-q, --quiet \fR quiet operation (no output while processing files, except errors). .TP \fB-N, --noinsert \fR do not insert any postscript code. Normally a few postscript instructions are added around the original postscript code by \fBps2eps\fR which can be turned off by this option. .TP \fB-O, --preserveorientation \fR do not filter %%Orientation: header comment. .TP \fB-X, --BBonly \fR Just print the resulting bounding box(es) to standard error, no output file is written. \fBps2eps\fR will perform a read-only operation. This is highly useful to calculate bounding boxes of PDF files. Can be used with option \fB--quiet\fR to suppress other output and also with \fB--nohires\fR to suppress output of the HiResBoundingBox. It can be used with \fBpdfcrop\fR as follows: \fBpdfcrop --gscmd 'gswrap-ps2eps.sh' file.pdf\fR where \fBgswrap-ps2eps.sh\fR containts something like \fBps2eps -l -X -q $BASH_ARGV\fR .TP \fB-n, --nofix \fR do not try to fix postscript code by filtering some instructions. .TP \fB-P, --removepreview \fR remove preview image (smaller file, but no preview anymore). .TP \fB-F, --fixps \fR fix postscript code unconditionally. Otherwise, filtering is usually triggered by detection of certain drivers only. .TP \fB-c, --comments \fR preserve document structure comments. .TP \fB-C, --clip \fR insert postscript code for clipping. Unless \fB--nohires\fR is specified, the HiResBoundingBox (enlarged by 0.1 points) is used for clipping. .TP \fB-m, --mono \fR use black/white bitmap as base for calculation (default: off). .TP \fB-s, --size=pagedim \fR where pagedim is a pre-defined standard page size (e.g., a4,a0,b0,letter,...) or explicitly specified in a format pagedim:=\fIX\fRx\fIY\fR[cm|in], where \fIX\fR and \fIY\fR are numbers (floating points are accepted) followed by units centimeter (cm) or inch (in), (default: cm). Use \fB--size=list\fR to list pre-defined pagesizes. See also environment variable PS2EPS_SIZE\&. .TP \fB-t, --translate=x,y \fR specify an x,y offset (may be negative) in postscript points (1/72 dpi) for drawing. This option may be required if your drawing has negative coordinates which usually lets ghostscript cut the negative part of your picture, because it starts to render at positive coordinates. The resulting output will also be shifted. .TP \fB-r, --resolution=dpi \fR specify a resolution in dpi (dots per inch) for drawing under ghostscript. Default resolution is 144 dpi which is the double of the typical 72 dpi. This option may help if there is a hardware dependent resolution encoded in the postscript, e.g., 600dpi. Example: \fBps2eps -l -r 600 test.ps\fR .TP \fB-R, --rotate=direction \fR This option rotates the resulting EPS output. The parameter direction determines the direction of rotation: + means +90 degrees (clockwise),- means -90 degrees (counter-clockwise), and ^ means 180 degrees (up-side down). .TP \fB-l, --loose \fR expand the original tight bounding box by one point in each direction. .TP \fB-B, --ignoreBB \fR do not use existing bounding box as page size for rendering. .TP \fB-E, --ignoreEOF \fR do not use %%EOF as hint for end of file. Otherwise, \fBps2eps\fR assumes that postscript code ends after the last %%EOF comment, because some drivers add trailing binary ``garbage'' code which gets deleted by \fBps2eps\fR by default. .TP \fB-g, --gsbbox \fR use internal bbox device of ghostscript instead of the external C program \fBbbox\fR\&. The internal bbox device of ghostscript generates different values (sometimes even incorrect), so using the provided \fBbbox\fR should be more robust. See also environment variable PS2EPS_GSBBOX\&. .TP \fB-H, --nohires \fR do not generate a %%HiResBoundingBox comment for output. .TP \fB-a, --accuracy \fR increase the accuracy by turning subsample antialiasing on (may be slower) .TP \fB-L, --license \fR show licensing information. .TP \fB-d, --debuggs \fR show ghostscript call. This may be helpful for solving problems that occur during a ghostscript call. .TP \fB-W, --warnings \fR show warnings about sanity of generated EPS file. Certain postscript commands should not be contained in an EPS file. With this option set \fBps2eps\fR will issue a warning if it detects at least one of them. .SH "TROUBLESHOOTING" .PP Based on the given postscript source code (in most cases generated by some postscript printer driver) there are many potential obstacles or problems that may occur when trying to create proper EPS files. Please read this section carefully to be aware of common pitfalls. .SS "INCOMPLETE/CLIPPED IMAGES" .PP or how to determine the right size for ghostscript. .PP If you have documents that are larger than your ghostscript default (usually A4 or US letter), you have to specify the page dimensions explicitly using the \fB-s\fR option. Otherwise your EPS might be cut off during rasterizing by ghostscript resulting in a wrongly calculated bounding box. You can pass all pre-defined page sizes to \fB-s\fR that ghostscript understands. These are currently: 11x17, ledger, legal, letter, lettersmall, archA, archB, archC, archD, archE a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, isob0, isob1, isob2, isob3, isob4, isob5, isob6, b0, b1, b2, b3, b4, b5, c0, c1, c2, c3, c4, c5, c6, jisb0, jisb1, jisb2, jisb3, jisb4, jisb5, jisb6, flsa, flse, halfletter. Unfortunately, all sizes are currently only available in portrait orientation (not landscape). .PP By default, \fBps2eps\fR uses an already given %%BoundingBox from the source file, which often corresponds to the size of the physical page format for which the document was printed. However, you should be aware that this already specified bounding box may be not correct, thus resulting in a wrongly cropped (or even no usable) \fI\&.eps\fR-file. \fBps2eps\fR can only do as good as ghostscript does in rendering the original postscript file (though \fBps2eps\fR even works with negative and fractional values are contained in the original bounding box by using automatic translation). Therefore, if the given bounding box is to small or incorrect anyway, you can ignore the existing bounding box with the \fB-B\fR option, which will cause ghostscript to use its internal default size (or use \fB-s\fR). However, if the BoundingBox has negative coordinates, which is not allowed by the specification, \fBps2eps\fR will shift the output to positive values. .PP Hint: to avoid rotating the picture if you have the original drawing in landscape format, you may use the ``Encapsulated Postscript'' option in the printer driver which should generate an EPS file (but with a bounding box of the sheet size!). But some Windows printer drivers are drawing the image with an offset from the bottom of the portrait page, so that a part of it is drawn outside the landscape oriented page. In this case, you'll have to specify a square size of the page using the maximum length, e.g., 29.7cm x 29.7cm for an A4 page. .SS "CLIPPING" .PP or why gets some of my text deleted above the included \fI\&.eps\fR file? .PP Some postscript drivers draw a white rectangle from the top left corner of the page to the right lower corner of the object. This may erase some or even all text above your imported/included EPS file, which is very annoying. In order to prevent this, most programs have a clipping option for imported \fI\&.eps\fR files (within LaTeX you can use \\includegraphics*{}) for this purpose. If this is unfortunately not the case, you can use the \fB-C\fR option of \fBps2eps\fR which will (hopefully) do it for you. Unfortunately, PScript.dll 5.2 (Windows XP) introduced new very badly behaving Postscript code (initclip) which will even override the outer clipping! Thus, a new filter had to be installed in \fBps2eps\fR which will fix it. .PP However, because most programs clip directly on the bounding box, you still may loose some pixels of your image, because the bounding box is described in the coarse resolution of postscript points, i.e. 72 dpi. In order to prevent this, you can use the \fB-l\fR option or \fB-C\fR option (for the latter, clipping by the importing program should be disabled then) to allow for a 1 point larger bounding box. \fB-C\fR clips around a 1 point enlarged bounding box and \fB-l\fR enlarges the bounding box values by 1 point (you can also combine both options). .SS "INCLUDED FILTERS" .PP Some postscript sequences, e.g., for using specific printer features (featurebegin ...), are not working well within an \fI\&.eps\fR file, so \fBps2eps\fR tries to filter them out. But please note that filters for postscript code may not work properly for your printer driver (\fBps2eps\fR was mainly tested with HP and Adobe printer drivers, although it may work for all printers using the PScript.dll). In this case you can try to turn of filtering by using option \fB-n\fR, or try to find the bad sequence in the postscript code and adapt the filter rule in the \fBps2eps\fR script (variables $linefilter, $rangefilter_begin, $rangefilter_end; linefilter is an expression for filtering single lines, rangefilter_... are expressions that filter all lines between a pattern matching $rangefilter_begin and $rangefilter_end; drop me an e-mail with your modifications). However, things may change as the printer drivers (e.g., PScript.dll) or postscript language evolve. .PP Some applications or drivers generate postscript code with leading or trailing binary code, which often confuses older postscript interpreters. \fBps2eps\fR tries to remove such code, but it may sometimes make a wrong guess about start and end of the real postscript code (drop me an e-mail with a zipped postscript source, see section BUGS). .PP Comment lines or even blank lines are removed (which is the default to make .eps files smaller), which may corrupt your output. Please check the next section how to fix this. \fBps2eps\fR removes blank lines and also (carriage ceturn ``\\r'') at the end of lines. However, nicely formatted postscript code gives a hint by using ``%%BeginBinary'' ``%%EndBinary'' comments. When \fBps2eps\fR detects these comments it will refrain from any filtering action within the marked binary sections. .PP \fBps2eps\fR filters also %%Orientation: comments by default (you can use option \fB-O\fR to turn off filtering), because ghostscript may ``automagically'' rotate images when generating PDF images, which is not desired in most cases. Hint: you can turn off that feature in ghostscript unconditionally by specifying -dAutoRotatePages=/None. .SS "CORRUPTED OUTPUT" .PP Some postscript code may get corrupted when comment lines or even blank lines are removed (which is the default to make .eps files smaller), because those files may contain encoded images which also have a % as first character in a line or use a special comment as end of image delimiter. If this is the case, use the \fB-c\fR option to prevent filtering comments. .SS "COLOR AND MEMORY" .PP \fBps2eps\fR supports colored postscript, consequently letting ghostscript consume more resources for drawing its bitmap (roughly 6MBytes for an A4 page). \fBbbox\fR is reading the bitmap line by line so it consumes only minimal memory. If you experience problems with memory consumption of ghostscript, you may use the \fB-m\fR option for using a monochrome image. But this will probably result in wrongly determined bounding boxes with colored images, because ghostscript has to do black/white dithering and may thus suppress objects drawn in light colors. .PP Another option in case of memory problems and too long run times is to use the much more memory efficient internal ghostscript bbox by using the \fB-g\fR option. .SH "ENVIRONMENT VARIABLES" .PP Please note that a command line option always takes precedence over the related environment variable. .PP The environment variable PS2EPS_SIZE can be used to specify a default page size and take any argument that \fB--size\fR accepts. Examples: \fBexport PS2EPS_SIZE=a0\fR (bash-like syntax) or \fBsetenv PS2EPS_SIZE letter\fR (csh syntax). .PP If the environment variable PS2EPS_GSBBOX is set the internal bbox device of ghostscript will be used instead of the external command \fBbbox\fR\&. Examples: \fBexport PS2EPS_GSBBOX=true\fR (bash-like syntax) or \fBsetenv PS2EPS_GSBBOX 1\fR (csh syntax). .SH "EXAMPLES" .PP The usual call is simply: \fBps2eps -l \fIfile\fB\fR .PP A relatively failsafe call would be (if your postscript is smaller than iso b0 [100cm x 141.4cm] and you have a fast computer with enough memory): \fBps2eps -l -B -s b0 -c -n \fIfile\fB\fR .PP If output is not correct try: \fBps2eps -l -B -s b0 -F \fIfile\fB\fR .SH "AUTHOR" .PP \fBps2eps\fR was written by Roland Bless. .SS "WHY?" .PP Other programs like \fBps2epsi\fR do not calculate the bounding box always correctly (because the values are put on the postscript stack which may get corrupted by bad postscript code) or rounded it off so that clipping the EPS cut off some part of the image. \fBps2eps\fR uses a double precision resolution of 144 dpi and appropriate rounding to get a proper bounding box. The internal bbox device of ghostscript generates different values (sometimes even incorrect), so using the provided \fBbbox\fR should be more robust. However, because normal clipping has only a resolution of 1/72dpi (postscript point), the clipping process may still erase parts of your EPS image. In this case please use the \fB-l\fR option to add an additional point of white space around the tight bounding box. .SS "ACKNOWLEDGMENTS" .PP Some people contributed code or suggestions to improve \fBps2eps\fR\&. Here are at least some names (sorry if I forgot your name): Christophe Druet, Hans Ecke, Berend Hasselman, Erik Joergensen, Koji Nakamaru, Hans Fredrik Nordhaug, Michael Sharpe. Special thanks goes to Michael Sharpe from UCSD who suggested a lot of useful features for ps2eps and who fixed bbox to become more precise and robust. .PP An earlier version of this manual page was originally written by Rafael Laboissiere for the Debian system. Thank you Rafael! .PP Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts and no Back-Cover Texts. .SH "BUGS" .PP If you experience problems, please check carefully all hints in the section TROUBLESHOOTING first. Otherwise, check for an updated version at or send a gzipped file of relevant postscript source code with your error description and \fBps2eps\fR version number to (please allow some time to reply). .SH "SEE ALSO" .PP bbox (1), gs (1), ps2epsi (1) ps2eps-1.70~github/doc/ps2eps.html0000644000175000017500000006145114023250615015274 0ustar mcymcy ps2eps

ps2eps

Name

ps2eps --  convert PostScript to EPS (Encapsulated PostScript) files

Synopsis

ps2eps [-f] [-q] [-N] [-O] [-X] [-n] [-P] [-c] [-C] [-m] [-B] [-E] [-s pagedim] [-t offset] [-r resolution] [-R +|-|^] [-l] [-g] [-H] [-d] [-h|--help] [-a] [-W] [-L] [-V|--version] [--] [psfile1] [psfile2] [...]

DESCRIPTION

This manual page documents ps2eps version 1.70.

ps2eps is a tool (written in Perl) to produce Encapsulated PostScript Files (EPS/EPSF) from usual one-paged Postscript documents. It calculates correct Bounding Boxes for those EPS files and filters some special postscript command sequences that can produce erroneous results on printers. EPS files are often needed for including (scalable) graphics of high quality into TeX/LaTeX (or even Word) documents. It can also be used to calculate correct BoundingBoxes for PDF files by using the option --BBonly. However, it cannot produce a PDF file, but it can be used together with pdfcrop.

Without any argument, ps2eps reads from standard input and writes to standard output. If filenames are given as arguments they are processed one by one and output files are written to filenames with extension .eps. If input filenames have the extension .ps or .prn, this extension is replaced with .eps. In all other cases .eps is appended to the input filename. Please note that PostScript files for input should contain only one single page (you can possibly use the psselect from the psutils package to extract a single page from a document that contains multiple pages).

If BoundingBox in output seems to be wrong, please try options --size or --ignoreBB. See also section TROUBLESHOOTING.

OPTIONS

ps2eps follows the usual GNU command line syntax, with long options starting with two dashes (`-'). A summary of options is included below.

-h, --help

Show summary of options.

-V, --version

Show version of program.

-f, --force

Force overwriting existing files. ps2eps will not overwrite files by default to avoid deleting original EPS files accidently.

-q, --quiet

quiet operation (no output while processing files, except errors).

-N, --noinsert

do not insert any postscript code. Normally a few postscript instructions are added around the original postscript code by ps2eps which can be turned off by this option.

-O, --preserveorientation

do not filter %%Orientation: header comment.

-X, --BBonly

Just print the resulting bounding box(es) to standard error, no output file is written. ps2eps will perform a read-only operation. This is highly useful to calculate bounding boxes of PDF files. Can be used with option --quiet to suppress other output and also with --nohires to suppress output of the HiResBoundingBox. It can be used with pdfcrop as follows: pdfcrop --gscmd 'gswrap-ps2eps.sh' file.pdf where gswrap-ps2eps.sh containts something like ps2eps -l -X -q $BASH_ARGV

-n, --nofix

do not try to fix postscript code by filtering some instructions.

-P, --removepreview

remove preview image (smaller file, but no preview anymore).

-F, --fixps

fix postscript code unconditionally. Otherwise, filtering is usually triggered by detection of certain drivers only.

-c, --comments

preserve document structure comments.

-C, --clip

insert postscript code for clipping. Unless --nohires is specified, the HiResBoundingBox (enlarged by 0.1 points) is used for clipping.

-m, --mono

use black/white bitmap as base for calculation (default: off).

-s, --size=pagedim

where pagedim is a pre-defined standard page size (e.g., a4,a0,b0,letter,...) or explicitly specified in a format pagedim:=XxY[cm|in], where X and Y are numbers (floating points are accepted) followed by units centimeter (cm) or inch (in), (default: cm). Use --size=list to list pre-defined pagesizes. See also environment variable PS2EPS_SIZE.

-t, --translate=x,y

specify an x,y offset (may be negative) in postscript points (1/72 dpi) for drawing. This option may be required if your drawing has negative coordinates which usually lets ghostscript cut the negative part of your picture, because it starts to render at positive coordinates. The resulting output will also be shifted.

-r, --resolution=dpi

specify a resolution in dpi (dots per inch) for drawing under ghostscript. Default resolution is 144 dpi which is the double of the typical 72 dpi. This option may help if there is a hardware dependent resolution encoded in the postscript, e.g., 600dpi. Example: ps2eps -l -r 600 test.ps

-R, --rotate=direction

This option rotates the resulting EPS output. The parameter direction determines the direction of rotation: + means +90 degrees (clockwise),- means -90 degrees (counter-clockwise), and ^ means 180 degrees (up-side down).

-l, --loose

expand the original tight bounding box by one point in each direction.

-B, --ignoreBB

do not use existing bounding box as page size for rendering.

-E, --ignoreEOF

do not use %%EOF as hint for end of file. Otherwise, ps2eps assumes that postscript code ends after the last %%EOF comment, because some drivers add trailing binary "garbage" code which gets deleted by ps2eps by default.

-g, --gsbbox

use internal bbox device of ghostscript instead of the external C program bbox. The internal bbox device of ghostscript generates different values (sometimes even incorrect), so using the provided bbox should be more robust. See also environment variable PS2EPS_GSBBOX.

-H, --nohires

do not generate a %%HiResBoundingBox comment for output.

-a, --accuracy

increase the accuracy by turning subsample antialiasing on (may be slower)

-L, --license

show licensing information.

-d, --debuggs

show ghostscript call. This may be helpful for solving problems that occur during a ghostscript call.

-W, --warnings

show warnings about sanity of generated EPS file. Certain postscript commands should not be contained in an EPS file. With this option set ps2eps will issue a warning if it detects at least one of them.

TROUBLESHOOTING

Based on the given postscript source code (in most cases generated by some postscript printer driver) there are many potential obstacles or problems that may occur when trying to create proper EPS files. Please read this section carefully to be aware of common pitfalls.

Incomplete/Clipped Images

or how to determine the right size for ghostscript.

If you have documents that are larger than your ghostscript default (usually A4 or US letter), you have to specify the page dimensions explicitly using the -s option. Otherwise your EPS might be cut off during rasterizing by ghostscript resulting in a wrongly calculated bounding box. You can pass all pre-defined page sizes to -s that ghostscript understands. These are currently: 11x17, ledger, legal, letter, lettersmall, archA, archB, archC, archD, archE a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, isob0, isob1, isob2, isob3, isob4, isob5, isob6, b0, b1, b2, b3, b4, b5, c0, c1, c2, c3, c4, c5, c6, jisb0, jisb1, jisb2, jisb3, jisb4, jisb5, jisb6, flsa, flse, halfletter. Unfortunately, all sizes are currently only available in portrait orientation (not landscape).

By default, ps2eps uses an already given %%BoundingBox from the source file, which often corresponds to the size of the physical page format for which the document was printed. However, you should be aware that this already specified bounding box may be not correct, thus resulting in a wrongly cropped (or even no usable) .eps-file. ps2eps can only do as good as ghostscript does in rendering the original postscript file (though ps2eps even works with negative and fractional values are contained in the original bounding box by using automatic translation). Therefore, if the given bounding box is to small or incorrect anyway, you can ignore the existing bounding box with the -B option, which will cause ghostscript to use its internal default size (or use -s). However, if the BoundingBox has negative coordinates, which is not allowed by the specification, ps2eps will shift the output to positive values.

Hint: to avoid rotating the picture if you have the original drawing in landscape format, you may use the "Encapsulated Postscript" option in the printer driver which should generate an EPS file (but with a bounding box of the sheet size!). But some Windows printer drivers are drawing the image with an offset from the bottom of the portrait page, so that a part of it is drawn outside the landscape oriented page. In this case, you'll have to specify a square size of the page using the maximum length, e.g., 29.7cm x 29.7cm for an A4 page.

Clipping

or why gets some of my text deleted above the included .eps file?

Some postscript drivers draw a white rectangle from the top left corner of the page to the right lower corner of the object. This may erase some or even all text above your imported/included EPS file, which is very annoying. In order to prevent this, most programs have a clipping option for imported .eps files (within LaTeX you can use \includegraphics*{}) for this purpose. If this is unfortunately not the case, you can use the -C option of ps2eps which will (hopefully) do it for you. Unfortunately, PScript.dll 5.2 (Windows XP) introduced new very badly behaving Postscript code (initclip) which will even override the outer clipping! Thus, a new filter had to be installed in ps2eps which will fix it.

However, because most programs clip directly on the bounding box, you still may loose some pixels of your image, because the bounding box is described in the coarse resolution of postscript points, i.e. 72 dpi. In order to prevent this, you can use the -l option or -C option (for the latter, clipping by the importing program should be disabled then) to allow for a 1 point larger bounding box. -C clips around a 1 point enlarged bounding box and -l enlarges the bounding box values by 1 point (you can also combine both options).

Included Filters

Some postscript sequences, e.g., for using specific printer features (featurebegin ...), are not working well within an .eps file, so ps2eps tries to filter them out. But please note that filters for postscript code may not work properly for your printer driver (ps2eps was mainly tested with HP and Adobe printer drivers, although it may work for all printers using the PScript.dll). In this case you can try to turn of filtering by using option -n, or try to find the bad sequence in the postscript code and adapt the filter rule in the ps2eps script (variables $linefilter, $rangefilter_begin, $rangefilter_end; linefilter is an expression for filtering single lines, rangefilter_... are expressions that filter all lines between a pattern matching $rangefilter_begin and $rangefilter_end; drop me an e-mail with your modifications). However, things may change as the printer drivers (e.g., PScript.dll) or postscript language evolve.

Some applications or drivers generate postscript code with leading or trailing binary code, which often confuses older postscript interpreters. ps2eps tries to remove such code, but it may sometimes make a wrong guess about start and end of the real postscript code (drop me an e-mail with a zipped postscript source, see section BUGS).

Comment lines or even blank lines are removed (which is the default to make .eps files smaller), which may corrupt your output. Please check the next section how to fix this. ps2eps removes blank lines and also <CR> (carriage ceturn "\r") at the end of lines. However, nicely formatted postscript code gives a hint by using "%%BeginBinary" "%%EndBinary" comments. When ps2eps detects these comments it will refrain from any filtering action within the marked binary sections.

ps2eps filters also %%Orientation: comments by default (you can use option -O to turn off filtering), because ghostscript may "automagically" rotate images when generating PDF images, which is not desired in most cases. Hint: you can turn off that feature in ghostscript unconditionally by specifying -dAutoRotatePages=/None.

Corrupted Output

Some postscript code may get corrupted when comment lines or even blank lines are removed (which is the default to make .eps files smaller), because those files may contain encoded images which also have a % as first character in a line or use a special comment as end of image delimiter. If this is the case, use the -c option to prevent filtering comments.

Color and memory

ps2eps supports colored postscript, consequently letting ghostscript consume more resources for drawing its bitmap (roughly 6MBytes for an A4 page). bbox is reading the bitmap line by line so it consumes only minimal memory. If you experience problems with memory consumption of ghostscript, you may use the -m option for using a monochrome image. But this will probably result in wrongly determined bounding boxes with colored images, because ghostscript has to do black/white dithering and may thus suppress objects drawn in light colors.

Another option in case of memory problems and too long run times is to use the much more memory efficient internal ghostscript bbox by using the -g option.

ENVIRONMENT VARIABLES

Please note that a command line option always takes precedence over the related environment variable.

The environment variable PS2EPS_SIZE can be used to specify a default page size and take any argument that --size accepts. Examples: export PS2EPS_SIZE=a0 (bash-like syntax) or setenv PS2EPS_SIZE letter (csh syntax).

If the environment variable PS2EPS_GSBBOX is set the internal bbox device of ghostscript will be used instead of the external command bbox. Examples: export PS2EPS_GSBBOX=true (bash-like syntax) or setenv PS2EPS_GSBBOX 1 (csh syntax).

EXAMPLES

The usual call is simply: ps2eps -l file

A relatively failsafe call would be (if your postscript is smaller than iso b0 [100cm x 141.4cm] and you have a fast computer with enough memory): ps2eps -l -B -s b0 -c -n file

If output is not correct try: ps2eps -l -B -s b0 -F file

AUTHOR

ps2eps was written by Roland Bless.

WHY?

Other programs like ps2epsi do not calculate the bounding box always correctly (because the values are put on the postscript stack which may get corrupted by bad postscript code) or rounded it off so that clipping the EPS cut off some part of the image. ps2eps uses a double precision resolution of 144 dpi and appropriate rounding to get a proper bounding box. The internal bbox device of ghostscript generates different values (sometimes even incorrect), so using the provided bbox should be more robust. However, because normal clipping has only a resolution of 1/72dpi (postscript point), the clipping process may still erase parts of your EPS image. In this case please use the -l option to add an additional point of white space around the tight bounding box.

ACKNOWLEDGMENTS

Some people contributed code or suggestions to improve ps2eps. Here are at least some names (sorry if I forgot your name): Christophe Druet, Hans Ecke, Berend Hasselman, Erik Joergensen, Koji Nakamaru, Hans Fredrik Nordhaug, Michael Sharpe. Special thanks goes to Michael Sharpe from UCSD who suggested a lot of useful features for ps2eps and who fixed bbox to become more precise and robust.

An earlier version of this manual page was originally written by Rafael Laboissiere for the Debian system. Thank you Rafael!

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts and no Back-Cover Texts.

BUGS

If you experience problems, please check carefully all hints in the section TROUBLESHOOTING first. Otherwise, check for an updated version at https://github.com/roland-bless/ps2eps or send a gzipped file of relevant postscript source code with your error description and ps2eps version number to (please allow some time to reply).

SEE ALSO

bbox (1), gs (1), ps2epsi (1)

ps2eps-1.70~github/doc/ps2eps.pdf0000644000175000017500000012152014023250615015073 0ustar mcymcy%PDF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%is%9W貏RIeV{>$I4ݥI !t~FnU=$'2gCeAW5 X&ؾlTr PA.p$ayrIہRzKJH|$6k !¹?T1MFS~Inȳ%j C(/J&& NI3@a "*Y36HibY>OE>g,6TR{@Vn+Ss Ar|S73¤&W}sAjul桡)(8{\R贪Ah۠ :/v:QcY>7ntAT+ܠ-&* -`` 57>~{sX~䚼wI4;נ_.? #⭤4"(̧F# DlZe`3LUkz\FD ڠ_W=}텨' ! :km=X_ެѓ@g}xþ5Df >lѩ觌ıӍú05r6H̬I0ϟnڶVϮu9""r j>\qx=e+th$Nӷ\3Q{lPxIlfw=F$~flbwtnD]!4l?L6IjtB|N 8lOyɆt&8RF~1⤉ᤁV77l)R^~/Cp?,ke+- п;OY_endstream endobj 28 0 obj 2632 endobj 4 0 obj <> /Contents 5 0 R >> endobj 14 0 obj <> /Contents 15 0 R >> endobj 18 0 obj <> /Contents 19 0 R >> endobj 22 0 obj <> /Contents 23 0 R >> endobj 26 0 obj <> /Contents 27 0 R >> endobj 3 0 obj << /Type /Pages /Kids [ 4 0 R 14 0 R 18 0 R 22 0 R 26 0 R ] /Count 5 >> endobj 1 0 obj <> endobj 13 0 obj <> endobj 17 0 obj <> endobj 21 0 obj <> endobj 25 0 obj <> endobj 29 0 obj <> endobj 11 0 obj <> endobj 33 0 obj <> endobj 9 0 obj <> endobj 34 0 obj <> endobj 7 0 obj <> endobj 35 0 obj <> endobj 12 0 obj <> endobj 30 0 obj <>stream xV{TSW>1&9RK&CRk:mj\EP@*"Iv^$! 0 "(QV+Z[EL:]]3GggCk^{|ExSXv(5fY;dt;S?V0EOhO~#vR_śML ,۬9h3(y4˷WQ4CɋV ^(/V+L'~6v{=NF,6a{j2nކNAZ#V0N&Hܭjl p>{/MPI1c,et5+ii[͍F|/s*v}yzKS n/Uزg@rsu_&jM}Pݢ6MD̏Q)028Ujkkjf3Xl(2&Mn'd3$i̷ I: j^qc'/ ù*1Cbьmq9硤[qT^,T$]GԹ4?SOv{hvRe6Y47Y"'`\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{ѫ?(1'/an~A $ H@@%ִ 9O~{ g_kbEݐewTyYJ9*Y8(t7lfw\. WsvhZi%᛿s0C]iYL3;H4mv nbƸo_MM1ߞ<=z@:i.;eRY 9s(x > !;>fnOm@Jl{` ]ZRiY_ˡK#kMsJfiwGY+)mO osC"+JRkJJjUqPZmtsK<M+.Vxk[S\qv`:F3"݉\k:gv^,}ZVzy=x̖#*dnz(~dw&Lx;Mo}Re endstream endobj 36 0 obj <>stream 2021-03-13T23:02:45+01:00 2021-03-13T23:02:45+01:00 groff version 1.22.4 Untitled endstream endobj 2 0 obj <>endobj xref 0 37 0000000000 65535 f 0000018222 00000 n 0000040760 00000 n 0000018135 00000 n 0000017417 00000 n 0000000182 00000 n 0000003551 00000 n 0000019623 00000 n 0000030310 00000 n 0000019031 00000 n 0000023822 00000 n 0000018537 00000 n 0000020376 00000 n 0000018287 00000 n 0000017559 00000 n 0000003571 00000 n 0000006294 00000 n 0000018337 00000 n 0000017703 00000 n 0000006315 00000 n 0000010492 00000 n 0000018387 00000 n 0000017847 00000 n 0000010513 00000 n 0000014671 00000 n 0000018437 00000 n 0000017991 00000 n 0000014692 00000 n 0000017396 00000 n 0000018487 00000 n 0000020687 00000 n 0000024247 00000 n 0000030926 00000 n 0000018932 00000 n 0000019524 00000 n 0000020237 00000 n 0000039501 00000 n trailer << /Size 37 /Root 1 0 R /Info 2 0 R /ID [<053B3BD761625A145A2FD724017A45A5><053B3BD761625A145A2FD724017A45A5>] >> startxref 40914 %%EOF ps2eps-1.70~github/doc/ps2eps.sgml0000644000175000017500000006530014023250615015267 0ustar mcymcy Roland"> Bless"> September 1st, 2018"> 1"> roland at bless.de"> ps2eps"> ps2eps"> Debian"> GNU"> GPL"> ]>

&dhemail;
&dhfirstname; &dhsurname; 2018 &dhusername; &dhdate; &dhucpackage; &dhsection; &dhpackage; convert PostScript to EPS (Encapsulated PostScript) files &ps2eps; psfile1 psfile2 ... DESCRIPTION This manual page documents &ps2eps; version &ps2epsver;. &ps2eps; is a tool (written in Perl) to produce Encapsulated PostScript Files (EPS/EPSF) from usual one-paged Postscript documents. It calculates correct Bounding Boxes for those EPS files and filters some special postscript command sequences that can produce erroneous results on printers. EPS files are often needed for including (scalable) graphics of high quality into TeX/LaTeX (or even Word) documents. It can also be used to calculate correct BoundingBoxes for PDF files by using the option . However, it cannot produce a PDF file, but it can be used together with pdfcrop. Without any argument, ps2eps reads from standard input and writes to standard output. If filenames are given as arguments they are processed one by one and output files are written to filenames with extension .eps. If input filenames have the extension .ps or .prn, this extension is replaced with .eps. In all other cases .eps is appended to the input filename. Please note that PostScript files for input should contain only one single page (you can possibly use the psselect from the psutils package to extract a single page from a document that contains multiple pages). If BoundingBox in output seems to be wrong, please try options or . See also section TROUBLESHOOTING. OPTIONS &ps2eps; follows the usual &gnu; command line syntax, with long options starting with two dashes (`-'). A summary of options is included below. , Show summary of options. , Show version of program. , Force overwriting existing files. &ps2eps; will not overwrite files by default to avoid deleting original EPS files accidently. , quiet operation (no output while processing files, except errors). , do not insert any postscript code. Normally a few postscript instructions are added around the original postscript code by &ps2eps; which can be turned off by this option. , do not filter %%Orientation: header comment. , Just print the resulting bounding box(es) to standard error, no output file is written. &ps2eps; will perform a read-only operation. This is highly useful to calculate bounding boxes of PDF files. Can be used with option to suppress other output and also with to suppress output of the HiResBoundingBox. It can be used with pdfcrop as follows: pdfcrop --gscmd 'gswrap-ps2eps.sh' file.pdf where gswrap-ps2eps.sh containts something like ps2eps -l -X -q $BASH_ARGV , do not try to fix postscript code by filtering some instructions. , remove preview image (smaller file, but no preview anymore). , fix postscript code unconditionally. Otherwise, filtering is usually triggered by detection of certain drivers only. , preserve document structure comments. , insert postscript code for clipping. Unless is specified, the HiResBoundingBox (enlarged by 0.1 points) is used for clipping. , use black/white bitmap as base for calculation (default: off). , =pagedim where pagedim is a pre-defined standard page size (e.g., a4,a0,b0,letter,...) or explicitly specified in a format pagedim:=XxY[cm|in], where X and Y are numbers (floating points are accepted) followed by units centimeter (cm) or inch (in), (default: cm). Use to list pre-defined pagesizes. See also environment variable PS2EPS_SIZE. , specify an x,y offset (may be negative) in postscript points (1/72 dpi) for drawing. This option may be required if your drawing has negative coordinates which usually lets &gs; cut the negative part of your picture, because it starts to render at positive coordinates. The resulting output will also be shifted. , specify a resolution in dpi (dots per inch) for drawing under ghostscript. Default resolution is 144 dpi which is the double of the typical 72 dpi. This option may help if there is a hardware dependent resolution encoded in the postscript, e.g., 600dpi. Example: ps2eps -l -r 600 test.ps , This option rotates the resulting EPS output. The parameter direction determines the direction of rotation: + means +90 degrees (clockwise),- means -90 degrees (counter-clockwise), and ^ means 180 degrees (up-side down). , expand the original tight bounding box by one point in each direction. , do not use existing bounding box as page size for rendering. , do not use %%EOF as hint for end of file. Otherwise, &ps2eps; assumes that postscript code ends after the last %%EOF comment, because some drivers add trailing binary garbage code which gets deleted by &ps2eps; by default. , use internal bbox device of &gs; instead of the external C program bbox. The internal bbox device of &gs; generates different values (sometimes even incorrect), so using the provided bbox should be more robust. See also environment variable PS2EPS_GSBBOX. , do not generate a %%HiResBoundingBox comment for output. , increase the accuracy by turning subsample antialiasing on (may be slower) , show licensing information. , show &gs; call. This may be helpful for solving problems that occur during a &gs; call. , show warnings about sanity of generated EPS file. Certain postscript commands should not be contained in an EPS file. With this option set &ps2eps; will issue a warning if it detects at least one of them. TROUBLESHOOTING Based on the given postscript source code (in most cases generated by some postscript printer driver) there are many potential obstacles or problems that may occur when trying to create proper EPS files. Please read this section carefully to be aware of common pitfalls. Incomplete/Clipped Images or how to determine the right size for &gs;. If you have documents that are larger than your &gs; default (usually A4 or US letter), you have to specify the page dimensions explicitly using the option. Otherwise your EPS might be cut off during rasterizing by &gs; resulting in a wrongly calculated bounding box. You can pass all pre-defined page sizes to that &gs; understands. These are currently: 11x17, ledger, legal, letter, lettersmall, archA, archB, archC, archD, archE a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, isob0, isob1, isob2, isob3, isob4, isob5, isob6, b0, b1, b2, b3, b4, b5, c0, c1, c2, c3, c4, c5, c6, jisb0, jisb1, jisb2, jisb3, jisb4, jisb5, jisb6, flsa, flse, halfletter. Unfortunately, all sizes are currently only available in portrait orientation (not landscape). By default, &ps2eps; uses an already given %%BoundingBox from the source file, which often corresponds to the size of the physical page format for which the document was printed. However, you should be aware that this already specified bounding box may be not correct, thus resulting in a wrongly cropped (or even no usable) .eps-file. &ps2eps; can only do as good as &gs; does in rendering the original postscript file (though &ps2eps; even works with negative and fractional values are contained in the original bounding box by using automatic translation). Therefore, if the given bounding box is to small or incorrect anyway, you can ignore the existing bounding box with the option, which will cause &gs; to use its internal default size (or use ). However, if the BoundingBox has negative coordinates, which is not allowed by the specification, &ps2eps; will shift the output to positive values. Hint: to avoid rotating the picture if you have the original drawing in landscape format, you may use the Encapsulated Postscript option in the printer driver which should generate an EPS file (but with a bounding box of the sheet size!). But some Windows printer drivers are drawing the image with an offset from the bottom of the portrait page, so that a part of it is drawn outside the landscape oriented page. In this case, you'll have to specify a square size of the page using the maximum length, e.g., 29.7cm x 29.7cm for an A4 page. Clipping or why gets some of my text deleted above the included .eps file? Some postscript drivers draw a white rectangle from the top left corner of the page to the right lower corner of the object. This may erase some or even all text above your imported/included EPS file, which is very annoying. In order to prevent this, most programs have a clipping option for imported .eps files (within LaTeX you can use \includegraphics*{}) for this purpose. If this is unfortunately not the case, you can use the option of &ps2eps; which will (hopefully) do it for you. Unfortunately, PScript.dll 5.2 (Windows XP) introduced new very badly behaving Postscript code (initclip) which will even override the outer clipping! Thus, a new filter had to be installed in &ps2eps; which will fix it. However, because most programs clip directly on the bounding box, you still may loose some pixels of your image, because the bounding box is described in the coarse resolution of postscript points, i.e. 72 dpi. In order to prevent this, you can use the option or option (for the latter, clipping by the importing program should be disabled then) to allow for a 1 point larger bounding box. clips around a 1 point enlarged bounding box and enlarges the bounding box values by 1 point (you can also combine both options). Included Filters Some postscript sequences, e.g., for using specific printer features (featurebegin ...), are not working well within an .eps file, so &ps2eps; tries to filter them out. But please note that filters for postscript code may not work properly for your printer driver (&ps2eps; was mainly tested with HP and Adobe printer drivers, although it may work for all printers using the PScript.dll). In this case you can try to turn of filtering by using option , or try to find the bad sequence in the postscript code and adapt the filter rule in the &ps2eps; script (variables $linefilter, $rangefilter_begin, $rangefilter_end; linefilter is an expression for filtering single lines, rangefilter_... are expressions that filter all lines between a pattern matching $rangefilter_begin and $rangefilter_end; drop me an e-mail with your modifications). However, things may change as the printer drivers (e.g., PScript.dll) or postscript language evolve. Some applications or drivers generate postscript code with leading or trailing binary code, which often confuses older postscript interpreters. &ps2eps; tries to remove such code, but it may sometimes make a wrong guess about start and end of the real postscript code (drop me an e-mail with a zipped postscript source, see section BUGS). Comment lines or even blank lines are removed (which is the default to make .eps files smaller), which may corrupt your output. Please check the next section how to fix this. &ps2eps; removes blank lines and also <CR> (carriage ceturn \r) at the end of lines. However, nicely formatted postscript code gives a hint by using %%BeginBinary %%EndBinary comments. When &ps2eps; detects these comments it will refrain from any filtering action within the marked binary sections. &ps2eps; filters also %%Orientation: comments by default (you can use option to turn off filtering), because &gs; may automagically rotate images when generating PDF images, which is not desired in most cases. Hint: you can turn off that feature in &gs; unconditionally by specifying -dAutoRotatePages=/None. Corrupted Output Some postscript code may get corrupted when comment lines or even blank lines are removed (which is the default to make .eps files smaller), because those files may contain encoded images which also have a % as first character in a line or use a special comment as end of image delimiter. If this is the case, use the option to prevent filtering comments. Color and memory &ps2eps; supports colored postscript, consequently letting &gs; consume more resources for drawing its bitmap (roughly 6MBytes for an A4 page). bbox is reading the bitmap line by line so it consumes only minimal memory. If you experience problems with memory consumption of &gs;, you may use the option for using a monochrome image. But this will probably result in wrongly determined bounding boxes with colored images, because &gs; has to do black/white dithering and may thus suppress objects drawn in light colors. Another option in case of memory problems and too long run times is to use the much more memory efficient internal &gs bbox by using the option. ENVIRONMENT VARIABLES Please note that a command line option always takes precedence over the related environment variable. The environment variable PS2EPS_SIZE can be used to specify a default page size and take any argument that accepts. Examples: export PS2EPS_SIZE=a0 (bash-like syntax) or setenv PS2EPS_SIZE letter (csh syntax). If the environment variable PS2EPS_GSBBOX is set the internal bbox device of &gs; will be used instead of the external command bbox. Examples: export PS2EPS_GSBBOX=true (bash-like syntax) or setenv PS2EPS_GSBBOX 1 (csh syntax). EXAMPLES The usual call is simply: ps2eps -l file A relatively failsafe call would be (if your postscript is smaller than iso b0 [100cm x 141.4cm] and you have a fast computer with enough memory): ps2eps -l -B -s b0 -c -n file If output is not correct try: ps2eps -l -B -s b0 -F file AUTHOR &ps2eps; was written by &dhusername;. WHY? Other programs like ps2epsi do not calculate the bounding box always correctly (because the values are put on the postscript stack which may get corrupted by bad postscript code) or rounded it off so that clipping the EPS cut off some part of the image. &ps2eps; uses a double precision resolution of 144 dpi and appropriate rounding to get a proper bounding box. The internal bbox device of &gs; generates different values (sometimes even incorrect), so using the provided bbox should be more robust. However, because normal clipping has only a resolution of 1/72dpi (postscript point), the clipping process may still erase parts of your EPS image. In this case please use the option to add an additional point of white space around the tight bounding box. ACKNOWLEDGMENTS Some people contributed code or suggestions to improve &ps2eps;. Here are at least some names (sorry if I forgot your name): Christophe Druet, Hans Ecke, Berend Hasselman, Erik Joergensen, Koji Nakamaru, Hans Fredrik Nordhaug, Michael Sharpe. Special thanks goes to Michael Sharpe from UCSD who suggested a lot of useful features for ps2eps and who fixed bbox to become more precise and robust. An earlier version of this manual page was originally written by Rafael Laboissiere rafael at debian.org for the &debian; system. Thank you Rafael! Permission is granted to copy, distribute and/or modify this document under the terms of the &gnu; Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts and no Back-Cover Texts. BUGS If you experience problems, please check carefully all hints in the section TROUBLESHOOTING first. Otherwise, check for an updated version at or send a gzipped file of relevant postscript source code with your error description and &ps2eps; version number to &dhemail; (please allow some time to reply). SEE ALSO bbox (1), gs (1), ps2epsi (1) ps2eps-1.70~github/scripts/0000755000175000017500000000000014023250615014105 5ustar mcymcyps2eps-1.70~github/scripts/gswrap-ps2eps.sh0000755000175000017500000000004714023250615017162 0ustar mcymcy#!/bin/bash ps2eps -l -X -q $BASH_ARGV ps2eps-1.70~github/scripts/rbpdfcrop0000755000175000017500000000006014023250615016010 0ustar mcymcy#!/bin/bash pdfcrop --gscmd gswrap-ps2eps.sh $* ps2eps-1.70~github/src/0000755000175000017500000000000014023250615013205 5ustar mcymcyps2eps-1.70~github/src/C/0000755000175000017500000000000014023250615013367 5ustar mcymcyps2eps-1.70~github/src/C/Makefile0000644000175000017500000000033114023250615015024 0ustar mcymcy# ================================================== # Makefile for bbox C program # ================================================== CFLAGS=-Wall --pedantic -Wunused bbox: bbox.c $(CC) $(CFLAGS) bbox.c -o bbox ps2eps-1.70~github/src/C/bbox.c0000644000175000017500000003722614023250615014477 0ustar mcymcy/********************************************************************/ /** bbox -- calculates Bounding Box of a pbmraw/ppmraw-picture **/ /** Created: Nov. 1997, revised 1998, 1999, 2009, 2021 **/ /** Author: Roland Bless **/ /** Copyright (C) 1998-2020 Roland Bless **/ /** To compile simply use: **/ /** "cc bbox.c -o bbox" or "make bbox" **/ /********************************************************************/ /* * $Id: bbox.c 146 2021-03-12 20:26:23Z bless $ */ /** * 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 * **/ /* Quoting EPSF Spec: http://partners.adobe.com/public/developer/en/ps/5002.EPSF_Spec.pdf %!PS-Adobe-3.0 EPSF-3.0 %%BoundingBox: llx lly urx ury The four arguments of the bounding box comment correspond to the lower-left (llx, lly) and upper-right (urx, ury) corners of the bounding box. They are expressed in the default PostScript coordinate system. For an EPS file, the bounding box is the smallest rectangle that encloses all the marks painted on the single page of the EPS file. */ #include #include #include #if defined(_WIN32) && !defined(__CYGWIN__) #include /* needed for _setmode() */ #include #endif /********************** * global variables * **********************/ const char *const version= "$Rev: 146 $"; const char *const prgname= "bbox"; const double round_precision= 1e-6; const short int inputlinelength= 1024; unsigned char bitval[8]= { 1 << 7, 1 << 6, 1 << 5, 1 << 4, 1 << 3, 1 << 2, 1 << 1, 1 }; unsigned int minus_one(const unsigned x) { return (x == 0) ? x : x-1; } unsigned int plus_one(const unsigned x) { return (x == (unsigned int) ~0U) ? x : x+1; } /***************************** readppm_and_calcbb *********************** * input: name, resolution, tight * * output: - (stdout) * * * * Reads a RAWPPM or RAWPBM picture file (name or STDIN) and * * calculates its Bounding Box on-the-fly (line-by-line). * * * * Parameters: * * name: name of the PBMRAW file or NULL (input from stdin) * * resolution: Pixel per Inch (DPI) * * tight: boolean value, if false 1 Postscript Point is added to * each Bounding Box parameter, otherwise the BB is tight * * The Bounding Box is given in Postscript Points (72 dots/inch) * * and printed to stdout * ************************************************************************/ /* calculate the bounding box in postscript points, given a resolution in dpi */ void readppm_and_calcbb(const char *name, const unsigned int resolution, const unsigned char tight) { FILE *inputfile; char inputline[inputlinelength]; unsigned char magic_found= 0; int x,y,byte_x,i; const double pt_dpi_dbl= 72.0; unsigned int x_min, x_max, y_min, y_max; unsigned int llx, lly, urx, ury; /* bounding box */ double hllx, hlly, hurx, hury; /* hires bounding box */ unsigned char *image_row, /* ImageRow */ *tmpcolumnbytep; unsigned int width,height; /* Image Size */ unsigned int byte_width; unsigned char colormax= 0; /* max color value */ unsigned int ui_colormax= 0; /* max color value */ if ( name == NULL ) { inputfile = stdin; name = "- STDIN -"; } else { inputfile = fopen(name,"r"); if ( inputfile == NULL ) { fprintf(stderr,"%s: ERROR -- could not open file %s\n", prgname, name); exit(1); } } /** check for magic number **/ do { if (fgets(inputline, inputlinelength, inputfile) == NULL) { fprintf(stderr,"%s: ERROR -- unexpected end of file %s\n", prgname, name); fclose(inputfile); exit(1); } #ifdef DEBUG fprintf(stderr,"read:[%s]\n",inputline); #endif if ( strcmp(inputline,"P4\n") == 0 ) { magic_found= 4; } else if ( strcmp(inputline,"P6\n") == 0 ) { magic_found= 6; } } while ( !feof(inputfile) && !magic_found ); if ( !magic_found ) { fprintf(stderr,"%s: ERROR -- %s is not in ppmraw or pbmraw format\n", prgname, name); fclose(inputfile); exit(1); } /** skip comments **/ do { if (fgets(inputline, inputlinelength, inputfile) == NULL) { fprintf(stderr,"%s: ERROR -- unexpected end of file %s\n", prgname, name); fclose(inputfile); exit(1); } #ifdef DEBUG fprintf(stderr,"read:[%s]\n",inputline); #endif if (*inputline == '#') continue; else break; } while ( !feof(inputfile) ); /** read picture size: width, height **/ sscanf(inputline,"%u %u",&width,&height); if ( magic_found == 6 ) /* PPM file has maximum color-component value */ { if (fgets(inputline, inputlinelength, inputfile) == NULL) { fprintf(stderr,"%s: ERROR -- unexpected end of file %s\n", prgname, name); fclose(inputfile); exit(1); } sscanf(inputline,"%u",&ui_colormax); colormax = (unsigned char) ui_colormax; /* this is safer */ } #ifdef DEBUG fprintf(stderr,"\nreading picture: %s size X: %u Y: %u\n",name,width,height); #endif x_min= width>0 ? width-1 : 0; x_max= 0; y_min= height>0 ? height-1 : 0; y_max= 0; if ( magic_found == 4 ) /* PBMRAW = Bitmap */ { /** read raw pbmfile **/ byte_width= width / 8; if (width % 8 != 0) byte_width++; } else /** assume ppm raw **/ { byte_width= width * 3; /* we have RGB, i.e. three bytes for each pixel */ } /* * Now read a raster of Width * Height pixels, proceeding through the image in normal English reading order, * i.e., starting from top left then moving right */ /* we allocate only one line */ image_row= malloc(byte_width); if ( image_row ) { #if defined(_WIN32) && !defined(__CYGWIN__) /* this is really braindead stuff for MSVC */ i= _setmode( _fileno(stdin), _O_BINARY); if (i == -1) fprintf(stderr,"%s: ERROR - Cannot set binary mode for STDIN\n"); #endif for (y= 0; y= width ) break; #ifdef DEBUG printf("(row %04d, %04d): \n",y,x); #endif } } /* end for */ } /* end if magic_found 4 */ else { /* assume PPM */ x= byte_x/3; /* we have 3 bytes per pixel */ #ifdef DEBUG printf("(row %04d, col %04d) byte %04d: \n",y,x,byte_x,colormax); #endif } /* update bounding box */ if ( x < x_min ) x_min= x; if ( x > x_max ) x_max= x; if ( y < y_min ) y_min= y; if ( y > y_max ) y_max= y; #ifdef DEBUG printf("ymin,height:(%04d,%04d) xmin,width:(%04d,%04d)\n", y_min,y_max,x_min,x_max); #endif break; } /* if there are pixels not white */ } /* end for byte_x */ if ( byte_x != byte_width ) { /* there was a pixel with no background color */ tmpcolumnbytep= image_row+byte_width-1; /* inspect this line from the right */ for (byte_x= byte_width-1; byte_x >= 0; byte_x--,tmpcolumnbytep--) { if ( *tmpcolumnbytep != colormax ) /* there are pixels not white */ { if ( magic_found == 4 ) { for (i= 0; i<8 ; i++) { if ( *tmpcolumnbytep & bitval[i] ) { x= byte_x*8+i; if (x >= width) break; #ifdef DEBUG printf("(%04d,%04d): \n",y,x); #endif } } /* end for */ } /* end if magic_found 4 */ else { /* assume PPM */ x= byte_x/3; /* we have 3 bytes per pixel */ } /* update bounding box */ if ( x < x_min ) x_min= x; if ( x > x_max ) x_max= x; if ( y < y_min ) y_min= y; if ( y > y_max ) y_max= y; #ifdef DEBUG printf("ymin,height:(%04d,%04d) xmin,width:(%04d,%04d)\n", y_min,y_max,x_min,x_max); #endif break; } /* if there are pixels not white */ } /* end for byte_x */ } /* if line contained not only background color */ } /* end for y */ #ifdef DEBUG_BOX fprintf(stderr,"(%04d,%04d), (%04d,%04d)\n", x_min,height-y_max,x_max,height-y_min); #endif /* distance from the left edge to the leftmost point */ hllx= (x_min*pt_dpi_dbl)/resolution; /* distance from the bottom edge to the bottommost point */ hlly= ((minus_one(height)-y_max)*pt_dpi_dbl)/resolution; /* distance from the left edge to the righmost point */ hurx= (plus_one(x_max)*pt_dpi_dbl)/resolution; /* distance from the bottom edge to the uppermost point */ hury= ((height-y_min)*pt_dpi_dbl)/resolution; if ( !tight ) { /* distance from the left edge to the leftmost point */ llx= minus_one((unsigned int) ((unsigned long) x_min*72UL)/resolution); /* distance from the bottom edge to the bottommost point */ lly= minus_one((unsigned int) ((unsigned long) (minus_one(height)-y_max)*72UL)/resolution); /* distance from the left edge to the righmost point */ urx= plus_one((unsigned int) ((unsigned long) plus_one(x_max)*72UL)/resolution); /* distance from the bottom edge to the uppermost point */ ury= plus_one((unsigned int) ((unsigned long) (height-y_min)*72UL)/resolution); /* also loosen hires BBox by default precision */ if (hllx-round_precision >= 0.0) hllx-= round_precision; if (hlly-round_precision >= 0.0) hlly-= round_precision; hurx+= round_precision; hury+= round_precision; } else /* tight bounding box */ { /* distance from the left edge to the leftmost point */ llx= (unsigned int) ((unsigned long) x_min*72UL)/resolution; /* distance from the bottom edge to the bottommost point */ lly= (unsigned int) ((unsigned long) (minus_one(height)-y_max)*72UL)/resolution; /* distance from the left edge to the righmost point */ urx= (unsigned int) ((unsigned long) plus_one(x_max)*72UL)/resolution; /* round up if we got a remainder */ if ( (((unsigned long) plus_one(x_max)*72UL) % resolution) != 0 ) urx= plus_one(urx); /* distance from the bottom edge to the uppermost point */ ury= (unsigned int) ((unsigned long) (height-y_min)*72UL)/resolution; if ( (((unsigned long) (height-y_min)*72UL) % resolution) != 0 ) ury= plus_one(ury); } /* skip the rest of the file if any data is still present */ while ( !feof(inputfile) ) { fgets(inputline, inputlinelength, inputfile); } /* give out Bounding Box */ printf("%%%%BoundingBox: %d %d %d %d\n", llx, lly, urx, ury); printf("%%%%HiResBoundingBox: %f %f %f %f\n", hllx, hlly, hurx, hury); } else fprintf(stderr,"%s: ERROR -- not enough memory to read in one row of the picture\n", prgname); fclose(inputfile); free(image_row); } int main(int argc, char **argv) { int i; char *filename= NULL; unsigned int resolution= 72; /* use 72 dpi as default resolution */ unsigned char tight= 1; for (i= 1; i bless.de # ------------------------------------------------------------------- # Additional filtering is performed when Windows generated PostScript files # are processed. Some instructions will otherwise lead to bad output # if EPS-file gets embedded into other PostScript files. # # Requirements: # + perl # + gs (ghostscript supporting pbm output) # + bbox (a little C program [ANSI-C - should work on every platform] # for calculation of the actual BoundingBox) use POSIX; #use warnings; #use Getopt package use Getopt::Long; Getopt::Long::Configure("no_ignore_case"); $prgname= "ps2eps"; if (! -d "/usr/bin") { # we assume that we are running under native windows $ghostscriptname = "gswin32c"; $NULLDEV = "nul"; } else { # Unix or cygwin $ghostscriptname = "gs"; $NULLDEV = "/dev/null 2>&1"; } $bboxver=`bbox >$NULLDEV -V`; $bboxname= ($?== -1) ? "" : "bbox"; $version= '$Id: ps2eps,v 1.70 2018-01-09 18:00:00 bless Exp $'; #' $insertPScode= 1; # Insert surrounding Postscript code $infhandle = STDIN; # Standard input is the default input file $outfhandle = STDOUT; # Standard output is default output if STDIN is input $infname= '-'; $outfname= '-'; $forceoverwrite=0; # do not overwrite existing files $ignoreBB= 0; # ignore existing Bounding Box comment $removeDSC= 1; # remove Adobe document structure comments $removeADO= 1; # remove Adobe printer Driver console Output [Page: ...] $ignoreEOFDSC= 0; # ignore %%EOF DSC hint $removePreview= 0; # remove preview $quiet= 0; # write progress to stdout $resolution= 144; # resolution for bounding box calculation is 2x72 dpi $trytofixps= 1; # try to fix postscript code $forcefixps= 0; # fix postscript code unconditionally if eq 1 $filterorientation= 1;# filter Orientation line $looseBB=''; # default: tight bounding box $bboxonly=0; # output Bounding box only, no other output $clip=0; # do not clip $warnings=0; # do not print warnings concerning postscript sanity $debuggs=0; # no debugging of ghostscript call, turn this on if you want to see the gs call $inch=2.54; # one inch is 2.54cm $fullcolors= 1; # use ppm format (24-bit full color) $trailerseen= 0; # Trailer comment seen? $PSversion="2.0"; # default Postscript Version $PSDSCversion="2.0"; # default Postscript DSC Version $translate_x= 0; # translate by x postscript points $translate_y= 0; # translate by y postscript points $allbinary= 0; # treat postscript as binary do not filter or change stuff $alphaopt=""; # rendering option for ghostscript "-dTextAlphaBits=4 -dGraphicsAlphaBits=4" $hiresprecision=0.5; # amount that is changed of HiresBB in case that looseBB was requested $defaultext = '(ps|prn)'; # default extension $defaultoutext = '.eps'; # default output extension $envname_size = 'PS2EPS_SIZE'; $envname_gsbbox = 'PS2EPS_GSBBOX'; $gpar=""; $known_papersizes="11x17|ledger|legal|letter(small)?|arch[A-E]|a([0-9]|10)|isob[0-6]|b[0-5]|c[0-6]|jisb[0-6]|fls(a|e)|halfletter"; $papersize_help="11x17,ledger,legal,letter,lettersmall,archA,archB,archC,archD,archE\ a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,isob0,isob1,isob2,isob3,isob4,isob5,isob6,\ b0,b1,b2,b3,b4,b5,c0,c1,c2,c3,c4,c5,c6,\ jisb0,jisb1,jisb2,jisb3,jisb4,jisb5,jisb6,flsa,flse,halfletter\n"; $trigger= 0; $notsane= 0; $dummy=""; @ver= split(/ /,$version); # filename for temporary files if ($^O =~ /MSWin32/i or $^O =~ /cygwin/i) { # it is less trouble to use the current directory if working on # cygwin and nevertheless using gswin32c. $tmpfname= "$prgname.$$"; $win=1; } elsif (defined($ENV{'TMP'})) { $tmpdir= $ENV{'TMP'}; $filesep= ($tmpdir =~ /^?\:\\/) ? '\\' : '/'; if ($tmpdir =~ /$filesep$/) { $tmpfname= $tmpdir . "$prgname.$$"; } else { $tmpfname= $tmpdir . "$filesep$prgname.$$"; } $win=1; } else #assume we're on a UNIXBOX { $tmpfname= "/tmp/" . "$prgname.$$"; $win=0; } $licensetxt= "\ 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\n"; @prgidtxt= ( "$prgname - convert PostScript to EPS (Encapsulated PostScript) files\n", "(C)opyright 1998-2018 Roland Bless\n\n" ); @helptxt= ("Version: $ver[2]\n", "Operation:\n", " Without any argument, $prgname reads from standard input\n", " and writes to standard output.\n", " If filenames are given as arguments they are processed\n", " one by one and output files are written to filenames\n", " with extension '$defaultoutext'. If input filenames have the extension\n", " '.ps' or '.prn', this extension is replaced with '$defaultoutext'.\n", " In all other cases '$defaultoutext' is appended to the input filename.\n", " Please note that PostScript files for input should contain\n", " only one single page.\n\n", " If BoundingBox in output seems to be wrong, please try options --size or --ignoreBB.\n\n" ); @usagetxt= ("Syntax:\n", " $prgname [-f] [-q] [-N] [-O] [-X] [-n] [-P] [-c] [-b] [-C] [-m] [-B] [-E] [-s ] [-R +|-|^] [-t ] [-l] [-g] [-d] [-H] [-h|--help] [-g] [-a] [-W] [-L] [-V|--version] [--] [psfile1] [psfile2] [...]\n", "Options:\n", " -f, --force force overwriting existing files\n", " -q, --quiet quiet operation (no output while processing files)\n", " -N, --noinsert do not insert any postscript code\n", " -O, --preserveorientation do not filter Orientation: header comment\n", " -X, --BBonly print resulting bounding box(es) only, no other output\n", " -n, --nofix do not try to fix postscript code\n", " -P, --removepreview remove preview image (smaller file, but no preview)\n", " -F, --fixps fix postscript code unconditionally\n", " -c, --comments preserve document structure comments\n", " -b, --binary treat postscript as binary, do not modify characters\n", " -C, --clip insert postscript code for clipping\n", " -m, --mono use black/white bitmap as base for calculation\n", " -s, --size= page size (a0-a10,letter,...) or in format XxY[cm|in] (default:cm), where X and Y are numbers\n", " use --size=list to list pre-defined page sizes\n", " -R, --rotate= rotate resulting EPS. : +=+90 (clockw.),-=-90 (counter-clockw.) ^=180 degrees\n", " -t, --translate specify x,y offset (may be negative) in postscript points (1/72 dpi)\n", " -r, --resolution specify dpi resolution to render with ghostscript (default 144)\n", " -l, --loose expand the original bounding box by one point in each direction\n", " -B, --ignoreBB do not use existing bounding box as page size for rendering\n", " -E, --ignoreEOF do not use %%EOF as hint for end of file\n", " -g, --gsbbox use internal bbox device of ghostscript\n", " -H, --nohires do not use a HiResBoundingBox\n", " -h, --help help information\n", " -L, --license show licensing information\n", " -V, --version show version information\n", " -d, --debuggs show ghostscript call\n", " -a, --accuracy improve accuracy during rendering (maybe slower)\n", " -W, --warnings show warnings about sanity of generated eps file\n", " -- all following arguments are treated as files\n", " (allows filenames starting with -)\n", "\n", "Arguments:\n", " One or more names of PostScript files for input\n"); ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ## -- argument checking -- ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% #environment variable for papersize if (defined($ENV{"$envname_size"})) { $opt_s= $ENV{"$envname_size"}; } else { $opt_s = ''; # for s-option } if (defined($ENV{"$envname_gsbbox"})) { $bboxname=""; } $opt_t = ''; # for t-option $opt_R = ''; # for R-option $opt_r = ''; # for r-option $stopnow = 0; die "Wrong option(s), please check usage with $prgname --help\n" unless GetOptions('f|force' => \$forceoverwrite, 'q|quiet' => \$quiet, 'm|mono' => sub { $fullcolors = 0 }, 'n|nofix' => sub { $trytofixps = 0 }, 'F|fixps' => \$forcefixps, 'N|noinsert' => sub { $insertPScode = 0 }, 'O|preserveorientation' => sub { $filterorientation= 0 }, 'P|removepreview' => \$removePreview, 'c|comments' => sub { $removeDSC = 0 }, 'b|binary' => sub { $allbinary = 1 }, 'C|clip' => \$clip, 'l|loose' => sub { $looseBB = '-l' }, 'B|ignoreBB' => \$ignoreBB, 'X|BBonly' => \$bboxonly, 'E|ignoreEOF'=> \$ignoreEOFDSC, 's|size=s' => \$opt_s, 't|translate=s' => \$opt_t, 'r|resolution=s' => \$opt_r, 'R|rotate=s' => \$opt_R, 'g|gsbbox' => sub { $bboxname=""; }, 'H|nohires' => \$nohires, 'h|help' => sub { $stopnow = 1; print @prgidtxt,@helptxt,@usagetxt,"\nAuthor: Roland Bless (roland\@bless.de)\n\n"; }, 'L|license' => sub { $stopnow = 1; print @prgidtxt,$licensetxt,"\nAuthor: Roland Bless (roland\@bless.de)\n\n"; }, 'a|accuracy' => sub { $alphaopt = '-dTextAlphaBits=4 -dGraphicsAlphaBits=4' }, 'd|debuggs' => \$debuggs, 'W|warnings' => \$warnings, 'V|version' => sub { $stopnow = 1; print @prgidtxt,"Version: $ver[2]\n"; });exit if ($stopnow); ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ## -- wildcard processing -- ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ## internal wildcard processing for current directory, ## only used for non UNIX-based OSs (which may lack shell wildcard expansion) @filenames = (); foreach $object (@ARGV) { if ($win && $object =~ m/\*/o) # asterisk is present in filename { $wildcard = $object; $wildcard =~ s/\./\\\./g; # replace . in pattern with \. $wildcard =~ s/\*/\(\.\*\)/g; # replace * in pattern with (.*) opendir(DIR,'.') || die 'Unable to open current directory, stopped'; # open current directory print STDERR $wildcard; @fid = grep { /$wildcard(\.$defaultext)?/i } readdir(DIR); foreach (@fid) { push @filenames, $_; } closedir DIR; } else { push @filenames, $object; } } # end foreach $filenames[0]= '-' if (scalar(@filenames) == 0); # no file arguments, use STDIN as input print STDERR "Input files: @filenames\n" if (!$quiet); if ($opt_r ne '') { $resolution=$opt_r; } # papersize stuff if ($opt_s ne '') { # if explicit size is given, ignore existing BoundingBox always $ignoreBB = 1; $pagedimension = $opt_s; if ($opt_s eq "list") { print STDERR "Available paper sizes: $papersize_help"; exit 0; } #explicit format XxY[cm|in] if ($pagedimension =~ /(\d*\.?\d+)x(\d*\.?\d+)/) { ($x_dim, $dummy, $y_dim, $unit)= split(/(x|cm|in)/,$pagedimension); if ( $x_dim !~ /^\d*\.?\d+$/ ) { die "$x_dim in $arg is not a valid number, stopped"; } if ( $y_dim !~ /^\d*\.?\d+$/ ) { die "$y_dim in $arg is not a valid number, stopped"; } #print STDERR "xdim: $x_dim ydim: $y_dim unit:$unit\n" ; if (!defined($unit) ) { $unit='cm'; $opt_s=$opt_s . $unit; } if ( $unit ne 'in' ) # assume centimeters { # calculate dimension in pixels (remember: resolution is in dpi) $xpixels= int(($x_dim * $resolution) / $inch)+1; $ypixels= int(($y_dim * $resolution) / $inch)+1; $gpar= "-g${xpixels}x${ypixels}"; } else { $xpixels= int($x_dim * $resolution)+1; $ypixels= int($y_dim * $resolution)+1; $gpar= "-g${xpixels}x${ypixels}"; } } #endif XxY in opt_s else { if ($opt_s =~ /$known_papersizes/) { $gpar="-sPAPERSIZE=$opt_s"; } else { print STDERR "Error: Unknown paper size: $opt_s\n Acceptable papersizes are:$papersize_help\n"; exit 1; } } } #translate option if ($opt_t ne '') { ($translate_x,$translate_y)= split(/\,/,$opt_t); } #rotate $rotright='-90 rotate'; $rotleft='90 rotate'; $rotupsidedown='180 rotate'; $rotate=''; if ($opt_R ne '') { if ($opt_R eq '+') { $rotate=$rotright; } elsif ($opt_R eq '-') { $rotate=$rotleft; } elsif ($opt_R eq '^') { $rotate=$rotupsidedown; } else { die "Wrong parameter for option -R: Valid are only +,-,^\n"; }; } $device= $fullcolors ? "ppmraw" : "pbmraw"; ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ## -- iterate over different input files -- ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PROCESSFILE: while ($infname= (shift @filenames)) { # reset filter definitions for each file undef $linefilter; undef $rangefilter_begin; undef $rangefilter_end; $fixthisps= $trytofixps; $fixmsgprinted= 0; if (!$quiet) { print STDERR "Processing: $infname\n"; } unless (open($infhandle,"<$infname")) { # skip over this file print STDERR "$prgname: Can't open $infname: $!\n"; next PROCESSFILE; } # buffer input from stdin into temporary file, because it has to be read twice # one time for ghostscript processing, the second time for generating output if ($infname eq '-') # input is stdin { $tmpfhandle=''; open($tmpfhandle,">$tmpfname") or die "Cannot open temporary file $tmpfname for writing: $!\n"; } else # input is not stdin { undef $tmpfhandle; #if filename ends with $defaultext usually .ps or .prn, replace the extension with $defaultoutext if ($infname =~ /\.$defaultext$/i) { $outfname= $infname; $outfname =~ s/\.$defaultext$/$defaultoutext/i; } else # otherwise simply append the extension $defaultoutext { $outfname= $infname . "$defaultoutext"; } } #end else input is not stdin ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ## -- process input file -- ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% $linefilter= '^$'; #'# filter empty lines by default while (<$infhandle>) { # get postscript and DSC version if (/%!PS-Adobe-(\S+).*EPSF-(\S+)/) { $PSversion=$1; $PSDSCversion=$2; if (! ($PSversion =~ /\d+\.\d+/)) { $PSDSCversion="2.0"; } if (! ($PSDSCversion =~ /\d+\.\d+/)) { $PSDSCversion="2.0"; } } # check for existing BoundingBox parameters if ( /^%%\s*BoundingBox:\s*(.*)/ && !defined($eBBllx) ) { $BBarg= $1; # accept even negative and fractional BBs if ( $BBarg =~ /(\-?\d+\.?\d*\s+){3,}\-?\d+\.?\d*/ ) # ignore %% BoundingBox: (atend) comments { ($eBBllx,$eBBlly,$eBBurx,$eBBury,$dummy)= split /\s/,$BBarg; #print STDERR "Existing BB: $eBBllx,$eBBlly,$eBBurx,$eBBury\n"; if (int($eBBllx) < 0) { $translate_x= - int($eBBllx-0.5); } if (int($eBBlly) < 0) { $translate_y= - int($eBBlly-0.5); } $xpixels= int((($eBBurx-$eBBllx) * $resolution)/72 + 0.5); $ypixels= int((($eBBury-$eBBlly) * $resolution)/72 + 0.5); if (!$ignoreBB) { $gpar= "-g${xpixels}x${ypixels}"; # check for meaningful values if (($xpixels <= 1) || ($ypixels <= 1)) { $gpar=""; undef $eBBllx; undef $eBBlly; } else { if (!$quiet) { print STDERR "Rendering with existing $_"; if (int($eBBllx) < 0 || int($eBBlly) < 0) { print STDERR "WARNING: existing Bounding Box shows negative values - shifting\n"; } } } } #endif !$ignoreBB } #endif $BBarg =~ } if ($fixthisps) # try to fix bad postscript code { # check for Windows 3.x output if ( /^Win.*Dict/ ) { if (!$quiet && !$fixmsgprinted) { print STDERR "Windows 3.5 generated Postscript file detected, fixing\n"; } $linefilter= '^(EJ|RS)'; $rangefilter_begin= '^statusdict'; $rangefilter_end= 'cvx\ settransfer$'; #' $fixmsgprinted= 1; # stop printing message } else { if ( /^%%Creator:\s*Wind.U\s*Xprinter/ ) { if (!$quiet && !$fixmsgprinted) { print STDERR "Star/OpenOffice generated Postscript file detected, fixing\n"; } $linefilter= '^rs'; $fixmsgprinted= 1; # stop printing message } else { if ( $forcefixps || /^\/NTPS/ || /Creator:\s*(AdobePS|Pscript|.*Windows)/i ) #check for NT generated output { if (!$quiet && !$fixmsgprinted) { if ($forcefixps) { print STDERR "Postscript filtering requested, fixing\n"; } else { print STDERR "Windows generated Postscript file detected, fixing\n"; } } $rangefilter_begin= '^((\[\{)|(featurebegin\{))$'; #' $rangefilter_end= '^(\} stopped cleartomark|\}featurecleanup)'; $exclude_rangefilter_begin= '^(?i)%%BeginNonPPDFeature'; #' $exclude_rangefilter_end= '^(?i)%%EndNonPPDFeature'; #$triggered_rangefilter_begin= ''; #' #$triggered_rangefilter_end= ''; #' $fixsearchpat='(^|\s)(initmatrix|initclip|initgraphics)(\s|$)'; $fixreplacepat=' '; $fixmsgprinted= 1; # stop printing message } # end if NTPS } #end else } } #end if trytofixps if (defined($tmpfhandle)) { print $tmpfhandle $_ or die "$prgname: Failure during writing to temporary file $tmpfname"; } if (/^%%EOF\s*$/) { $totalEOFDSC++ } } #end while <$infhandle> if (defined($tmpfhandle)) { close($tmpfhandle); } else { $tmpfhandle= $infhandle; $tmpfname= $infname; } ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ## -- calculate the bounding box -- ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% if ($translate_x!=0 || $translate_y!=0) { $translation="$translate_x $translate_y translate"; $translatecmd="-c \'$translation\'"; } else { $translation=""; $translatecmd=""; } if (!$quiet) { print STDERR "Calculating Bounding Box..."; if ($opt_s) { print STDERR "using page size $opt_s..."; } } $rotatecmd=''; if ($rotate ne '') { $rotatecmd="-c \"$rotate\"" } if ($bboxname ne '') { $cmdline="$ghostscriptname -dSAFER -dNOPAUSE $alphaopt -q $gpar -r$resolution -sDEVICE=$device -sOutputFile=- $translatecmd -f \"$tmpfname\" -c showpage -c quit | $bboxname -r $resolution"; } else { if (!$quiet) { print STDERR "...using bbox device of $ghostscriptname..."; } $cmdline = "$ghostscriptname -dSAFER -dBATCH -dNOPAUSE -q $gpar -r$resolution -sDEVICE=bbox -sOutputFile=- -c \"/setpagedevice {pop} def\" $translatecmd -f \"$tmpfname\" -c quit 2>&1"; } if ($debuggs) { print STDERR "\nCalling: $cmdline\n"; } # actual ghostscript call $boundingbox=`$cmdline`; if ($debuggs) { print STDERR "Call result: $boundingbox"; } # check result of gs call if ($boundingbox !~ /^%%BoundingBox/m) { die "Error: Could not determine bounding box!\n", "I suppose $ghostscriptname had some trouble interpreting the postscript-file $infname. Exiting now.\n"; } $boundingbox =~ /^%%HiResBoundingBox:\s*(.*)/m; if (defined($1)) # HiResBoundingBox given { ($hcBBllx,$hcBBlly,$hcBBurx,$hcBBury,$dummy)= split(/\s/,$1); $hiresboundingbox="%%HiResBoundingBox: $hcBBllx $hcBBlly $hcBBurx $hcBBury\n"; $cBBllx = floor($hcBBllx); $cBBlly = floor($hcBBlly); $cBBurx = ceil($hcBBurx); $cBBury = ceil($hcBBury); } else { #use normal BoundingBox $boundingbox =~ /^%%.*BoundingBox:\s*(.*)/; ($cBBllx,$cBBlly,$cBBurx,$cBBury,$dummy)= split(/\s/,$1); } # if loose BB is requested # apply changes to resulting bounding box if needed if ($looseBB ne '') { if ($cBBllx > 0) { $cBBllx--; } if ($cBBlly > 0) { $cBBlly--; } $cBBurx++; $cBBury++; if ($hcBBllx-$hiresprecision >= 0.0) { $hcBBllx-= $hiresprecision; } if ($hcBBlly-$hiresprecision >= 0.0) { $hcBBlly-= $hiresprecision; } $hcBBurx+= $hiresprecision; $hcBBury+= $hiresprecision; $hiresboundingbox="%%HiResBoundingBox: $hcBBllx $hcBBlly $hcBBurx $hcBBury\n"; } if ($cBBllx < 0 || $cBBlly < 0) { if (!$quiet) { print STDERR "WARNING! Your drawing had a negative Bounding Box which is deprecated and may cause problems!. I'll shift it.\n"; } $translate_x= -int($cBBllx); $translate_y= -int($cBBlly); $cBBllx=0; $cBBurx= $cBBurx + $translate_x; $cBBlly=0; $cBBury= $cBBury + $translate_y; $hcBBurx= $hcBBurx + $hcBBllx; $hcBBury= $hcBBury + $hcBBlly; $hcBBllx= 0; $hcBBlly= 0; $hiresboundingbox="%%HiResBoundingBox: $hcBBllx $hcBBlly $hcBBurx $hcBBury\n"; $translation="$translate_x $translate_y translate"; $translatecmd="-c \'$translation\'"; } $boundingbox = "%%BoundingBox: $cBBllx $cBBlly $cBBurx $cBBury\n"; if (!$quiet) { print STDERR "ready. $boundingbox" }; if ($bboxonly) { print STDERR $boundingbox; if (defined($hiresboundingbox) && !defined($nohires)) { print STDERR $hiresboundingbox; } exit 0 }; $before_startps= 1; $inserted_prolog= 0; $prolog_passed= 0; ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ## -- Create output file -- ## %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% if (!$quiet) { print STDERR "Creating output file $outfname ... "; } if (!$forceoverwrite and -s "$outfname") { die "$prgname: Sorry, file named $outfname already exists,", " will not overwrite it.\n", " You will have to use the -f option, delete it or rename it", " before running $prgname again.\n"; } else { open($outfhandle,">$outfname") or die "Can't open file $outfname for writing: $!\n"; } open($tmpfhandle,"<$tmpfname") or die "Cannot open file $tmpfname for reading"; CREATEOUTPUT: while (<$tmpfhandle>) { # check whether we are in a binary section $binarysection=$allbinary || (/^(%%Begin(Binary|Data))|(beginimage)\r?\n?$/ ... /^(%%End(Binary|Data))|^(endimage)/) || (/^(doNimage)|(doclutimage)\r?\n?$/ ... /(^|~> )Z\r?\n?$/) || # Pscript_Win_Dib_L2 5.0 0 (/^beginjpeg / ... /~> endjpeg\r?\n?$/) || # Pscript_Win_Dib_L2 5.0 0 (/^pdfIm/ ... /^%-EOD-/); if ( !$binarysection ) { s/\r?\n?$//; # remove CR and/or LF at end of line if not in binary section } # check where magic Postscript header starts - skip leading binary stuff, e.g., HP PCL/PJL code if ($before_startps) { if ( /%!/ ) # This is usually the smallest magic sequence { # Note: Adobe Photoshop generated a binary heading, so ^ is not applicable # %! may be part of a binary sequence, but then control characters follow # so skip %! if non alphanumeric characters follow if ( ! /%!.*[^\w]{2,}/ ) { # some heading without two control characters found $before_startps= 0; if (! /%!PS-Adobe.*/i) # some strange programs use other magics { print STDERR "** Warning **: Weird heading line -- ",$_," -- "; } } } next CREATEOUTPUT; } else # we are hopefully in regular postscript code now { # count %%EOFs as we want to know when we got the last EOF if ( /^%%EOF\s*$/ ) { $seenEOF++; } # We should insert our own prologue including the newly calculated BoundingBox if (! $inserted_prolog) { print $outfhandle "%!PS-Adobe-$PSversion EPSF-$PSDSCversion\n"; # check if we need to rotate $transrotcmd=''; if ($rotatecmd) { if ($rotate eq $rotright) { $transrotcmd="-$cBBlly $cBBurx translate"; $boundingbox='%%BoundingBox: 0 0 ' . ($cBBury-$cBBlly) . ' ' . ($cBBurx-$cBBllx) . "\n"; if ($hiresboundingbox ne "") { $hiresboundingbox='%%HiResBoundingBox: 0 0 ' . ($hcBBury-$hcBBlly) . ' ' . ($hcBBurx-$hcBBllx) . "\n"; } } elsif ($rotate eq $rotleft) { $transrotcmd="$cBBury -$cBBllx translate"; $boundingbox='%%BoundingBox: 0 0 ' . ($cBBury-$cBBlly) . ' ' . ($cBBurx-$cBBllx) . "\n"; if ($hiresboundingbox ne "") { $hiresboundingbox= '%%HiResBoundingBox: 0 0 ' . ($hcBBury-$hcBBlly) . ' ' . ($hcBBurx-$hcBBllx) . "\n"; } } elsif ($rotate eq $rotupsidedown) { $transrotcmd="$cBBurx $cBBury translate"; $boundingbox='%%BoundingBox: 0 0 ' . ($cBBurx-$cBBllx) . ' ' . ($cBBury-$cBBlly) . "\n"; if ($hiresboundingbox ne "") { $hiresboundingbox='%%HiResBoundingBox: 0 0 ' . ($hcBBurx-$hcBBllx) . ' ' . ($hcBBury-$hcBBlly) . "\n"; } } } print $outfhandle $boundingbox; if (!defined($hiresboundingbox)) { $nohires=1; } if (defined($hiresboundingbox) && !defined($nohires)) { print $outfhandle $hiresboundingbox; } $inserted_prolog= 1; redo CREATEOUTPUT; } else # already inserted_prolog { if (! $prolog_passed) { #ignore the following lines in the prologue if ( /^%%(HiRes)?BoundingBox/ || /^%%Pages/ || /^%%BeginProlog/ || /^%%EndProlog/ || ($filterorientation && /^%%Orientation/) || ($removeDSC && /^%%.*: \(atend\)/) || ($removePreview && (/^%%BeginPreview/ ... /^%%EndPreview/)) ) { next CREATEOUTPUT; } else { if ( /^[^%].*/ || /^%%EndComments/ ) # line is not a comment { #output postscript code for proper EPS file if ($insertPScode) { print $outfhandle "%%EndComments\n", "% EPSF created by ps2eps $ver[2]\n", "%%BeginProlog\n"; } # Insert own postscript code for clipping if ($clip) { if (!defined($nohires)) { printf $outfhandle "newpath %f %f moveto %f %f lineto %f %f lineto %f %f lineto closepath clip\n",$hcBBllx,$hcBBlly,$hcBBurx,$hcBBlly,$hcBBurx,$hcBBury,$hcBBllx,$hcBBury; } else { printf $outfhandle "newpath %d %d moveto %d %d lineto %d %d lineto %d %d lineto closepath clip\n",$cBBllx,$cBBlly,$cBBurx,$cBBlly,$cBBurx,$cBBury,$cBBllx,$cBBury; } } #endif clip if ($rotate ne '') { print $outfhandle "$transrotcmd\n"; print $outfhandle "$rotate\n"; } if ($translation ne '') { print $outfhandle "$translation\n"; } #insert surrounding postscript code if ($insertPScode) { print $outfhandle "save\n", "countdictstack\n", "mark\n", "newpath\n", "/showpage {} def\n", "/setpagedevice {pop} def\n", "%%EndProlog\n", "%%Page 1 1\n"; } $prolog_passed= 1; if (/^%%EndComments/) { next CREATEOUTPUT; } } #endif line is not a comment } #end else } #endif (we are in the prologue section) else #we are in the main part of postscript file { #end of postscript file reached? #Usually the DSC %%EOF signifies the end if ( eof($tmpfhandle) || ($ignoreEOFDSC == 0 && /^%%EOF\s*$/ && $seenEOF == $totalEOFDSC) || ( $trailerseen && /^II\*\000.*/ ) ) { #do not forget to print last line if not terminated by LF if ( eof($tmpfhandle) && !/^$/ && !/^%%EOF\s*$/ ) # do not insert %%EOF twice { print $outfhandle $_,"\n"; } #add appropriate trailer if ($insertPScode) { print $outfhandle "%%Trailer\n", "cleartomark\n", "countdictstack\n", "exch sub { end } repeat\n", "restore\n", "%%EOF\n"; } last CREATEOUTPUT; } # stop output # Trailer comment seen? if ( /^%%Trailer\s*$/ ) { $trailerseen=1; } else { if (!/^\s*$/) #non empty lines follow { $trailerseen=0; } } # check for trigger if (defined($triggerstring) && /^$triggerstring$/) { $trigger= 1; }; # remove complete lines if one of the expression matches if ( !$binarysection # only when not in binary section && ( ($removePreview && (/^%%BeginPreview/ ... /^%%EndPreview/)) || # no preview (defined($rangefilter_begin) && (/$rangefilter_begin/ ... /$rangefilter_end/) && (!(/$exclude_rangefilter_begin/ ... /$exclude_rangefilter_end/)) ) || (defined($triggered_rangefilter_begin) && defined($triggered_rangefilter_end) && $trigger && (/$triggered_rangefilter_begin/ ... /$triggered_rangefilter_end/) ) || /$linefilter/ # lines by linefilter || ($removeDSC && (/^%( |!)(\w )+/ || /^%%([A-Za-z]+\s)/)) # any type of structured comment || ($removeADO && (/^statusdict begin.*ProductName.*print product print.*flush end\r?\n?$/ || /^\(%%\[\s*(Page:.*|LastPage)\s*\]%%\)\s*=\s*\w*\s*\r?\n?/ )) || /^$/ # empty lines ) ) { next CREATEOUTPUT; } # replacement if ( defined($fixsearchpat) ) { #if (/$fixsearchpat/) { print STDERR "**filter** before:",$_,"\n"; } #if (s/$fixsearchpat/$fixreplacepat/) { print STDERR "**filter** after:",$_,"\n";} s/$fixsearchpat/$fixreplacepat/; } # sanity check for potential dangerous commands if ( /(^|\s)(clear|erasepage|initmatrix|initclip|initgraphics|startjob|cleardictstack|setmatrix|setpagedevice|copypage|grestoreall|exitserver|quit)(\s|$)/ ) { $notsane= 1; #print STDERR "Warning: dangerous command in line: ",$_,"\n"; } } # end else (this is main part) # Output the postscript line to result file print $outfhandle $_; if (!$binarysection) { print $outfhandle "\n"; # terminate line with LF } } # end else prolog_passed } # end else inserted_prolog } # end while CREATEOUTPUT close($tmpfhandle); if ($tmpfname ne $infname) { unlink "$tmpfname"; } #remove temporary file close ($outfhandle); # print warning if magic sequence not found if ( $before_startps ) { print STDERR "\n ** Error!! **: could not identify begin of postscript code in file $infname, please check header line!\n First line should start with %!. No output generated.\n"; } if (!$quiet) { print STDERR "ready.\n"; } if ($warnings and $notsane and !$quiet) { print STDERR "** Warning **: EPS-output for $infname is not sane, at least one\n", "of the following commands was still present:\n", "clear erasepage initmatrix initclip initgraphics startjob\n", "cleardictstack setmatrix setpagedevice copypage grestoreall\n", "exitserver quit\n"; } } #end while PROCESSFILE # ---- end of perl-script -------