Archives April 5, 2012

Automatically print a PDF generated with ReportLab using JavaScript

It seems everyone is asking how to embed JavaScript in a PDF created with ReportLab.

Google also use this PDF feature to allow for printing of proprietary office documents from their Gmail service. Google's method is somewhat different and they bind the JavaScript to the first object in the document and trigger it by referencing it with the Names entity as shown below.

1 0 obj
2 0 obj
<</Names[(0000000000000000) 1 0 R]>>
3 0 obj

I was not able to use the ...

— Andrew

Site theme originally by