What is the difference/are there restrictions when
1. pdfcrop.exe is run from within TexnicCenter via pdflatex output profile with -enable-write18
VS
2. pdfcrop.exe is run from Windows command line
VS
3. tex file in 1. is run from Windows command line via pdflatex -enable-write18
HISTORY:
I tried to use auto-pst-pdf to include pstricks in pdflatex but could not make it work - Latex => PS => PDF is too damn slow! During error search I realised that pdfcrop fails during auto-pst-pdf execution. Thus the following minimal example (without use of auto-pst-pdf, instead focus on execution of pdfcrop):
TESTS:
1. Crop from within TexnicCenter using the following example code (output profile pdflatex -enable-write18):
\documentclass{article} \usepackage{graphicx} \usepackage{pstool} \usepackage{pdfpages} \usepackage{shellesc} %alternative to write18 % name of pic in main path \newcommand{\picname}{fig_appMinkowskiBasis3d} \pagestyle{empty} \begin{document} % check shell escape status Shell escape \ifnum\ShellEscapeStatus=0 disabled! \fi \ifnum\ShellEscapeStatus=1 enabled! \fi \ifnum\ShellEscapeStatus=2 restricted! \fi \ifnum\ShellEscapeStatus=0 unknown! \fi % pdfcrop via write18 -> exe \immediate\write18{pdfcrop.exe --verbose "\picname"} % alternative: via write18 -> perl call % \immediate\write18{perl "C:/Program Files/MiKTeX/scripts/pdfcrop/pdfcrop.pl" --verbose "\picname"} % alternative: via ShellEscape -> exe % \ShellEscape{pdfcrop.exe --verbose "\picname"} \begin{figure} \centering \fbox{ \includegraphics[% page=1,% width=.45\textwidth% ]{\picname} } ` \caption{uncropped} \end{figure} \begin{figure} \centering \fbox{ \includegraphics[% page=1,% width=.45\textwidth% ]{\picname-crop} } \caption{cropped} \end{figure} \end{document}
2. Crop with pdfcrop.exe on Windows command line:
> pdfcrop.exe fig_appMinkowskiBasis3d
3. Compile tex file in 1. directly on Windows command line:
> pdflatex -enable-write18 PicTest.tex
RESULTS:
2. & 3. work just fine (see result pdf)
1. does not work (somewhat similar to the auto-pst-pdf situation), console log:
This is pdfTeX, Version 3.141592653-2.6-1.40.24 (MiKTeX 22.3) (preloaded format=pdflatex 2022.6.22) 23 JUN 2022 15:49 entering extended mode \write18 enabled. %&-line parsing enabled. **./PicTest.tex (PicTest.tex LaTeX2e <2022-06-01> pre-release-0 (develop 2022-6-22 branch) L3 programming layer <2022-06-02> (C:\Program Files\MiKTeX\tex/latex/base\article.cls Document Class: article 2021/10/04 v1.4n Standard LaTeX document class (C:\Program Files\MiKTeX\tex/latex/base\size10.clo File: size10.clo 2021/10/04 v1.4n Standard LaTeX file (size option) ) \c@part=\count185 \c@section=\count186 \c@subsection=\count187 \c@subsubsection=\count188 \c@paragraph=\count189 \c@subparagraph=\count190 \c@figure=\count191 \c@table=\count192 \abovecaptionskip=\skip47 \belowcaptionskip=\skip48 \bibindent=\dimen138 ) (C:\Program Files\MiKTeX\tex/latex/graphics\graphicx.sty Package: graphicx 2021/09/16 v1.2d Enhanced LaTeX Graphics (DPC,SPQR) (C:\Program Files\MiKTeX\tex/latex/graphics\keyval.sty Package: keyval 2022/05/29 v1.15 key=value parser (DPC) \KV@toks@=\toks16 ) (C:\Program Files\MiKTeX\tex/latex/graphics\graphics.sty Package: graphics 2022/03/10 v1.4e Standard LaTeX Graphics (DPC,SPQR) (C:\Program Files\MiKTeX\tex/latex/graphics\trig.sty Package: trig 2021/08/11 v1.11 sin cos tan (DPC) ) (C:\Program Files\MiKTeX\tex/latex/graphics-cfg\graphics.cfg File: graphics.cfg 2016/06/04 v1.11 sample graphics configuration ) Package graphics Info: Driver file: pdftex.def on input line 107. (C:\Program Files\MiKTeX\tex/latex/graphics-def\pdftex.def File: pdftex.def 2020/10/05 v1.2a Graphics/color driver for pdftex )) \Gin@req@height=\dimen139 \Gin@req@width=\dimen140 ) (C:\Program Files\MiKTeX\tex/latex/pstool\pstool.sty Package: pstool 2018/01/20 v1.5e Wrapper for processing PostScript/psfrag figur es (C:\Program Files\MiKTeX\tex/generic/catchfile\catchfile.sty Package: catchfile 2019/12/09 v1.8 Catch the contents of a file (HO) (C:\Program Files\MiKTeX\tex/generic/infwarerr\infwarerr.sty Package: infwarerr 2019/12/03 v1.5 Providing info/warning/error messages (HO) ) (C:\Program Files\MiKTeX\tex/generic/ltxcmds\ltxcmds.sty Package: ltxcmds 2020-05-10 v1.25 LaTeX kernel commands for general use (HO) ) (C:\Program Files\MiKTeX\tex/generic/etexcmds\etexcmds.sty Package: etexcmds 2019/12/15 v1.7 Avoid name clashes with e-TeX commands (HO) (C:\Program Files\MiKTeX\tex/generic/iftex\iftex.sty Package: iftex 2022/02/03 v1.0f TeX engine tests ))) (C:\Program Files\MiKTeX\tex/latex/graphics\color.sty Package: color 2022/01/06 v1.3d Standard LaTeX Color (DPC) (C:\Program Files\MiKTeX\tex/latex/graphics-cfg\color.cfg File: color.cfg 2016/01/02 v1.6 sample color configuration ) Package color Info: Driver file: pdftex.def on input line 149. (C:\Program Files\MiKTeX\tex/latex-dev/graphics\mathcolor.ltx)) (C:\Program Files\MiKTeX\tex/generic/iftex\ifpdf.sty Package: ifpdf 2019/10/25 v3.4 ifpdf legacy package. Use iftex instead. ) (C:\Program Files\MiKTeX\tex/latex/ifplatform\ifplatform.sty Package: ifplatform 2017/10/13 v0.4a Testing for the operating system (C:\Program Files\MiKTeX\tex/latex/tools\shellesc.sty Package: shellesc 2019/11/08 v1.0c unified shell escape interface for LaTeX Package shellesc Info: Unrestricted shell escape enabled on input line 75. ) (C:\Program Files\MiKTeX\tex/generic/pdftexcmds\pdftexcmds.sty Package: pdftexcmds 2020-06-27 v0.33 Utility functions of pdfTeX for LuaTeX (HO ) Package pdftexcmds Info: \pdf@primitive is available. Package pdftexcmds Info: \pdf@ifprimitive is available. Package pdftexcmds Info: \pdfdraftmode found. ) (C:\Program Files\MiKTeX\tex/generic/iftex\ifluatex.sty Package: ifluatex 2019/10/25 v1.5 ifluatex legacy package. Use iftex instead. )) (C:\Program Files\MiKTeX\tex/latex/filemod\filemod.sty Package: filemod 2011/09/19 v1.2 Get and compare file modification times (C:\Program Files\MiKTeX\tex/latex/filemod\filemod-expmin.sty Package: filemod-expmin 2011/09/19 v1.2 Get and compare file modification times (expandable; minimal) )) (C:\Program Files\MiKTeX\tex/latex/psfrag\psfrag.sty Package: psfrag 1998/04/11 v3.04 PSfrag (MCG) \pfg@pcount=\count193 \pfg@scount=\count194 \pfg@temp=\write3 ) (C:\Program Files\MiKTeX\tex/latex/bigfoot\suffix.sty Package: suffix 2006/07/15 1.5a Variant command support ) (C:\Program Files\MiKTeX\tex/latex/trimspaces\trimspaces.sty Package: trimspaces 2009/09/17 v1.1 Trim spaces around a token list ) (C:\Program Files\MiKTeX\tex/latex/xkeyval\xkeyval.sty Package: xkeyval 2020/11/20 v2.8 package option processing (HA) (C:\Program Files\MiKTeX\tex/generic/xkeyval\xkeyval.tex (C:\Program Files\MiKTeX\tex/generic/xkeyval\xkvutils.tex \XKV@toks=\toks17 \XKV@tempa@toks=\toks18 ) \XKV@depth=\count195 File: xkeyval.tex 2014/12/03 v2.7a key=value parser (HA) )) (C:\Program Files\MiKTeX\tex/latex/l3kernel\expl3.sty Package: expl3 2022-06-02 L3 programming layer (loader) (C:\Program Files\MiKTeX\tex/latex/l3backend\l3backend-pdftex.def File: l3backend-pdftex.def 2022-04-20 L3 backend support: PDF output (pdfTeX) \l__color_backend_stack_int=\count196 \l__pdf_internal_box=\box51 )) \pstool@out=\write4 \pstool@mainfile@ior=\read2 \pstool@auxfile@ior=\read3 runsystem(cd ""& copy "PicTest.aux" "PicTest.oldaux" )...executed. ) (C:\Program Files\MiKTeX\tex/latex/pdfpages\pdfpages.sty Package: pdfpages 2022/05/22 v0.5v Insert pages of external PDF documents (AM) (C:\Program Files\MiKTeX\tex/latex/base\ifthen.sty Package: ifthen 2022/04/13 v1.1d Standard LaTeX ifthen package (DPC) ) (C:\Program Files\MiKTeX\tex/latex/tools\calc.sty Package: calc 2017/05/25 v4.3 Infix arithmetic (KKT,FJ) \calc@Acount=\count197 \calc@Bcount=\count198 \calc@Adimen=\dimen141 \calc@Bdimen=\dimen142 \calc@Askip=\skip49 \calc@Bskip=\skip50 LaTeX Info: Redefining \setlength on input line 80. LaTeX Info: Redefining \addtolength on input line 81. \calc@Ccount=\count199 \calc@Cskip=\skip51 ) (C:\Program Files\MiKTeX\tex/latex/eso-pic\eso-pic.sty Package: eso-pic 2020/10/14 v3.0a eso-pic (RN) \ESO@tempdima=\dimen143 \ESO@tempdimb=\dimen144 ) \AM@pagewidth=\dimen145 \AM@pageheight=\dimen146 \AM@fboxrule=\dimen147 (C:\Program Files\MiKTeX\tex/latex/pdfpages\pppdftex.def File: pppdftex.def 2022/05/22 v0.5v Pdfpages driver for pdfTeX (AM) ) \pdfpages@includegraphics@status=\count266 \AM@pagebox=\box52 \AM@global@opts=\toks19 \AM@pagecnt=\count267 \AM@toc@title=\toks20 \c@AM@survey=\count268 \AM@templatesizebox=\box53 ) (PicTest.aux) \openout1 = `PicTest.aux'. LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 12. LaTeX Font Info: ... okay on input line 12. LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 12. LaTeX Font Info: ... okay on input line 12. LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 12. LaTeX Font Info: ... okay on input line 12. LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 12. LaTeX Font Info: ... okay on input line 12. LaTeX Font Info: Checking defaults for TS1/cmr/m/n on input line 12. LaTeX Font Info: ... okay on input line 12. LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 12. LaTeX Font Info: ... okay on input line 12. LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 12. LaTeX Font Info: ... okay on input line 12. (C:\Program Files\MiKTeX\tex/context/base/mkii\supp-pdf.mkii [Loading MPS to PDF converter (version 2006.09.02).] \scratchcounter=\count269 \scratchdimen=\dimen148 \scratchbox=\box54 \nofMPsegments=\count270 \nofMParguments=\count271 \everyMPshowfont=\toks21 \MPscratchCnt=\count272 \MPscratchDim=\dimen149 \MPnumerator=\count273 \makeMPintoPDFobject=\count274 \everyMPtoPDFconversion=\toks22 ) (C:\Program Files\MiKTeX\tex/latex/epstopdf-pkg\epstopdf-base.sty Package: epstopdf-base 2020-01-24 v2.11 Base part for package epstopdf Package epstopdf-base Info: Redefining graphics rule for `.eps' on input line 4 85. (C:\Program Files\MiKTeX\tex/latex/00miktex\epstopdf-sys.cfg File: epstopdf-sys.cfg 2021/03/18 v2.0 Configuration of epstopdf for MiKTeX )) (C:\Program Files\MiKTeX\tex/latex/pdflscape\pdflscape.sty Package: pdflscape 2019/12/05 v0.12 Display of landscape pages in PDF (HO) (C:\Program Files\MiKTeX\tex/latex/graphics\lscape.sty Package: lscape 2020/05/28 v3.02 Landscape Pages (DPC) ) Package pdflscape Info: Auto-detected driver: pdftex on input line 81. ) runsystem(pdfcrop.exe --verbose "fig_appMinkowskiBasis3d")...executed. pdfTeX warning: pdflatex.exe (file ./fig_appMinkowskiBasis3d.pdf): PDF inclusio n: found PDF version <1.7>, but at most version <1.5> allowed <fig_appMinkowskiBasis3d.pdf, id=1, page=1, 233.87375pt x 121.45375pt> File: fig_appMinkowskiBasis3d.pdf Graphic file (type pdf) <use fig_appMinkowskiBasis3d.pdf, page 1> Package pdftex.def Info: fig_appMinkowskiBasis3d.pdf , page1 used on input line 42. (pdftex.def) Requested size: 155.24895pt x 80.62671pt. ! LaTeX Error: File `fig_appMinkowskiBasis3d-crop' not found. See the LaTeX manual or LaTeX Companion for explanation. Type H <return> for immediate help. ... l.52 } ?
Something must go on (RESTRICTION?, ENVIRONMENT VARIABLES?, ...) when running pdfcrop.exe from within TexnicCenter via \write18 in contrast to Windows Command Line, but I cannot find any forum entries or man pages on that.
Any ideas would be greatly appreciated!
SETUP (all current as of today):
- Windows 10
- MikTex basic-miktex-22.3-x64.exe
- TexnicCenter 2.02stable
- attached files:
-> image to be cropped: fig_appMinkowskiBasis3d.pdf
-> minimal tex file for 1. and 3.: PicTest.tex
-> result from 3.: PicTest.pdf
Thx in advance, Jens