1

I have a PDF document that was improperly scanned, so that the content (images) only occupies the top half of the portrait page.

I'd like to crop all the pages, to remove the empty bottom half, and produce a new PDF, that would thus be in landscape format.

How do I do that using pdflatex?

I tried, one at a time:

\usepackage[paperwidth=\8.27in,paperheight=\5.85in]{geometry}
\includepdf[pages=1-,trim=1in 10in 1in 1in,clip]{myfile.pdf}
\includepdf[pages=1-,trim=1in 10in 1in 1in,clip,landscape]{myfile.pdf}
\includepdf[pages=1-,viewport=0 0 5in 5in]{myfile.pdf}

among other things, but nothing works. The best I got so far is that the content is cropped, but the page is not resized.

9
  • What length is \8.27in ? (with the backslash)
    – Fran
    Commented Oct 21, 2023 at 12:15
  • @Fran I have no clue, just copied it from somewhere.
    – Rodrigo
    Commented Oct 21, 2023 at 12:30
  • But obviously wrong. Instead of type "a bit more than eight and a quarter inches" (i.e. 8.27in) you set the command \8 with a argument of 0.27 inches to make absolutely nothing, because \8 is an undefined control sequence (i.e., a non existing command) that produce a fatal error.
    – Fran
    Commented Oct 21, 2023 at 14:35
  • You can use Gwenview ( a linux graphic program ) to crop your document and do a lot more with your document.
    – user25406
    Commented Oct 21, 2023 at 15:04
  • @Fran ok, thank you. Actually I had tried with and without the ``, but simply got different errors.
    – Rodrigo
    Commented Oct 21, 2023 at 20:14

1 Answer 1

2

you can use the fitpaper option. If you have different trim values you should use a \includepdf command for each.

\documentclass{article}
\usepackage{pdfpages}
\begin{document}
\includepdf[fitpaper,pages=-,trim=2cm 2cm 2cm 1cm]{example-image-duck}
\end{document}
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .