Components for Developers
© 2000-2012, Two Pilots

PDF Library Download Features Manual Tutorials FAQ Pricing HTML2PDF-X Pilot History In the Lab

PDF Creator Pilot documentation

Download CHM version of this manual.
PDF Creator Pilot 4 Knowledge Base
How to Create or Edit a PDF with Python

See Also Example
Collapse All

Once you have installed PDF Creator Pilot on your system it is available for use from Python.

This sample demonstrates how to use PDF Creator Pilot with Python to create and edit PDF documents.

You need to import the win32com.client library to be able to work with COM.

Example

Creating and Editing a PDF Document

Python
[copy to clipboard]
import sys
import win32com.client

PDF = win32com.client.Dispatch("PDFCreatorPilot.PDFDocument4")
PDF.SetLicenseData("demo", "demo")
PDF.Compression = 1
 
## you may open an existing PDF, provide password if needed
PDF.Open("first.pdf", "")

## you may change document properties
oldTitle = PDF.UnicodeTitle
print "Old title is '" + oldTitle + "'"
PDF.UnicodeTitle = u"-=[ my new title ]=-"

## you may add a new page
PDF.NewPage()
fnt = PDF.AddBuiltInFont(1, 0, 0)
PDF.UseFont(fnt, 14)
PDF.ShowTextAt(30, 30, "This page came from Python.")

## you may append an existing PDF, provide password if needed
PDF.Append("second.pdf", "")

## save and open it in default PDF viewer
PDF.SaveToFile("test.pdf", 1)

See Also

Reference

PDF Library Download Features Manual Tutorials FAQ Pricing HTML2PDF-X Pilot History In the Lab

 

 

PDF Library | Virtual Printer | Converters to PDF

Support | Blog | Forum | Contacts

© 2000-2012, Two Pilots