community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.

A quick tutorial for getting Alteryx data written to an Adobe Acrobat / PDF form

Alteryx
Alteryx

Hi @YankeePred.  Glad the macro is working out for you.  To answer your multi-page PDF page question, the answer is YES.

 

If you look at the code snippet below it was reading in the pages of the template file and creating/adding them to the target file object.  Eventually we wrote the writer object’s contents to disk.

pdf_writer.addPage(pdf_reader.getPage(page))

 

So its this addPage function of the PyPDF2 package does just that - adds a page to a PDF.  And if your situation requires different options you also have APPEND & MERGE functions.  (Append is pretty much identical to the merge method, but assumes you want to place all pages at the end of the file instead of specifying a particular position.)  

 

from PyPDF2 import PdfFileMerger, PdfFileReader

# ...

pdf_merger = PdfFileMerger()

pdf_merger.append(PdfFileReader(file(1st_PDF_file, 'rb')))
pdf_merger.append(PdfFileReader(file(2nd_PDF_file, 'rb')))

pdf_merger.write("my_ayx_document-output.pdf")

 

More detail can be found at : https://pythonhosted.org/PyPDF2/PdfFileMerger.html 

Highlighted
Atom

Hey Peter,

 

Thanks for the code but was just wondering, how would you combine the checkbox and text field into one code? I tried but it was not working out the way I want it to. It was just checking the box and not filling out the text field like it use to.

 

Thanks!

Labels