ho-tex/pdfcrop

pdfcrop --xetex does not give correct output

jszhao opened this issue · 3 comments

Here is the code to reproduce the issue.

  1. generate a pdf page (named as abc.pdf) from the following code:
\documentclass{standalone}
\begin{document}
\Huge A sample text.
\end{document} 
  1. use pdfcrop to remove its margins (actually it does not have white margins)
pdfcrop --xetex abc.pdf

you will see the output have two pages, and both are empty.

If replacing standalone with article, the output also have two pages, but the first page is correct, and the second page is also empty.

pdfcrop --pdftex abc.pdf
pdfcrop --luatex abc.pdf

both could give correct results.

I have run that on my Windows 10 system with TeXLive 2020 full installed and updated. The pdfcrop version is PDFCROP 1.40, 2020/06/06.

Best,
Jinsong

Well the second page is because of the special for the pdf version. It can probably be moved into the box.

The text seems to disappear with standalone as the paper size is too small now: with the 1in displacement inserted by the code nothing is in the box, and then it gets dropped. This is perhaps a xetex bug but imho nothing pdfcrop can solve.

With the example file:

\documentclass{standalone}
\begin{document}
\Huge A sample text.
\end{document}

and running:

$ xelatex test.tex
$ pdfcrop --xetexcmd xelatex test.pdf

I get the correct output file:

test-crop-1

One interesting thing I have noticed here is the following. When running pdfcrop --xetex test.pdf the line executed by pdfcrop is as follows:

* XeTeX call: xetex -no-shell-escape -interaction=nonstopmode tmp-pdfcrop-9248

i.e., it uses plain XeTeX, which has an effect on the fonts of the file:

$ pdffonts  test.pdf 
name                                 type              encoding         emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
SYMVRB+LMRoman17-Regular-Identity-H  CID Type 0C       Identity-H       yes yes yes      4  0
$ pdffonts  test.pdf 
name                                 type              encoding         emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
SYMVRB+LMRoman17-Regular-Identity-H  CID Type 0C       Identity-H       yes yes yes      4  0

$ pdfcrop --xetex test.pdf
PDFCROP 1.40, 2020/06/06 - Copyright (c) 2002-2020 by Heiko Oberdiek, Oberdiek Package Support Group.
==> 1 page written on `test-crop.pdf'.

$ pdffonts test-crop.pdf 
name                                 type              encoding         emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
SYMVRB+LMRoman17-Regular-Identity-H  CID Type 0C       Identity-H       yes yes yes      4  0
DLSGEY+CMR10                         Type 1C           Builtin          yes yes yes     16  0

Add the font CMR10 and that affects the generated pdf-crop file, but when executing the line:

$ pdffonts test.pdf 
name                                 type              encoding         emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
SYMVRB+LMRoman17-Regular-Identity-H  CID Type 0C       Identity-H       yes yes yes      4  0

$ pdfcrop --xetexcmd xelatex test.pdf 
PDFCROP 1.40, 2020/06/06 - Copyright (c) 2002-2020 by Heiko Oberdiek, Oberdiek Package Support Group.
==> 1 page written on `test-crop.pdf'.

$ pdffonts test-crop.pdf 
name                                 type              encoding         emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
SYMVRB+LMRoman17-Regular-Identity-H  CID Type 0C       Identity-H       yes yes yes      8  0

everything works OK.

I hope this is helpful.
Saludos

fixed in v1.41