So, r1 is the last page in the PDF file, and r5 is the fifth page from the end, and a range of r1-r3 means the last three pages, starting from the end. These can be odd, even, and we can even use the letter ‘r’ to refer to page numbers in reverse. When specifying the page range, PDFtk will let us use a number of keywords to easily identify the pages you wish to use. Similarly, the page range 14-20 odd will only include odd numbered pages within the given range. A page range of 14-end means all pages from 14 to the end of the file. Apart from using numbers, such as 1-4, 20-32, etc., we can also use certain words such as end, odd, even. There are many different options available when working with page ranges. $ pdftk filename.pdf cat 1-5 10-end removespages6-9.pdf Making sense of the page ranges We’ve only seen a merge operation so far, but we can easily break a PDF file into smaller parts with PDFtk by utilizing the ‘cat’ operation along with the desired page range: $ pdftk filename.pdf cat 1-5 output fivepages.pdf $ pdftk A=first-file.pdf B=second-file.pdf cat A1-20 B10-35 output mixed-file.pdf Finally, we’ve used page ranges with the different ‘handles’ to define the sequence of pages in the final output file. This enables us to refer to the different ‘handles.’ Otherwise PDFtk is unable to locate the different PDF files. Note that unlike previous examples, we’ve also added ‘cat’ to this command. You can only use uppercase letters to define ‘handles’ and we can use multiple letters per handle to create as many handles as we require, for example A, AB, ASD. You can use multiple such ‘handles’ with PDFtk where each ‘handle’ is a separate PDF file. Notice how we’ve used alphabets A and B to identify our two input PDF files. Here is an example that will take 15 pages from one file, and only 20 from the second, where both files are actually more than a 100 pages each, we can do that by using handles. We can then select different pages from these files, and even perform different operations on them. Instead of referring to the different files directly by name, we create aliases, called ‘handles’, for the different files. To use a specified range of pages from multiple PDFs, we have to make use of ‘handles’. If all of the files are sequentially numbered or named, and in the same directory, wildcards can be used instead of typing the name of each file individually. $ pdftk 1.pdf another.pdf 3.pdf yet-another.pdf fifth.pdf output combined.pdf We only have to provide a space separated list of files, in the order you wish to add them, and the name of the output file. The process of merging multiple PDF files into a single document is fairly straightforward with PDFtk. $ sudo apt install pdftk How to use PDFtk
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |