Filter and merge PDF files
I have added 3 new file type fields and 1 text type field to a SO. I want to be able to load only PDF files to 2 of those fields, but don't know how how to set up with Studio or Python. When Invoicing, I would like to merge this 2 files with the invoice and save it on the third field added. Is this possible via automated actions? I've seen code using pyPDF2, but don't know how to make it work inside an Action. The name of the file should come from a text field.
I would really appreciate your assistance.
from PyPDF2 import PdfFileMerger, PdfFileReader [...] merger = PdfFileMerger() for filename in filenames: merger.append(PdfFileReader(file(filename, 'rb'))) merger.write("document-output.pdf")