Is it possible to write a text in existing PDF document using Servoy?
No, but if you try the pdf pro plugin (see www.servoyforge.net website) you will find out there is a possibility to merge 2 pdf’s.
erikd:
Is it possible to write a text in existing PDF document using Servoy?
Yes, if the PDF document has field elements.
Then you can create a FDF (form data format) file and merge it with the fielded PDF file template.
Something like this:
var fdf
fdf = '%FDF-1.2\n1 0 obj\n\n<</FDF<</Fields[\n\n'
fdf += '<</T(' + fieldnamehere +')/V('+ fieldvaluehere + ')>>\n'
fdf += '\n]\n\n/F (Form.pdf)\n\n>>>>\n\nendobj\ntrailer\n<</Root 1 0 R>>\n%%EOF\n'
var thepdfblob
var pdf_data = application.createTempFile('pdf_data','.fdf')
plugins.file.writeTXTFile(pdf_data, fdf)
var pdf_form = pdftemplateid_to_pdftemplates.actual_pdf_form;
thepdfblob = plugins.pdf_output.convertPDFFormToPDFDocument(pdf_form, pdf_data)
The above code assumes that you are using a PDF template file that is a PDF “Acroform” file and not a PDF “XFA” file.
Dean Westover
Choices Software, Inc.
Thanks for the reply. This is helpful.
Our PDF pro plugin uses the iText library. It includes an example writing text over a PDF as a watermark, so that should give you a starting point. However if you are just entering text into actual pdf fields, then you would use the way dean suggested.