Debian Codegraph @

texmf-dist/doc/support/pdfcrop/README.md

raw symbols SCIP
1 # pdfcrop
2
3 Version: 2023/04/15 v1.42
4
5
6 ## TABLE OF CONTENTS
7
8 1. Description
9 2. Copyright, Disclaimer, License
10 3. Files
11 4. Requirements
12 5. Installation
13 6. User Interface
14 7. Restricted Mode
15 8. Author
16 9. Acknowledgement
17 9. Questions, Suggested Improvements
18 9. Known Problems
19 9. History
20 9. ToDo
21
22 ## 1\. DESCRIPTION
23
24 PDFCROP takes a PDF file as input, calculates the BoundingBox
25 for each page by the help of ghostscript and generates a output
26 PDF file with removed margins.
27
28 ## 2\. COPYRIGHT, DISCLAIMER, LICENSE
29
30 Copyright (C) 2002, 2004, 2005, 2008-2012 Heiko Oberdiek.
31 2020-2023 Oberdiek Package Support Group
32
33 LaTeX Project Public License, version 1.3c or later.
34
35 ## 3\. FILES
36
37 The project `pdfcrop` consists of two files:
38
39 `pdfcrop.pl`: This perl script is the main program. The extension
40 `.pl` may be omitted.\
41 `README.md`: Documentation, the file you are reading.
42
43 Following temporary files are produced if `pdfcrop` is invoked:
44
45 `tmp-pdfcrop-*.tex`: input file for pdfTeX, luatex or xetex\
46 `tmp-pdfcrop-*.log`: log file of pdfTeX, luatex or xetex run\
47 `tmp-pdfcrop-*.pdf`: result after pdfTeX, luatex or xetex run
48
49 The temporary files are deleted after the run unless the `--debug` option is
50 used.
51
52 ## 4\. REQUIREMENTS
53
54 * Perl5 (version 5 of the perl interpreter)
55 * Ghostscript (>= 8.0 if PDF file contains rotated pages)
56 * pdfTeX, version >= 1.0 (because of page selecting and \pdfximage syntax)
57 or XeTeX or LuaTeX.
58
59 ## 5\. INSTALLATION
60
61 Normally `pdfcrop` will be installed by the TeX system.
62
63 If a manual installation is needed
64
65 ### 1\. Perl script `pdfcrop.pl`:
66
67 TDS 1.1 location (TDS means "texmf" tree, see CTAN:tds/tds.pdf):
68 * TDS:scripts/pdfcrop/pdfcrop.pl
69 * and a directory that is part of PATH contains a wrapper script
70 or link with name "pdfcrop".
71
72 Unix
73 * It is allowed to rename `pdfcrop.pl` to `pdfcrop`:
74 mv pdfcrop.pl pdfcrop
75 * Ensure that the execute permission is set:
76 chmod +x pdfcrop
77 * Move the file to a directory where the shell can find it
78 (environment variable PATH, e.g. /usr/local/bin/).
79
80 Dos/Windows
81 * See requirements. I do not expect that the perl script
82 runs under DOS.
83
84 ### 2\. Restricted program version `rpdfcrop`
85
86 Generate links or install `pdfcrop.pl` again under the
87 name `rpdfcrop`.
88
89 Prefer `rpdfcrop` if you want to add pdfcrop to the
90 programs that may be executed in TeX's restricted
91 shell escape mode. (This feature is added in TeX Live 2009.)
92 For TeX Live (since 2009) see entry for `shell_escape_commands`
93 in the configuration file `texmf.cnf`.
94
95 ### 3\. Documentation `README.md`:
96
97 Copy it to an appropriate place, for example
98 `/usr/local/share/doc/pdfcrop/README.md`.
99 It is allowed to rename it to `pdfcrop.txt` or `pdfcrop.md`.
100
101 TDS location:\
102 somewhere below texmf/doc/... (?)
103
104 Examples:\
105 `TDS:doc/support/pdfcrop/README.md`\
106 `TDS:doc/scripts/pdfcrop/README.md`\
107 `TDS:doc/scripts/pdfcrop.txt`
108
109 TeXLive 2020 put it in\
110 `TDS:doc/support/pdfcrop/README.md`
111
112 ## 6\. USER INTERFACE
113
114 * ToDo: User manual
115 * Online help:
116 `pdfcrop --help`
117 * Ghostscript's calculation of the bounding box is faster,
118 if `--resolution 72` is used instead of ghostscript's implicite
119 default setting of 4000 DPI (hint from Ionut Georgescu).
120 Of course the calculation with higher resolution settings are
121 more accurate.
122
123 ## 7\. RESTRICTED MODE
124
125 Restricted mode is enabled if:
126
127 * option `--restricted` is used,
128 * the program is called under the name `rpdfcrop`
129 * or the called program name contains `restricted`.
130
131 This mode sets restrictions for the following options:
132
133 * `--pdftexcmd`: if used, the value must be empty or `pdftex`.
134 * `--xetexcmd`: if used, the value must be empty or `xetex`.
135 * `--luatexcmd`: if used, the value must be empty or `luatex`.
136 * `--gscmd`: if used, the value must
137 * be empty or
138 * be one of the standard names (gs, gswin32c, gswin64c, mgs, gs386, gsos2) or
139 * consists of `gs`, followed by a version number and an
140 optional `c` (Ghostscript's convention for `console version`).
141
142 ## 8\. AUTHORS
143
144 Heiko Oberdiek\
145 Email: heiko.oberdiek at googlemail.com\
146 Oberdiek Package Support Group\
147 [https://github.com/ho-tex/pdfcrop]
148
149 ## 9\. ACKNOWLEDGEMENT
150
151 Anthony Williams\
152 Scott Pakin <pakin at uiuc.edu>\
153 Ionut Georgescu\
154 Yves Jäger\
155 R (Chandra) Chandrasekhar\
156 Christian Stapfer\
157 David Menestrina\
158 Karl Berry
159
160 ## 10. QUESTIONS, SUGGESTED IMPROVEMENTS
161
162 If you have questions, problems with `pdfcrop`, error reports,
163 if you have improvements or want to have additional features,
164 please send them to the author or add an issue to
165 https://github.com/ho-tex/pdfcrop
166
167 My environment for developing and testing:
168 * linux, SuSE 9.0
169 * perl v5.8.1
170 * pdfTeX 3.141592-1.40.x
171 * Ghostscript 8.x
172
173 ## 11. KNOWN PROBLEMS
174
175 * pdfcrop relies on Ghostscript for the calculation of the
176 Bounding Box. If Ghostscript returns wrong values or
177 cannot process the pdf file, it sometimes helps to try
178 another version of Ghostscript.
179 * Older XeTeX (and pdfTeX < 1.10a) does not allow the setting of the
180 PDF version in a direct way. In this cases pdfcrop tries to fix the PDF version
181 afterwards in the PDF header and XeTeX warnings as the following can be safely ignored.
182
183 ** WARNING ** Version of PDF file (1.6) is newer
184 than version limit specification.
185
186
187
188 ## 12. HISTORY
189
190 |Version | Notes |
191 |----------------|-------|
192 |2002/10/30 v1.0:| First release|
193 |2002/10/30 v1.1:| Option `--hires` added.|
194 |2002/11/04 v1.2:| "nul" instead of "/dev/null" for windows.|
195 |2002/11/23 v1.3:| Use of File::Spec module's "devnull" call.|
196 |2002/11/29 v1.4:| Option `--papersize` added.|
197 |2004/06/24 v1.5:| Clear map file entries so that pdfTeX does not touch the fonts.|
198 |2004/06/26 v1.6:| Use mgs.exe instead of gswin32c.exe for MIKTEX.|
199 |2005/03/11 v1.7:| Support of spaces in file names |
200 |-- | `(open("-`&#124;`")` is used for ghostscript call).|
201 |2008/01/09 v1.8:| Fix for moving the temporary file to the output file across file system boundaries.|
202 |2008/04/05 v1.9:| Options `--resolution` and `--bbox` added. |
203 |2008/07/16 v1.10:| Support for XeTeX added with new options `--pdftex`, `--xetex`, `--xetexcmds`.|
204 |2008/07/22 v1.11:| Workaround for `(open("-`&#124;`")`.|
205 |2008/07/23 v1.12:| Workarounds for the workaround (error detection, ...).|
206 |2008/07/24 v1.13:| `(open("-`&#124;`")`/ workaround removed.|
207 |-- | Input files with unsafe file names are linked/copied to temporary file with safe file name.|
208 |2008/09/12 v1.14:| Error detection for invalid Bounding Boxes.|
209 |2009/07/14 v1.15:| Fix for negative coordinates in Bounding Boxes (David Menestrina).
210 |2009/07/17 v1.16:| Security fixes: |
211 |-- | \* `-dSAFER` added for Ghostscript, |
212 |-- | \* `-no-shell-escape` added for pdfTeX/XeTeX.|
213 |2009/07/17 v1.17:| Security fixes:
214 |-- | \* Backticks and whitespace are forbidden for options `--gs`, `--pdftexcmd`, `--xetexcmd`.|
215 |-- | \* Validation of options `--papersize` and `--resolution`.|
216 |2009/07/18 v1.18:| \* Restricted mode added. |
217 |-- | \* Option `--version` added.|
218 |2009/09/24 v1.19:| \* Ghostscript detection rewritten. |
219 |-- | \* Cygwin: `gs` is preferred to `gswin32c`.|
220 |2009/10/06 v1.20:| \* File name sanitizing in .tex file.|
221 |2009/12/21 v1.21:| \* Option `--ini` added for iniTeX mode. |
222 |-- | \* Option `--luatex` and `--luatexcmd` added for LuaTeX.|
223 |2009/12/29 v1.22:| \* Syntax description for option `--bbox` fixed (Lukas Prochazka).|
224 |2010/01/09 v1.23:| \* Options `--bbox`-odd and --bbox-even added.|
225 |2010/08/16 v1.24:| \* Workaround added for buggy ghostscript ports that print the BoundingBox data twice.|
226 |2010/08/26 v1.25:| \* Fix for the case that the PDF file contains an entry /CropBox different to /MediaBox.|
227 |-- | \* \pageinclude implemented for XeTeX. |
228 |-- | \* XeTeX: `--clip` does not die, but this option is ignored, because XeTeX always clip.|
229 |2010/08/26 v1.26:| \* XeTeX's \XeTeXpdffile expects keyword `media`, not `mediabox`.|
230 |-- | \* New option `--pdfversion`.|
231 |-- | Default is `auto` that means the PDF version is inherited from the input file. Before pdfcrop has used the TeX engine's default.|
232 |-- | \* Option `--luatex` fixed (extra empty page at end).|
233 |2010/09/03 v1.27:| \* Workaround of v1.24 fixed.|
234 |2010/09/06 v1.28:| \* The Windows registry is searched if Ghostscript is not found via PATH.
235 |-- | \* Windows only: support of spaces in command names in unrestricted mode.|
236 |2010/09/06 v1.29:| \* Find the latest Ghostscript version in registry.|
237 |2010/09/15 v1.30:| \* Warning of pdfTeX because of \pdfobjcompresslevel avoided when reducing \pdfminorversion.|
238 |-- | \* Fix for TeX syntax characters in input file names.|
239 |2010/09/17 v1.31:| \* Passing the input file name via hex string to TeX.|
240 |-- | \* Again input file names restricted for Ghostscript command line, switch then to symbol link/copy method.|
241 |2011/08/10 v1.32:| \* Detection for gswin64c.exe added.|
242 |2012/02/01 v1.33:| \* Input file can be `-` (standard input).|
243 |2012/04/18 v1.34:| \* Format of option `--version` changed from naked version number to a line with program name, date and version.|
244 |2012/10/15 v1.35:| \* Additional debug infos added for Perl version.|
245 |2012/10/16 v1.36:| \* More error codes added.|
246 |2012/10/16 v1.37:| \* Extended error messages if available.|
247 |-- | \* Fix for broken v1.36.|
248 |2012/11/02 v1.38:| \* Fix for unsufficient cleanup, if function `cleanup` is prematurely called in `eval` for `symlink` checking.|
249 |2020/05/24 v1.39:| \* adapted to pdfversion 2.0,|
250 |-- | \* corrected luatex support|
251 |-- | \* corrected a problem with xetex.|
252 |2020/06/06 v1.40:| \* improved ghostscript detection on windows when a bash is used|
253 |-- | \* added direct pdfversion support to xetex.|
254 |2023/04/13 v1.41:| \* allow gswin64c in restricted mode, fix typos in messages issues 14, 17|
255 |-- | \* add -q option, issue 7 |
256 |-- | \* don't print whole help msg for unknown options, issue 7.|
257 |-- | \* do not create two pages with xetex, issue 3|
258 |2023/04/15 v1.42:| \* update help text issue 18|
259
260 ## 13. TODO
261
262 * Description of user interface.
263 * Documentation in other formats, eg. man or info pages.
264 * Improved error checking.
265 * Units support for option `--margins`.