mgieseki / dvisvgm

A fast DVI, EPS, and PDF to SVG converter
https://dvisvgm.de
GNU General Public License v3.0
306 stars 33 forks source link

Page size issue #182

Closed ali10129 closed 2 years ago

ali10129 commented 2 years ago

when it tried to convert my standalone pdf from tikz to SVG

the page size stays the same as the next page gets smaller.

here is an example: while my last page and first page are the same size

\documentclass[tikz]{standalone}

\begin{document}

    \begin{tikzpicture}
    \draw (0,0) -- (1,1); % ...
    \draw (1,0) -- (0,1); % ...
    \draw (5,0) -- (0,1); % ...
    \node at (5,1) {Lorem ipsum at domine standalonus};
\end{tikzpicture}

    \begin{tikzpicture}
    \draw (0,0) -- (10,10); % ...
    \draw (1,0) -- (0,1); % ...
    \draw (5,0) -- (0,1); % ...
    \node at (5,1) {Lorem ipsum at domine standalonus};
\end{tikzpicture}

    \begin{tikzpicture}
    \draw (0,0) -- (1,1); % ...
    \draw (1,0) -- (0,1); % ...
    \draw (5,0) -- (0,1); % ...
    \node at (5,1) {Lorem ipsum at domine standalonus};
\end{tikzpicture}

\end{document}

and these are the output page sizes:

dvisvgm --bbox=dvi --page=1- --pdf "document".pdf

processing PDF file
graphic size: 225.542625pt x 36.426087pt (79.269167mm x 12.802306mm) output written to document-1.svg processing PDF file
graphic size: 284.924475pt x 284.924475pt (100.1395mm x 100.1395mm) output written to document-2.svg processing PDF file
graphic size: 284.924475pt x 284.924475pt (100.1395mm x 100.1395mm) output written to document-3.svg 3 of 3 pages converted in
1.217 seconds
Process exited normally

I tired different --bbox options and get the same result

mgieseki commented 2 years ago

Thanks for reporting this bug. It's strange that it hasn't been noticed before. I've fixed it locally and will push the changes shortly.

Option --bbox is only recognized when converting DVI files at the moment. SVG files created from PDF or PS files always get the bounding boxes defined in the PDF/PS files.