Child pages
  • pdf_output

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
{div:style=display:none} DO NOT EDIT THE CONTENT OF THIS PAGE DIRECTLY (EXCEPT INSIDE THE DIV BELOW WITH ID=DESCRIPTION), UNLESS YOU KNOW WHAT YOU'RE DOING. THE STRUCTURE OF THE CONTENT IS VITAL IN BEING ABLE TO AUTO UPDATE THE CONTENT THROUGH THE DOC GENERATOR.\\ \\ Enter additional information related to this 'class' inside the \{div} macro with 'id=description'{div} {div:id=description}{div}\\ {table:id=|class=servoy sSummary}{colgroup}{column:width=80px|padding=0px}{column}{column}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=2}Method Summary{th}{tr}{tbody}{tr}{td}byte[]{td}{td}[#addMetaData]\(data, metaData) Add metadata to the PDF, like Author{td}{tr}{tbody}{tbody}{tr}{td}byte[]{td}{td}[#combinePDFDocuments]\(pdf_docs_bytearrays) Combine multiple PDF docs into one.{td}{tr}{tbody}{tbody}{tr}{td}byte[]{td}{td}[#combineProtectedPDFDocuments]\(pdf_docs_bytearrays, pdf_docs_passwords) Combine multiple protected PDF docs into one.{td}{tr}{tbody}{tbody}{tr}{td}byte[]{td}{td}[#convertPDFFormToPDFDocument]\(pdf_form, field_values) Convert a PDF form to a PDF document.{td}{tr}{tbody}{tbody}{tr}{td}byte[]{td}{td}[#convertProtectedPDFFormToPDFDocument]\(pdf_form, pdf_password, field_values) Convert a protected PDF form to a PDF document.{td}{tr}{tbody}{tbody}{tr}{td}byte[]{td}{td}[#encrypt]\(data, ownerPassword) Add password protection and security options to the PDF{td}{tr}{tbody}{tbody}{tr}{td}byte[]{td}{td}[#encrypt]\(data, ownerPassword, userPassword) Add password protection and security options to the PDF{td}{tr}{tbody}{tbody}{tr}{td}byte[]{td}{td}[#encrypt]\(data, ownerPassword, userPassword, allowAssembly, allowCopy, allowDegradedPrinting, allowFillIn, allowModifyAnnotations, allowModifyContents, allowPrinting, allowScreenreaders) Add password protection and security options to the PDF{td}{tr}{tbody}{tbody}{tr}{td}byte[]{td}{td}[#encrypt]\(data, ownerPassword, userPassword, allowAssembly, allowCopy, allowDegradedPrinting, allowFillIn, allowModifyAnnotations, allowModifyContents, allowPrinting, allowScreenreaders, is128bit) Add password protection and security options to the PDF{td}{tr}{tbody}{tbody}{tr}{td}byte[]{td}{td}[#encrypt]\(data, ownerPassword, userPassword, allowAssembly, allowCopy, allowDegradedPrinting, allowFillIn, allowModifyAnnotations, allowModifyContents, allowPrinting, allowScreenreaders, is128bit, metaData) Add password protection and security options to the PDF{td}{tr}{tbody}{tbody}{tr}{td}byte[]{td}{td}[#endMetaPrintJob]\() Ends a previously started meta print job.{td}{tr}{tbody}{tbody}{tr}{td}[PrinterJob]{td}{td}[#getPDFPrinter]\() Returns a PDF printer that can be used in print calls.{td}{tr}{tbody}{tbody}{tr}{td}[PrinterJob]{td}{td}[#getPDFPrinter]\(filename) Returns a PDF printer that can be used in print calls.{td}{tr}{tbody}{tbody}{tr}{td}[Number]{td}{td}[#getPagesPrinted]\() Returns the number of pages printed by the last print call done in the context of a meta print job.{td}{tr}{tbody}{tbody}{tr}{td}[Number]{td}{td}[#getTotalPagesPrinted]\() Returns the total number of pages printed in the context of a meta print job.{td}{tr}{tbody}{tbody}{tr}{td}[Number]{td}{td}[#insertFontDirectory]\(path) Add a directory that should be searched for fonts.{td}{tr}{tbody}{tbody}{tr}{td}byte[]{td}{td}[#numberPages]\(data) Add pages numbers to a PDF{td}{tr}{tbody}{tbody}{tr}{td}byte[]{td}{td}[#numberPages]\(data, fontSize, locationX, locationY, font, hexColor) Add pages numbers to a PDF{td}{tr}{tbody}{tbody}{tr}{td}byte[]{td}{td}[#overlay]\(data, forOverlay) Add some PDF based content over a PDF{td}{tr}{tbody}{tbody}{tr}{td}byte[]{td}{td}[#overlay]\(data, forOverlay, isOver) Add some PDF based content over a PDF{td}{tr}{tbody}{tbody}{tr}{td}byte[]{td}{td}[#overlay]\(data, forOverlay, isOver, pages) Add some PDF based content over a PDF{td}{tr}{tbody}{tbody}{tr}{td}byte[]{td}{td}[#overlay]\(data, forOverlay, pages) Add some PDF based content over a PDF{td}{tr}{tbody}{tbody}{tr}{td}byte[]{td}{td}[#overlayText]\(data, text) Add text over every page at a 45 degree angle{td}{tr}{tbody}{tbody}{tr}{td}byte[]{td}{td}[#overlayText]\(data, text, locationX, locationY, isOver, fontSize, font, hexColor) Add text over every page at a 45 degree angle{td}{tr}{tbody}{tbody}{tr}{td}[Boolean]{td}{td}[#startMetaPrintJob]\() Used for printing multiple things into the same PDF document.{td}{tr}{tbody}{tbody}{tr}{td}[Boolean]{td}{td}[#startMetaPrintJob]\(filename) Used for printing multiple things into the same PDF document.{td}{tr}{tbody}{tbody}{tr}{td}byte[]{td}{td}[#watermark]\(data, image) Add an image as a watermark on every page, or the pages specified as a parameter{td}{tr}{tbody}{tbody}{tr}{td}byte[]{td}{td}[#watermark]\(data, image, locationX, locationY, isOver) Add an image as a watermark on every page, or the pages specified as a parameter{td}{tr}{tbody}{tbody}{tr}{td}byte[]{td}{td}[#watermark]\(data, image, locationX, locationY, isOver, pages) Add an image as a watermark on every page, or the pages specified as a parameter{td}{tr}{tbody}{table}\\ {table:id=function|class=servoy sDetail}{colgroup}{column:width=100%|padding=0px}{column}{colgroup}{tr:style=height: 30px;}{th:colspan=1}Method Details{th}{tr}{tbody:id=addMetaData-byteArray_Object}{tr:id=name}{td}h6.addMetaData{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}byte[]{span}{span:style=font-weight: bold;}addMetaData{span}{span}\(data, metaData){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Add metadata to the PDF, like Author{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{byte[]} data -- the PDF \{[Object]} metaData -- a JavaScript object (Scriptable) that contains the metadata as property/value pairs {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}byte[] -- the PDF with metaData added{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} // Add metadata to the PDF, like Author var pdf = plugins.file.showFileOpenDialog(); if (pdf) { var data = plugins.file.readFile(pdf); var metaData = { Author: 'Servoy' }; pdfResult = elements.customer_id.addMetaData(data, metaData); } {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=combinePDFDocuments-ObjectArray}{tr:id=name}{td}h6.combinePDFDocuments{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}byte[]{span}{span:style=font-weight: bold;}combinePDFDocuments{span}{span}\(pdf_docs_bytearrays){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Combine multiple PDF docs into one.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[Object]\[]} pdf_docs_bytearrays -- the array of documents to combine {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}byte[]{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} pdf_blob_column = combinePDFDocuments(new Array(pdf_blob1,pdf_blob2,pdf_blob3)); {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=combineProtectedPDFDocuments-ObjectArray_ObjectArray}{tr:id=name}{td}h6.combineProtectedPDFDocuments{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}byte[]{span}{span:style=font-weight: bold;}combineProtectedPDFDocuments{span}{span}\(pdf_docs_bytearrays, pdf_docs_passwords){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Combine multiple protected PDF docs into one.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[Object]\[]} pdf_docs_bytearrays -- the array of documents to combine \{[Object]\[]} pdf_docs_passwords -- an array of passwords to use {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}byte[]{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} pdf_blob_column = combineProtectedPDFDocuments(new Array(pdf_blob1,pdf_blob2,pdf_blob3), new Array(pdf_blob1_pass,pdf_blob2_pass,pdf_blob3_pass)); {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=convertPDFFormToPDFDocument-byteArray_Object}{tr:id=name}{td}h6.convertPDFFormToPDFDocument{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}byte[]{span}{span:style=font-weight: bold;}convertPDFFormToPDFDocument{span}{span}\(pdf_form, field_values){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Convert a PDF form to a PDF document.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{byte[]} pdf_form -- the PDF Form to convert \{[Object]} field_values -- the values to use {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}byte[]{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} var pdfform = plugins.file.readFile('c:/temp/1040a-form.pdf'); //var field_values = plugins.file.readFile('c:/temp/1040a-data.fdf');//read adobe fdf values or var field_values = new Array()//construct field values field_values[0] = 'f1-1=John C.J.' field_values[1] = 'f1-2=Longlasting' var result_pdf_doc = plugins.pdf_output.convertPDFFormToPDFDocument(pdfform, field_values) if (result_pdf_doc != null) { plugins.file.writeFile('c:/temp/1040a-flatten.pdf', result_pdf_doc) } {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=convertProtectedPDFFormToPDFDocument-byteArray_String_Object}{tr:id=name}{td}h6.convertProtectedPDFFormToPDFDocument{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}byte[]{span}{span:style=font-weight: bold;}convertProtectedPDFFormToPDFDocument{span}{span}\(pdf_form, pdf_password, field_values){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Convert a protected PDF form to a PDF document.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{byte[]} pdf_form -- the PDF Form to convert \{[String]} pdf_password -- the password to use \{[Object]} field_values -- the field values to use {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}byte[]{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} var pdfform = plugins.file.readFile('c:/temp/1040a-form.pdf'); //var field_values = plugins.file.readFile('c:/temp/1040a-data.fdf');//read adobe fdf values or var field_values = new Array()//construct field values field_values[0] = 'f1-1=John C.J.' field_values[1] = 'f1-2=Longlasting' var result_pdf_doc = plugins.pdf_output.convertProtectedPDFFormToPDFDocument(pdfform, 'pdf_password', field_values) if (result_pdf_doc != null) { plugins.file.writeFile('c:/temp/1040a-flatten.pdf', result_pdf_doc) } {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=encrypt-byteArray_String}{tr:id=name}{td}h6.encrypt{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}byte[]{span}{span:style=font-weight: bold;}encrypt{span}{span}\(data, ownerPassword){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Add password protection and security options to the PDF{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{byte[]} data -- the PDF \{[String]} ownerPassword -- the owner password {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}byte[] -- the encrypted PDF{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} // Add password protection and security options to the PDF // NOTE: Passwords are case sensitive var unEncryptedFile = plugins.file.showFileOpenDialog(); if (unEncryptedFile) { var data = plugins.file.readFile(unEncryptedFile); encryptedResult = elements.customer_id.encrypt(data, 'secretPassword', 'secretUserPassword', false, false, false, false, false, false, false, false, true); } {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=encrypt-byteArray_String_String}{tr:id=name}{td}h6.encrypt{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}byte[]{span}{span:style=font-weight: bold;}encrypt{span}{span}\(data, ownerPassword, userPassword){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Add password protection and security options to the PDF{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{byte[]} data -- the PDF \{[String]} ownerPassword -- the owner password \{[String]} userPassword -- the user password {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}byte[] -- the encrypted PDF{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} // Add password protection and security options to the PDF // NOTE: Passwords are case sensitive var unEncryptedFile = plugins.file.showFileOpenDialog(); if (unEncryptedFile) { var data = plugins.file.readFile(unEncryptedFile); encryptedResult = elements.customer_id.encrypt(data, 'secretPassword', 'secretUserPassword', false, false, false, false, false, false, false, false, true); } {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=encrypt-byteArray_String_String_Boolean_Boolean_Boolean_Boolean_Boolean_Boolean_Boolean_Boolean}{tr:id=name}{td}h6.encrypt{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}byte[]{span}{span:style=font-weight: bold;}encrypt{span}{span}\(data, ownerPassword, userPassword, allowAssembly, allowCopy, allowDegradedPrinting, allowFillIn, allowModifyAnnotations, allowModifyContents, allowPrinting, allowScreenreaders){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Add password protection and security options to the PDF{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{byte[]} data -- the PDF \{[String]} ownerPassword -- the owner password \{[String]} userPassword -- the user password \{[Boolean]} allowAssembly -- whether to set the allow assembly permission \{[Boolean]} allowCopy -- whether to set the allow copy permission \{[Boolean]} allowDegradedPrinting -- whether to set the allow degraded printing permission \{[Boolean]} allowFillIn -- whether to set the allow fill in permission \{[Boolean]} allowModifyAnnotations -- whether to set the allow modify annotations permission \{[Boolean]} allowModifyContents -- whether to set the allow modify contents permission \{[Boolean]} allowPrinting -- whether to set the allow printing permission \{[Boolean]} allowScreenreaders -- whether to set the allow screen readers permission {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}byte[] -- the encrypted PDF{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} // Add password protection and security options to the PDF // NOTE: Passwords are case sensitive var unEncryptedFile = plugins.file.showFileOpenDialog(); if (unEncryptedFile) { var data = plugins.file.readFile(unEncryptedFile); encryptedResult = elements.customer_id.encrypt(data, 'secretPassword', 'secretUserPassword', false, false, false, false, false, false, false, false, true); } {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=encrypt-byteArray_String_String_Boolean_Boolean_Boolean_Boolean_Boolean_Boolean_Boolean_Boolean_Boolean}{tr:id=name}{td}h6.encrypt{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}byte[]{span}{span:style=font-weight: bold;}encrypt{span}{span}\(data, ownerPassword, userPassword, allowAssembly, allowCopy, allowDegradedPrinting, allowFillIn, allowModifyAnnotations, allowModifyContents, allowPrinting, allowScreenreaders, is128bit){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Add password protection and security options to the PDF{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{byte[]} data -- the PDF \{[String]} ownerPassword -- the owner password \{[String]} userPassword -- the user password \{[Boolean]} allowAssembly -- whether to set the allow assembly permission \{[Boolean]} allowCopy -- whether to set the allow copy permission \{[Boolean]} allowDegradedPrinting -- whether to set the allow degraded printing permission \{[Boolean]} allowFillIn -- whether to set the allow fill in permission \{[Boolean]} allowModifyAnnotations -- whether to set the allow modify annotations permission \{[Boolean]} allowModifyContents -- whether to set the allow modify contents permission \{[Boolean]} allowPrinting -- whether to set the allow printing permission \{[Boolean]} allowScreenreaders -- whether to set the allow screen readers permission \{[Boolean]} is128bit -- whether to use 128\-bit encryption {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}byte[] -- the encrypted PDF{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} // Add password protection and security options to the PDF // NOTE: Passwords are case sensitive var unEncryptedFile = plugins.file.showFileOpenDialog(); if (unEncryptedFile) { var data = plugins.file.readFile(unEncryptedFile); encryptedResult = elements.customer_id.encrypt(data, 'secretPassword', 'secretUserPassword', false, false, false, false, false, false, false, false, true); } {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=encrypt-byteArray_String_String_Boolean_Boolean_Boolean_Boolean_Boolean_Boolean_Boolean_Boolean_Boolean_Object}{tr:id=name}{td}h6.encrypt{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}byte[]{span}{span:style=font-weight: bold;}encrypt{span}{span}\(data, ownerPassword, userPassword, allowAssembly, allowCopy, allowDegradedPrinting, allowFillIn, allowModifyAnnotations, allowModifyContents, allowPrinting, allowScreenreaders, is128bit, metaData){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Add password protection and security options to the PDF{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{byte[]} data -- the PDF \{[String]} ownerPassword -- the owner password \{[String]} userPassword -- the user password \{[Boolean]} allowAssembly -- whether to set the allow assembly permission \{[Boolean]} allowCopy -- whether to set the allow copy permission \{[Boolean]} allowDegradedPrinting -- whether to set the allow degraded printing permission \{[Boolean]} allowFillIn -- whether to set the allow fill in permission \{[Boolean]} allowModifyAnnotations -- whether to set the allow modify annotations permission \{[Boolean]} allowModifyContents -- whether to set the allow modify contents permission \{[Boolean]} allowPrinting -- whether to set the allow printing permission \{[Boolean]} allowScreenreaders -- whether to set the allow screen readers permission \{[Boolean]} is128bit -- whether to use 128\-bit encryption \{[Object]} metaData -- a JavaScript object (Scriptable) that contains the metadata as property/value pairs {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}byte[] -- the encrypted PDF{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} // Add password protection and security options to the PDF // NOTE: Passwords are case sensitive var unEncryptedFile = plugins.file.showFileOpenDialog(); if (unEncryptedFile) { var data = plugins.file.readFile(unEncryptedFile); encryptedResult = elements.customer_id.encrypt(data, 'secretPassword', 'secretUserPassword', false, false, false, false, false, false, false, false, true); } {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=endMetaPrintJob}{tr:id=name}{td}h6.endMetaPrintJob{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}byte[]{span}{span:style=font-weight: bold;}endMetaPrintJob{span}{span}\(){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Ends a previously started meta print job. For meta print jobs that were stored in memory, not in a file on disk, also returns the content of the generated PDF document.{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}byte[]{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} //to print multiple forms to one pdf document (on file system). var success = plugins.pdf_output.startMetaPrintJob('c:/temp/out.pdf') if (success) { forms.form_one.controller.print(false,false,plugins.pdf_output.getPDFPrinter()); application.output('form one printed ' + plugins.pdf_output.getPagesPrinted() + ' pages.'); forms.form_two.controller.print(false,false,plugins.pdf_output.getPDFPrinter()); application.output('form two printed ' + plugins.pdf_output.getPagesPrinted() + ' pages.'); } application.output('total printed pages: ' + plugins.pdf_output.getTotalPagesPrinted()); plugins.pdf_output.endMetaPrintJob() //to print multiple forms to one pdf document (to store in dataprovider). var success = plugins.pdf_output.startMetaPrintJob() if (success) { forms.form_one.controller.print(false,false,plugins.pdf_output.getPDFPrinter()); application.output('form one printed ' + plugins.pdf_output.getPagesPrinted() + ' pages.'); forms.form_two.controller.print(false,false,plugins.pdf_output.getPDFPrinter()); application.output('form two printed ' + plugins.pdf_output.getPagesPrinted() + ' pages.'); } application.output('total printed pages: ' + plugins.pdf_output.getTotalPagesPrinted()); mediaDataProvider = plugins.pdf_output.endMetaPrintJob() {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getPDFPrinter}{tr:id=name}{td}h6.getPDFPrinter{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[PrinterJob]{span}{span:style=font-weight: bold;}getPDFPrinter{span}{span}\(){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Returns a PDF printer that can be used in print calls. Returns the last started meta print job.{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[PrinterJob]{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} //to print current record without printdialog to pdf file in temp dir. controller.print(true,false,plugins.pdf_output.getPDFPrinter()); {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getPDFPrinter-String}{tr:id=name}{td}h6.getPDFPrinter{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[PrinterJob]{span}{span:style=font-weight: bold;}getPDFPrinter{span}{span}\(filename){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Returns a PDF printer that can be used in print calls. The PDF printer that generates a PDF into the specified file is returned.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} filename -- the file name {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[PrinterJob]{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} //to print current record without printdialog to pdf file in temp dir. controller.print(true,false,plugins.pdf_output.getPDFPrinter('c:/temp/out.pdf')); {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getPagesPrinted}{tr:id=name}{td}h6.getPagesPrinted{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Number]{span}{span:style=font-weight: bold;}getPagesPrinted{span}{span}\(){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Returns the number of pages printed by the last print call done in the context of a meta print job.{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Number]{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} //to print multiple forms to one pdf document (on file system). var success = plugins.pdf_output.startMetaPrintJob('c:/temp/out.pdf') if (success) { forms.form_one.controller.print(false,false,plugins.pdf_output.getPDFPrinter()); application.output('form one printed ' + plugins.pdf_output.getPagesPrinted() + ' pages.'); forms.form_two.controller.print(false,false,plugins.pdf_output.getPDFPrinter()); application.output('form two printed ' + plugins.pdf_output.getPagesPrinted() + ' pages.'); } application.output('total printed pages: ' + plugins.pdf_output.getTotalPagesPrinted()); plugins.pdf_output.endMetaPrintJob() //to print multiple forms to one pdf document (to store in dataprovider). var success = plugins.pdf_output.startMetaPrintJob() if (success) { forms.form_one.controller.print(false,false,plugins.pdf_output.getPDFPrinter()); application.output('form one printed ' + plugins.pdf_output.getPagesPrinted() + ' pages.'); forms.form_two.controller.print(false,false,plugins.pdf_output.getPDFPrinter()); application.output('form two printed ' + plugins.pdf_output.getPagesPrinted() + ' pages.'); } application.output('total printed pages: ' + plugins.pdf_output.getTotalPagesPrinted()); mediaDataProvider = plugins.pdf_output.endMetaPrintJob() {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getTotalPagesPrinted}{tr:id=name}{td}h6.getTotalPagesPrinted{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Number]{span}{span:style=font-weight: bold;}getTotalPagesPrinted{span}{span}\(){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Returns the total number of pages printed in the context of a meta print job. Call this method before ending the meta print job.{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Number]{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} //to print multiple forms to one pdf document (on file system). var success = plugins.pdf_output.startMetaPrintJob('c:/temp/out.pdf') if (success) { forms.form_one.controller.print(false,false,plugins.pdf_output.getPDFPrinter()); application.output('form one printed ' + plugins.pdf_output.getPagesPrinted() + ' pages.'); forms.form_two.controller.print(false,false,plugins.pdf_output.getPDFPrinter()); application.output('form two printed ' + plugins.pdf_output.getPagesPrinted() + ' pages.'); } application.output('total printed pages: ' + plugins.pdf_output.getTotalPagesPrinted()); plugins.pdf_output.endMetaPrintJob() //to print multiple forms to one pdf document (to store in dataprovider). var success = plugins.pdf_output.startMetaPrintJob() if (success) { forms.form_one.controller.print(false,false,plugins.pdf_output.getPDFPrinter()); application.output('form one printed ' + plugins.pdf_output.getPagesPrinted() + ' pages.'); forms.form_two.controller.print(false,false,plugins.pdf_output.getPDFPrinter()); application.output('form two printed ' + plugins.pdf_output.getPagesPrinted() + ' pages.'); } application.output('total printed pages: ' + plugins.pdf_output.getTotalPagesPrinted()); mediaDataProvider = plugins.pdf_output.endMetaPrintJob() {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=insertFontDirectory-String}{tr:id=name}{td}h6.insertFontDirectory{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Number]{span}{span:style=font-weight: bold;}insertFontDirectory{span}{span}\(path){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Add a directory that should be searched for fonts. Call this only in the context of an active meta print job.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} path -- the path to use {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Number]{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} //Insert font directories for font embedding. //You must create an MetaPrintJob before using it. plugins.pdf_output.insertFontDirectory('c:/Windows/Fonts'); plugins.pdf_output.insertFontDirectory('c:/WinNT/Fonts'); plugins.pdf_output.insertFontDirectory('/Library/Fonts'); {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=numberPages-byteArray}{tr:id=name}{td}h6.numberPages{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}byte[]{span}{span:style=font-weight: bold;}numberPages{span}{span}\(data){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Add pages numbers to a PDF{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{byte[]} data -- the PDF {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}byte[] -- the PDF with numbered pages{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} // Add pages numbers to a PDF var unNumberedFile = plugins.file.showFileOpenDialog(); if (unNumberedFile) { var data = plugins.file.readFile(unNumberedFile); pageNumberedPdf = elements.customer_id.numberPages(data, 12, 520, 30, 'Courier', '#ff0033'); } {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=numberPages-byteArray_Number_Number_Number_String_String}{tr:id=name}{td}h6.numberPages{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}byte[]{span}{span:style=font-weight: bold;}numberPages{span}{span}\(data, fontSize, locationX, locationY, font, hexColor){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Add pages numbers to a PDF{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{byte[]} data -- the PDF \{[Number]} fontSize -- the font size to use \{[Number]} locationX -- the x location of the numbers \{[Number]} locationY -- the y location of the numbers \{[String]} font -- the font to use \{[String]} hexColor -- the font color to use {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}byte[] -- the PDF with numbered pages{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} // Add pages numbers to a PDF var unNumberedFile = plugins.file.showFileOpenDialog(); if (unNumberedFile) { var data = plugins.file.readFile(unNumberedFile); pageNumberedPdf = elements.customer_id.numberPages(data, 12, 520, 30, 'Courier', '#ff0033'); } {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=overlay-byteArray_byteArray}{tr:id=name}{td}h6.overlay{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}byte[]{span}{span:style=font-weight: bold;}overlay{span}{span}\(data, forOverlay){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Add some PDF based content over a PDF{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{byte[]} data -- the PDF \{byte[]} forOverlay -- a PDF to use as overlay {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}byte[] -- the PDF with added overlay{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} // Add some PDF based content over a PDF var pages = new Array(); pages[0] = '1'; pages[1] = '3'; pages[2] = '5'; var input1 = plugins.file.showFileOpenDialog(1,null,false,'pdf',null,'Select source file'); if (input1) { var data = plugins.file.readFile(input1); var input2 = plugins.file.showFileOpenDialog(1,null,false,'pdf',null,'Select file for overlay'); if (input2) { var data2 = plugins.file.readFile(input2); overlayedPdf = elements.customer_id.overlay( data, data2, false, pages ); //overlayedPdf = elements.customer_id.overlay( data, data2 ); //overlayedPdf = elements.customer_id.overlay( data, data2, false, null ); //overlayedPdf = elements.customer_id.overlay( data, data2, pages ); } } {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=overlay-byteArray_byteArray_Boolean}{tr:id=name}{td}h6.overlay{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}byte[]{span}{span:style=font-weight: bold;}overlay{span}{span}\(data, forOverlay, isOver){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Add some PDF based content over a PDF{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{byte[]} data -- the PDF \{byte[]} forOverlay -- a PDF to use as overlay \{[Boolean]} isOver -- whether the overlay will be put over the content {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}byte[] -- the PDF with added overlay{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} // Add some PDF based content over a PDF var pages = new Array(); pages[0] = '1'; pages[1] = '3'; pages[2] = '5'; var input1 = plugins.file.showFileOpenDialog(1,null,false,'pdf',null,'Select source file'); if (input1) { var data = plugins.file.readFile(input1); var input2 = plugins.file.showFileOpenDialog(1,null,false,'pdf',null,'Select file for overlay'); if (input2) { var data2 = plugins.file.readFile(input2); overlayedPdf = elements.customer_id.overlay( data, data2, false, pages ); //overlayedPdf = elements.customer_id.overlay( data, data2 ); //overlayedPdf = elements.customer_id.overlay( data, data2, false, null ); //overlayedPdf = elements.customer_id.overlay( data, data2, pages ); } } {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=overlay-byteArray_byteArray_Boolean_StringArray}{tr:id=name}{td}h6.overlay{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}byte[]{span}{span:style=font-weight: bold;}overlay{span}{span}\(data, forOverlay, isOver, pages){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Add some PDF based content over a PDF{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{byte[]} data -- the PDF \{byte[]} forOverlay -- a PDF to use as overlay \{[Boolean]} isOver -- whether the overlay will be put over the content \{[String]\[]} pages -- an array of page numbers to put the overlay on {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}byte[] -- the PDF with added overlay{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} // Add some PDF based content over a PDF var pages = new Array(); pages[0] = '1'; pages[1] = '3'; pages[2] = '5'; var input1 = plugins.file.showFileOpenDialog(1,null,false,'pdf',null,'Select source file'); if (input1) { var data = plugins.file.readFile(input1); var input2 = plugins.file.showFileOpenDialog(1,null,false,'pdf',null,'Select file for overlay'); if (input2) { var data2 = plugins.file.readFile(input2); overlayedPdf = elements.customer_id.overlay( data, data2, false, pages ); //overlayedPdf = elements.customer_id.overlay( data, data2 ); //overlayedPdf = elements.customer_id.overlay( data, data2, false, null ); //overlayedPdf = elements.customer_id.overlay( data, data2, pages ); } } {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=overlay-byteArray_byteArray_StringArray}{tr:id=name}{td}h6.overlay{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}byte[]{span}{span:style=font-weight: bold;}overlay{span}{span}\(data, forOverlay, pages){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Add some PDF based content over a PDF{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{byte[]} data -- the PDF \{byte[]} forOverlay -- a PDF to use as overlay \{[String]\[]} pages -- an array of page numbers to put the overlay on {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}byte[] -- the PDF with added overlay{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} // Add some PDF based content over a PDF var pages = new Array(); pages[0] = '1'; pages[1] = '3'; pages[2] = '5'; var input1 = plugins.file.showFileOpenDialog(1,null,false,'pdf',null,'Select source file'); if (input1) { var data = plugins.file.readFile(input1); var input2 = plugins.file.showFileOpenDialog(1,null,false,'pdf',null,'Select file for overlay'); if (input2) { var data2 = plugins.file.readFile(input2); overlayedPdf = elements.customer_id.overlay( data, data2, false, pages ); //overlayedPdf = elements.customer_id.overlay( data, data2 ); //overlayedPdf = elements.customer_id.overlay( data, data2, false, null ); //overlayedPdf = elements.customer_id.overlay( data, data2, pages ); } } {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=overlayText-byteArray_String}{tr:id=name}{td}h6.overlayText{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}byte[]{span}{span:style=font-weight: bold;}overlayText{span}{span}\(data, text){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Add text over every page at a 45 degree angle{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{byte[]} data -- the PDF \{[String]} text -- the text to use for the overlay {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}byte[] -- the PDF with added overlay{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} // Add text over every page at a 45 degree angle\m var pdf = plugins.file.showFileOpenDialog(); if (pdf) { var data = plugins.file.readFile(pdf); modifiedPdf = elements.customer_id.overlayText(data, 'DRAFT', 230, 430, true, 32, 'Helvetica', '#33ff33'); } {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=overlayText-byteArray_String_Number_Number_Boolean_Number_String_String}{tr:id=name}{td}h6.overlayText{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}byte[]{span}{span:style=font-weight: bold;}overlayText{span}{span}\(data, text, locationX, locationY, isOver, fontSize, font, hexColor){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Add text over every page at a 45 degree angle{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{byte[]} data -- the PDF \{[String]} text -- the text to use for the overlay \{[Number]} locationX -- the x location of the overlay \{[Number]} locationY -- the y location of the overlay \{[Boolean]} isOver -- whether to put the overlay over the content \{[Number]} fontSize -- the font size to use \{[String]} font -- the font to use \{[String]} hexColor -- the font color to use {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}byte[] -- the PDF with added overlay{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} // Add text over every page at a 45 degree angle\m var pdf = plugins.file.showFileOpenDialog(); if (pdf) { var data = plugins.file.readFile(pdf); modifiedPdf = elements.customer_id.overlayText(data, 'DRAFT', 230, 430, true, 32, 'Helvetica', '#33ff33'); } {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=startMetaPrintJob}{tr:id=name}{td}h6.startMetaPrintJob{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Boolean]{span}{span:style=font-weight: bold;}startMetaPrintJob{span}{span}\(){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Used for printing multiple things into the same PDF document. Starts a meta print job and all print calls made before ending the meta print job will be done into the same PDF document. The PDF document is stored in memory and can be retrieved when ending the meta print job and can be saved, for example, into a dataprovider.{div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Boolean]{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} //to print multiple forms to one pdf document (on file system). var success = plugins.pdf_output.startMetaPrintJob('c:/temp/out.pdf') if (success) { forms.form_one.controller.print(false,false,plugins.pdf_output.getPDFPrinter()); application.output('form one printed ' + plugins.pdf_output.getPagesPrinted() + ' pages.'); forms.form_two.controller.print(false,false,plugins.pdf_output.getPDFPrinter()); application.output('form two printed ' + plugins.pdf_output.getPagesPrinted() + ' pages.'); } application.output('total printed pages: ' + plugins.pdf_output.getTotalPagesPrinted()); plugins.pdf_output.endMetaPrintJob() //to print multiple forms to one pdf document (to store in dataprovider). var success = plugins.pdf_output.startMetaPrintJob() if (success) { forms.form_one.controller.print(false,false,plugins.pdf_output.getPDFPrinter()); application.output('form one printed ' + plugins.pdf_output.getPagesPrinted() + ' pages.'); forms.form_two.controller.print(false,false,plugins.pdf_output.getPDFPrinter()); application.output('form two printed ' + plugins.pdf_output.getPagesPrinted() + ' pages.'); } application.output('total printed pages: ' + plugins.pdf_output.getTotalPagesPrinted()); mediaDataProvider = plugins.pdf_output.endMetaPrintJob() {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=startMetaPrintJob-String}{tr:id=name}{td}h6.startMetaPrintJob{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}[Boolean]{span}{span:style=font-weight: bold;}startMetaPrintJob{span}{span}\(filename){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Used for printing multiple things into the same PDF document. Starts a meta print job and all print calls made before ending the meta print job will be done into the same PDF document. The PDF document is generated in a File specified by the filename.{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{[String]} filename -- the file name {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}[Boolean]{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} //to print multiple forms to one pdf document (on file system). var success = plugins.pdf_output.startMetaPrintJob('c:/temp/out.pdf') if (success) { forms.form_one.controller.print(false,false,plugins.pdf_output.getPDFPrinter()); application.output('form one printed ' + plugins.pdf_output.getPagesPrinted() + ' pages.'); forms.form_two.controller.print(false,false,plugins.pdf_output.getPDFPrinter()); application.output('form two printed ' + plugins.pdf_output.getPagesPrinted() + ' pages.'); } application.output('total printed pages: ' + plugins.pdf_output.getTotalPagesPrinted()); plugins.pdf_output.endMetaPrintJob() //to print multiple forms to one pdf document (to store in dataprovider). var success = plugins.pdf_output.startMetaPrintJob() if (success) { forms.form_one.controller.print(false,false,plugins.pdf_output.getPDFPrinter()); application.output('form one printed ' + plugins.pdf_output.getPagesPrinted() + ' pages.'); forms.form_two.controller.print(false,false,plugins.pdf_output.getPDFPrinter()); application.output('form two printed ' + plugins.pdf_output.getPagesPrinted() + ' pages.'); } application.output('total printed pages: ' + plugins.pdf_output.getTotalPagesPrinted()); mediaDataProvider = plugins.pdf_output.endMetaPrintJob() {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=watermark-byteArray_String}{tr:id=name}{td}h6.watermark{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}byte[]{span}{span:style=font-weight: bold;}watermark{span}{span}\(data, image){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Add an image as a watermark on every page, or the pages specified as a parameter{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{byte[]} data -- the PDF \{[String]} image -- the path of an image to use {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}byte[] -- the PDF with added watermak{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} // Add an image as a watermark on every page, or the pages specified as a parameter. var pdf = plugins.file.showFileOpenDialog(); if (pdf) { var data = plugins.file.readFile(pdf); var image = plugins.file.showFileOpenDialog(); modifiedPdf = elements.customer_id.watermark(data, image); } {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=watermark-byteArray_String_Number_Number_Boolean}{tr:id=name}{td}h6.watermark{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}byte[]{span}{span:style=font-weight: bold;}watermark{span}{span}\(data, image, locationX, locationY, isOver){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}Add an image as a watermark on every page, or the pages specified as a parameter{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{byte[]} data -- the PDF \{[String]} image -- the path of an image to use \{[Number]} locationX -- the x location of the image \{[Number]} locationY -- the y location of the image \{[Boolean]} isOver -- whether to put over the content {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}byte[] -- the PDF with added watermak{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} // Add an image as a watermark on every page, or the pages specified as a parameter. var pdf = plugins.file.showFileOpenDialog(); if (pdf) { var data = plugins.file.readFile(pdf); var image = plugins.file.showFileOpenDialog(); modifiedPdf = elements.customer_id.watermark(data, image); } {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=watermark-byteArray_String_Number_Number_Boolean_StringArray}{tr:id=name}{td}h6.watermark{td}{tr}{tr:id=sig}{td}{span:style=margin-right: 5px;}byte[]{span}{span:style=font-weight: bold;}watermark{span}{span}\(data, image, locationX, locationY, isOver, pages){span}{td}{tr}{tr:id=des}{td}{div:class=sIndent}
Wiki Markup
Cache
indextrue
refresh100d
showRefreshtrue
iddoc
titleRefresh page
showDatetrue
retryEnable

servoy sReturnTypes2100%height: 30px;2Supported ClientssWordListSmartClientsWordListWebClientsWordListNGClient

servoy sSummary12%30%58%height: 30px;3Methods SummaryAdd metadata to the PDF, like AuthorCombine multiple PDF docs into one.Combine multiple protected PDF docs into one.Convert a PDF form to a PDF document.Convert a protected PDF form to a PDF document.Add password protection and security options to the PDFAdd password protection and security options to the PDFAdd password protection and security options to the PDFAdd password protection and security options to the PDFAdd password protection and security options to the PDFEnds a previously started meta print job.Returns a PDF printer that can be used in print calls.Returns a PDF printer that can be used in print calls.Returns the number of pages printed by the last print call done in the context of a meta print job.Create a thumbnail from the provided PDFCreate a thumbnail from the provided PDFCreate a thumbnail from the provided PDFReturns the total number of pages printed in the context of a meta print job.Add a directory that should be searched for fonts.Add pages numbers to a PDFAdd pages numbers to a PDFAdd some PDF based content over a PDFAdd some PDF based content over a PDFAdd some PDF based content over a PDFAdd some PDF based content over a PDFAdd text over every page at a 45 degree angleAdd text over every page at a 45 degree angleUsed for printing multiple things into the same PDF document.Used for printing multiple things into the same PDF document.Add an image as a watermark on every page, or the pages specified as a parameterAdd an image as a watermark on every page, or the pages specified as a parameterAdd an image as a watermark on every page, or the pages specified as a parameter

functionservoy sDetail2100%height:30px2Methods DetailsaddMetaDataname

addMetaData(data, metaData)

dessIndent
Add metadata to the PDF, like Author
prs

Parameters

sIndentdatathe PDFmetaDataa JavaScript object (Scriptable) that contains the metadata as property/value pairs
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient
sam

Sample

sIdentjavascript
lastDetailRowcombinePDFDocumentsname

combinePDFDocuments(pdf_docs_bytearrays)

dessIndent
Combine multiple PDF docs into one.
Note: this function may fail when creating large PDF files due to lack of available heap memory. To compensate, please configure the application server with more heap memory via -Xmx parameter.
prs

Parameters

sIndentpdf_docs_bytearraysthe array of documents to combine
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
combineProtectedPDFDocumentsname

combineProtectedPDFDocuments(pdf_docs_bytearrays, pdf_docs_passwords)

dessIndent
Combine multiple protected PDF docs into one.
Note: this function may fail when creating large PDF files due to lack of available heap memory. To compensate, please configure the application server with more heap memory via -Xmx parameter.
prs

Parameters

sIndentpdf_docs_bytearraysthe array of documents to combinepdf_docs_passwordsan array of passwords to use
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
convertPDFFormToPDFDocumentname

convertPDFFormToPDFDocument(pdf_form, field_values)

dessIndent
Convert a PDF form to a PDF document.
prs

Parameters

sIndentpdf_formthe PDF Form to convertfield_valuesthe values to use
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
convertProtectedPDFFormToPDFDocumentname

convertProtectedPDFFormToPDFDocument(pdf_form, pdf_password, field_values)

dessIndent
Convert a protected PDF form to a PDF document.
prs

Parameters

sIndentpdf_formthe PDF Form to convertpdf_passwordthe password to usefield_valuesthe field values to use
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
encryptname

encrypt(data, ownerPassword)

dessIndent
Add password protection and security options to the PDF
prs

Parameters

sIndentdatathe PDFownerPasswordthe owner password
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
encryptname

encrypt(data, ownerPassword, userPassword)

dessIndent
Add password protection and security options to the PDF
prs

Parameters

sIndentdatathe PDFownerPasswordthe owner passworduserPasswordthe user password
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
encryptname

encrypt(data, ownerPassword, userPassword, allowAssembly, allowCopy, allowDegradedPrinting, allowFillIn, allowModifyAnnotations, allowModifyContents, allowPrinting, allowScreenreaders)

dessIndent
Add password protection and security options to the PDF
prs

Parameters

sIndentdatathe PDFownerPasswordthe owner passworduserPasswordthe user passwordallowAssemblywhether to set the allow assembly permissionallowCopywhether to set the allow copy permissionallowDegradedPrintingwhether to set the allow degraded printing permissionallowFillInwhether to set the allow fill in permissionallowModifyAnnotationswhether to set the allow modify annotations permissionallowModifyContentswhether to set the allow modify contents permissionallowPrintingwhether to set the allow printing permissionallowScreenreaderswhether to set the allow screen readers permission
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
encryptname

encrypt(data, ownerPassword, userPassword, allowAssembly, allowCopy, allowDegradedPrinting, allowFillIn, allowModifyAnnotations, allowModifyContents, allowPrinting, allowScreenreaders, is128bit)

dessIndent
Add password protection and security options to the PDF
prs

Parameters

sIndentdatathe PDFownerPasswordthe owner passworduserPasswordthe user passwordallowAssemblywhether to set the allow assembly permissionallowCopywhether to set the allow copy permissionallowDegradedPrintingwhether to set the allow degraded printing permissionallowFillInwhether to set the allow fill in permissionallowModifyAnnotationswhether to set the allow modify annotations permissionallowModifyContentswhether to set the allow modify contents permissionallowPrintingwhether to set the allow printing permissionallowScreenreaderswhether to set the allow screen readers permissionis128bitwhether to use 128-bit encryption
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
encryptname

encrypt(data, ownerPassword, userPassword, allowAssembly, allowCopy, allowDegradedPrinting, allowFillIn, allowModifyAnnotations, allowModifyContents, allowPrinting, allowScreenreaders, is128bit, metaData)

dessIndent
Add password protection and security options to the PDF
prs

Parameters

sIndentdatathe PDFownerPasswordthe owner passworduserPasswordthe user passwordallowAssemblywhether to set the allow assembly permissionallowCopywhether to set the allow copy permissionallowDegradedPrintingwhether to set the allow degraded printing permissionallowFillInwhether to set the allow fill in permissionallowModifyAnnotationswhether to set the allow modify annotations permissionallowModifyContentswhether to set the allow modify contents permissionallowPrintingwhether to set the allow printing permissionallowScreenreaderswhether to set the allow screen readers permissionis128bitwhether to use 128-bit encryptionmetaDataa JavaScript object (Scriptable) that contains the metadata as property/value pairs
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
endMetaPrintJobname

endMetaPrintJob()

dessIndent
Ends a previously started meta print job. For meta print jobs that were stored in memory, not in a file on disk, also returns the content of the generated PDF document.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient
sam

Sample

sIdentjavascript
lastDetailRow
getPDFPrintername

getPDFPrinter()

dessIndent
Returns a PDF printer that can be used in print calls. Returns the last started meta print job.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient
sam

Sample

sIdentjavascript
lastDetailRow
getPDFPrintername

getPDFPrinter(filename)

dessIndent
Returns a PDF printer that can be used in print calls. The PDF printer that generates a PDF into the specified file is returned.
prs

Parameters

sIndentfilenamethe file name
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient
sam

Sample

sIdentjavascript
lastDetailRow
getPagesPrintedname

getPagesPrinted()

dessIndent
Returns the number of pages printed by the last print call done in the context of a meta print job.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient
sam

Sample

sIdentjavascript
lastDetailRow
getThumbnailImagename

getThumbnailImage(data)

dessIndent
Create a thumbnail from the provided PDF
prs

Parameters

sIndentdatathe PDF
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
getThumbnailImagename

getThumbnailImage(data, pageNumber)

dessIndent
Create a thumbnail from the provided PDF
prs

Parameters

sIndentdatathe PDFpageNumberPDF page to get thumbnail of. This parameter is zero based index.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
getThumbnailImagename

getThumbnailImage(data, pageNumber, dpi)

dessIndent
Create a thumbnail from the provided PDF
prs

Parameters

sIndentdatathe PDFpageNumberPDF page to get thumbnail of. This parameter is zero based index.dpiresolution used to render the thumbnail image
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
getTotalPagesPrintedname

getTotalPagesPrinted()

dessIndent
Returns the total number of pages printed in the context of a meta print job. Call this method before ending the meta print job.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient
sam

Sample

sIdentjavascript
lastDetailRow
insertFontDirectoryname

insertFontDirectory(path)

dessIndent
Add a directory that should be searched for fonts. Call this only in the context of an active meta print job.
prs

Parameters

sIndentpaththe path to use
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient
sam

Sample

sIdentjavascript
lastDetailRow
numberPagesname

numberPages(data)

dessIndent
Add pages numbers to a PDF
prs

Parameters

sIndentdatathe PDF
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
numberPagesname

numberPages(data, fontSize, locationX, locationY, font, hexColor)

dessIndent
Add pages numbers to a PDF
prs

Parameters

sIndentdatathe PDFfontSizethe font size to uselocationXthe x location of the numberslocationYthe y location of the numbersfontthe font to usehexColorthe font color to use
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
overlayname

overlay(data, forOverlay)

dessIndent
Add some PDF based content over a PDF
prs

Parameters

sIndentdatathe PDFforOverlaya PDF to use as overlay
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
overlayname

overlay(data, forOverlay, isOver)

dessIndent
Add some PDF based content over a PDF
prs

Parameters

sIndentdatathe PDFforOverlaya PDF to use as overlayisOverwhether the overlay will be put over the content
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
overlayname

overlay(data, forOverlay, isOver, pages)

dessIndent
Add some PDF based content over a PDF
prs

Parameters

sIndentdatathe PDFforOverlaya PDF to use as overlayisOverwhether the overlay will be put over the contentpagesan array of page numbers to put the overlay on
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
overlayname

overlay(data, forOverlay, pages)

dessIndent
Add some PDF based content over a PDF
prs

Parameters

sIndentdatathe PDFforOverlaya PDF to use as overlaypagesan array of page numbers to put the overlay on
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
overlayTextname

overlayText(data, text)

dessIndent
Add text over every page at a 45 degree angle
prs

Parameters

sIndentdatathe PDFtextthe text to use for the overlay
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
overlayTextname

overlayText(data, text, locationX, locationY, isOver, fontSize, font, hexColor)

dessIndent
Add text over every page at a 45 degree angle
prs

Parameters

sIndentdatathe PDFtextthe text to use for the overlaylocationXthe x location of the overlaylocationYthe y location of the overlayisOverwhether to put the overlay over the contentfontSizethe font size to usefontthe font to usehexColorthe font color to use
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
startMetaPrintJobname

startMetaPrintJob()

dessIndent
Used for printing multiple things into the same PDF document. Starts a meta print job and all print calls made before ending the meta print job will be done into the same PDF document. The PDF document is stored in memory and can be retrieved when ending the meta print job and can be saved, for example, into a dataprovider.
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient
sam

Sample

sIdentjavascript
lastDetailRow
startMetaPrintJobname

startMetaPrintJob(filename)

dessIndent
Used for printing multiple things into the same PDF document. Starts a meta print job and all print calls made before ending the meta print job will be done into the same PDF document. The PDF document is generated in a File specified by the filename.
prs

Parameters

sIndentfilenamethe file name
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient
sam

Sample

sIdentjavascript
lastDetailRow
watermarkname

watermark(data, image)

dessIndent
Add an image as a watermark on every page, or the pages specified as a parameter
prs

Parameters

sIndentdatathe PDFimagethe path of an image to use or array of bytes containing actual image
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow
watermarkname

watermark(data, image, locationX, locationY, isOver)

dessIndent
Add an image as a watermark on every page, or the pages specified as a parameter
{div}{td}{tr}{tr:id=prs}{td}*Parameters*\\{div:class=sIndent}\{byte[]} data -- the PDF \{[String]} image -- the path of an image to use \{[Number]} locationX -- the x location of the image \{[Number]} locationY -- the y location of the image \{[Boolean]} isOver -- whether to put over the content \{[String]\[]} pages -- an array of pages where to apply the watermark {div}{td}{tr}{tr:id=ret}{td}*Returns*\\{div:class=sIndent}byte[] -- the PDF with added watermak{div}{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} //
prs

Parameters

sIndentdatathe PDFimagethe path of an image to use or array of bytes containing actual imagelocationXthe x location of the imagelocationYthe y location of the imageisOverwhether to put over the content
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRowwatermarkname

watermark(data, image, locationX, locationY, isOver, pages)

dessIndent
Add an image as a watermark on every page, or the pages specified as a parameter
. var pdf = plugins.file.showFileOpenDialog(); if (pdf) { var data = plugins.file.readFile(pdf); var image = plugins.file.showFileOpenDialog(); modifiedPdf = elements.customer_id.watermark(data, image); } {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{table}
prs

Parameters

sIndentdatathe PDFimagethe path of an image to use or array of bytes containing actual imagelocationXthe x location of the imagelocationYthe y location of the imageisOverwhether to put over the contentpagesan array of pages where to apply the watermark
ret

Returns

sIndent
clients

Supported Clients

sIndentSmartClient,WebClient,NGClient
sam

Sample

sIdentjavascript
lastDetailRow