Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Trying to offload some tasks to iOS from failing MacBook... Can Pythonista do these PDF manipulation tasks?
-
Hello everyone,,
A recent possible SSD failure on my mid-2013 MacBook Pro 15” has me thinking more about the tasks I do for my small company. In particular I do a lot of CLI tasks surrounding PDFs. I’m sure we can make a better workflow- but I’m wondering if I attempt to keep the same workflow, perhaps Pythonista can help!https://reversephonelookup.onl/ https://curated.onl/nba-reddit/In particular, I do the following tasks usually via CLI or Automator scripts that use the CLI commands...
Concatenate PDFs into a single document (often 2-10 documents needing to be cat’d)
apply watermark/background to PDFs to include headers/footers on the pages of interest
My commands for these items are: (1) the combine PDF Automator rule - I realize now I don’t have a CLI command for this, but have used other commands in the past - most likely pdftk, and (2) pdftk with multibackground option for the background/headerfooter files (also pdf).
Is this crazy to attempt? I’d need file selection flexibility from some source (let’s say something like Dropbox or iCloud) and then a way to view/save output (probably system handler).
I’d love to hear more about what you suggest- I don’t think I’ll be down for the count when this old friend MacBook dies, but I want to think outside the box a bit with my workflow.
Unfortunately the tools generating the PDF’s are not doing things nicely, so this is why I have to massage everything into the format/concatenate etc. for reports.
Thanks everyone for their input!!!!
-
@PetterJhon, here’s sample Pythonista code for combining PDFs in a directory with the built-in PDF library:
#coding: utf-8 from PyPDF2 import PdfFileMerger import glob pdfs = sorted(glob.glob("PDF/*")) merger = PdfFileMerger() for pdf in pdfs: merger.append(pdf) merger.write("Combined result.pdf")
I have not used it, but PyPDF2 also includes a mergePage function that can include a header/footer page ”on top of” your content page (or vice versa, if it gives better results).