I am trying to read the size of a PDF file to adjust the size of the next page to the size of the figure. I have had some success, but the figure is still not well adjusted. I could adjust this figure, but I want to automate the adjustment, as I have 150 figures to insert in the file. I also need to add an extra height on the page, to place the caption of the figure. Any suggestion?

    \setbox0 = \hbox{\includegraphics{01.pdf}}
    width = \the\wd0, height = \the\ht0

\eject \pdfpagewidth=\the\wd0 \pdfpageheight=\the\ht0

    \caption{<name picture>}

enter image description here


Here is an attempt using \igrgraph command from incgraph pacakge.

\igrgraph{<text>} automatically typesets <text> in a separate page with height and width the same of <text>, so you don't need to manually change page size.


text on first page
    \captionof{figure}{figure on second page}
text on third page

This generates a three-page pdf, of which the second page is enter image description here



with the help of the answer below:


I write:

    } %-----------------------------------------------------------------------
\measureimage[1]{01.pdf} % measures the 1nd page of the file.
\eject \pdfpagewidth=\measuredwidth \pdfpageheight=\measuredheight

\caption{caption picture}

TO DO: I still have to find out a way to insert a space below the figure to place the caption.

Any suggestions?

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.