blog:odborny:2025-05-07-command-line_tools_for_pdf_processing
Rozdiely
Tu môžete vidieť rozdiely medzi vybranou verziou a aktuálnou verziou danej stránky.
| Obojstranná predošlá revíziaPredchádzajúca revíziaNasledujúca revízia | Predchádzajúca revízia | ||
| blog:odborny:2025-05-07-command-line_tools_for_pdf_processing [2026/01/19 18:10] – Róbert Toth | blog:odborny:2025-05-07-command-line_tools_for_pdf_processing [2026/05/15 13:10] (aktuálne) – Róbert Toth | ||
|---|---|---|---|
| Riadok 12: | Riadok 12: | ||
| ==== Coherent PDF (cpdf) ==== | ==== Coherent PDF (cpdf) ==== | ||
| - | * **Download: | + | * **Download: |
| * **Changelog: | * **Changelog: | ||
| * **Manual: | * **Manual: | ||
| Riadok 25: | Riadok 25: | ||
| ==== pdfcpu ==== | ==== pdfcpu ==== | ||
| * **Download: | * **Download: | ||
| - | * **Changelog: | + | * **Changelog: |
| * **Manual: | * **Manual: | ||
| Riadok 103: | Riadok 103: | ||
| ==== QPDF ==== | ==== QPDF ==== | ||
| - | N/A (not tested yet TODO) | + | [[https:// |
| + | * **'' | ||
| + | * **'' | ||
| + | * **'' | ||
| + | * **'' | ||
| + | * **'' | ||
| + | So the resulting command is: | ||
| + | < | ||
| + | qpdf " | ||
| + | </ | ||
| ==== Adobe Acrobat ==== | ==== Adobe Acrobat ==== | ||
| Riadok 111: | Riadok 120: | ||
| ; <color blue> | ; <color blue> | ||
| ; <color blue> | ; <color blue> | ||
| - | ; <color blue> | + | ; <color blue> |
| ; <color blue> | ; <color blue> | ||
| + | |||
| + | === ❗️" | ||
| + | This is just an addition to a note above under //<color blue> | ||
| + | |||
| + | Having **Discard all comments, forms and multimedia** (under **Discard User Data** tab) turned on while optimising PDF in Adobe Acrobat will also remove all internal cross-references (e.g. clickable links from Contents page to specific parts of the document). This was spotted [[https:// | ||
| Riadok 230: | Riadok 244: | ||
| </ | </ | ||
| As mentioned by manual, '' | As mentioned by manual, '' | ||
| + | |||
| + | <color red> | ||
| ==== MuPDF (mutool) ==== | ==== MuPDF (mutool) ==== | ||
| Riadok 239: | Riadok 255: | ||
| There is one additional switch which deals with PDF decompression: | There is one additional switch which deals with PDF decompression: | ||
| + | |||
| + | Of all tested tools, '' | ||
| + | |||
| + | <color red> | ||
| ==== pdfcpu ==== | ==== pdfcpu ==== | ||
| Riadok 248: | Riadok 268: | ||
| pdftk " | pdftk " | ||
| </ | </ | ||
| + | PDFtk separates individual PDF dictionary elements by newlines ('' | ||
| + | < | ||
| + | << | ||
| + | / | ||
| + | /Metadata 23 0 R | ||
| + | /Rotate 0 | ||
| + | /Resources 24 0 R | ||
| + | /Type /Page | ||
| + | /Parent 25 0 R | ||
| + | /Contents 26 0 R | ||
| + | /MediaBox [0 0 370.158 591.26] | ||
| + | /CropBox [0 0 370.158 591.26] | ||
| + | >> | ||
| + | </ | ||
| + | It also adds its own elements (e.g. ''/ | ||
| + | |||
| ==== QPDF ==== | ==== QPDF ==== | ||
| Riadok 254: | Riadok 290: | ||
| qpdf " | qpdf " | ||
| </ | </ | ||
| + | This will effectively equivalent to using both [[https:// | ||
| + | There is also another switch, '' | ||
| + | |||
| + | QPDF currently [[https:// | ||
| + | |||
| + | |||
| + | ===== - Resetting PDF page coordinates (remove CropBox/ | ||
| + | **Example use-case:** you have a PDF with pages consisting of scanned images, which are cropped accordingly so that each page is the same size and the real scanned page is situated properly inside the PDF page. You want to OCR these pages (using Adobe Acrobat' | ||
| + | |||
| + | ==== TL;DR: Summary first ==== | ||
| + | <color blue/ | ||
| + | |||
| + | ==== Coherent PDF (cpdf) ==== | ||
| + | Although listed under " | ||
| + | < | ||
| + | cpdf -upright " | ||
| + | </ | ||
| + | |||
| + | |||
| + | ===== - Make Adobe Acrobat appear in "Open with" menu for images ===== | ||
| + | * **Example use-case #1:** You want to create PDF from image // | ||
| + | * **Example use-case #2:** You have a series of scanned pages which you want to combine into a PDF. When you open several images with Acrobat, it will automatically ask you whether you want to combine them into single PDF file. Again, this would be perfect, if you were allowed to open those images in Acrobat… | ||
| + | |||
| + | Adobe Acrobat is perfectly capable of opening common image types (e.g. '' | ||
| + | * either manually locate the '' | ||
| + | * //or// you can open the image from Acrobat, but in this case you must click the '' | ||
| + | |||
| + | ==== Solution: Manually adding images as Acrobat-recognized file types ==== | ||
| + | - Locate '' | ||
| + | - Make a backup copy of the file (this will ask for a password, since Acrobat installs itself with extra permissions). | ||
| + | - Open '' | ||
| + | - Add the following lines to the beginning of the ''< | ||
| + | < | ||
| + | < | ||
| + | <!-- FurloSK BEGIN: added jpg, tiff, png extensions --> | ||
| + | <!-- after changing, run this command to refresh system associations: | ||
| + | / | ||
| + | --> | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | </ | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | </ | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | </ | ||
| + | <!-- FurloSK END: added jpg, tiff, png extensions --> | ||
| + | <!-- … continuing with the default Document Types --> | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | … | ||
| + | </ | ||
| + | - After this, force macOS to refresh file types associations from Acrobat by running:< | ||
| + | / | ||
| + | </ | ||
| + | - Done! '' | ||
| + | |||
| + | === Possible code-signing issue (" | ||
| + | This is not happening specifically with Acrobat, but generally speaking, when you change an app's '' | ||
| + | |||
| + | Original source: [[https:// | ||
| + | |||
| + | |||
| + | |||
| + | ===== New cases to come… ===== | ||
| < | < | ||
| + | <!-- ——————————————————————————————————————————————————————————————————————————————————————————————— | ||
| + | ——————————————————————————————————————————————————————————————————————————————————————————————— | ||
| <!-- New Case Template BEGIN | <!-- New Case Template BEGIN | ||
| ===== - New Case TODO ===== | ===== - New Case TODO ===== | ||
| Riadok 298: | Riadok 432: | ||
| ~~socialite~~ | ~~socialite~~ | ||
| {{tag> | {{tag> | ||
| + | ; Page visits : ~~QUICKSTATS: | ||
| + | ; total : {{counter|total}} | ||
| + | ; today : {{counter|today}} | ||
| ===== Comments ===== | ===== Comments ===== | ||
blog/odborny/2025-05-07-command-line_tools_for_pdf_processing.1768842647.txt.gz · Posledná úprava: 2026/01/19 18:10 od Róbert Toth
