Can someone please tell me how to remove the last page of a PDF file, using PDFtk?
First select the PDF document from which you want to delete pages. After Acrobat uploads the file, sign in. Then highlight the page thumbnails you want to delete and click the dustbin icon in the top toolbar to delete the selected pages.
This will create the outfile.pdf
with all but the last page in infile.pdf
pdftk infile.pdf cat 1-r2 output outfile.pdf
Explanation of parameters
infile.pdf
is the original pdf filecat
is the operation1-r2
is the page range You can reference page numbers in reverse order by prefixing them with the letter r. For example, page r1 is the last page of the document, r2 is the next-to-last page of the document, and rend is the first page of the document. You can use this prefix in ranges, too, for example r3-r1 is the last three pages of a PDF.
output
will output it to a specific fileoutput.pdf
is the output pdf fileMore examples are here: https://www.pdflabs.com/docs/pdftk-cli-examples/
With cpdf, you can reference a page by how far it is from the end of the document, using a tilde, as well as the beginning.
So, we can do
cpdf in.pdf 1-~2 -o out.pdf
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With