PDF Snake Scripting Tutorial

 

PDF Snake home

scripting reference

table of contents

Run It

Open Adobe Acrobat. Select File | Open from the menu. Now browse to where you saved your MyFirst.py file. You will have to select All Files (*.*) in order to see your python file.

Now that you have opened your file, you should see a document with the following contents:

D:\PDFer\wwwroot\tutorial\myfirst.py Output:
---------------------------------------------------------------
stdout:
---------------------------------------------------------------
stderr:
Traceback (most recent call last):
  File "D:\PDFer\wwwroot\tutorial\myfirst.py", line 3, in ?
    doc = acrobat.documentOpen( r'C:\PDFSnake\PDFSnake\docs\tutorial\template.pdf')
  File "d:\pdfsnake patch test\pdfsnake\acrobat.py", line 232, in documentOpen
    return getApp().openDoc( sPath)
acrobat.error: The path does not exist.

What is all this junk? This is the output of your script. Anything that you print to stdout using the print statement will appear in the stdout section. Any error reports will appear in the stderror section.

Since, we did not specify the correct path to the template file, an exception was raised, and it is reported in the traceback. So, edit your MyFirst.py so that is has the correct path to template.pdf, and then run the script again.

After running your corrected version of MyFirst.py, there should be two documents open in Acrobat: the template and the output file. The output file should look like this:

D:\PDFer\wwwroot\tutorial\myfirst.py Output:
---------------------------------------------------------------
stdout:
---------------------------------------------------------------
stderr:

Next Page >>