Project

General

Profile

Description
PDF Pro plugin makes possible the manipulation pdf files. Compatible with both Smart & Web Client.

Features
Compress a PDF file. NOTE: JPEG compression is used on any images in the PDF.
Add pages numbers to a PDF.
Merge 2 ore more PDF's into 1.
Add metadata to the PDF, like Author.
Add password protection and security options to the PDF. NOTE: Passwords are case sensitive
Delete pages from the PDF.
Shrink the pages into smaller sizes to show multiple on 1 pages as handouts.
Add an images as a watermark on every page, or the pages specified as a parameter.
Add text over every page at a 45 degree angle.

Available functions
compress( uncompressedFile );
numberPages( inputFile,[fontSize],[locationX],[locationY],[font],[fontHexColor] );
merge( inputFilesArray );
addMetaData( inputFile,metaData );
encrypt( inputFile,ownerPassword,[userPassword],[allowAssembly],[allowCopy],[allowDegradedPrinting],[allowFillIn],[allowModifyAnnotations],[allowModifyContents],[allowPrinting],[allowScreenreaders],[is128bit],[metaData]);
deletePages( inputFile,pagesToDelete );
createHandouts( inputFile,columns,rows );
watermark( inputFile,image,[locationX],[locationY],[isUnderText],[pagesToWatermark] );
overlay( basicFile,forOverlay,outputPath,[isOver],[pages] );
overlayText( inputFile,text,[locationX],[locationY],[isUnderText],[fontSize],[font],[fontHexColor] );

Examples of usage

//Compress a PDF file.  NOTE: JPEG compression is used on any images in the PDF.
var unCompressedFile = plugins.file.showFileOpenDialog()
var compressedFile = plugins.servoyguy_pdf_pro.compress(unCompressedFile)
application.showURL('file:///' + compressedFile)
//Add pages numbers to a PDF.
var unNumberedFile = plugins.file.showFileOpenDialog()
var pageNumberedFile = plugins.servoyguy_pdf_pro.numberPages(unNumberedFile, 12, 520, 30, 'Courier', '#ff0033')
application.showURL('file:///' + pageNumberedFile)
//Merge 2 ore more PDF's into 1.
var pdf1 = plugins.file.showFileOpenDialog()
var pdf2 = plugins.file.showFileOpenDialog()
var mergedFile = plugins.servoyguy_pdf_pro.merge(new Array(pdf1.getAbsoluteFile(), pdf2.getAbsoluteFile()))
application.showURL('file:///' + mergedFile)
//Add metadata to the PDF, like Author.
var pdf = plugins.file.showFileOpenDialog()
var metaData = new Packages.java.util.HashMap()
metaData.put('Author','Servoy') 
var pdfWithMetaData = plugins.servoyguy_pdf_pro.addMetaData(pdf, metaData)
application.showURL('file:///' + pdfWithMetaData)
//Add password protection and security options to the PDF.
//NOTE: Passwords are case sensitive 
var unEncryptedFile = plugins.file.showFileOpenDialog()
var encryptedFile = plugins.servoyguy_pdf_pro.encrypt(unEncryptedFile, 'secretPassword', 'secretUserPassword', false, false, false, false, false, false, false, false, true)
application.showURL('file:///' + encryptedFile)
//Delete pages from the PDF.
var pdf = plugins.file.showFileOpenDialog()
//delete pages 3 and 5
var modifiedPdf = plugins.servoyguy_pdf_pro.deletePages(pdf, new Array(3, 5))
application.showURL('file:///' + modifiedPdf)
//Shrink the pages into smaller sizes to show multiple on 1 pages as handouts.
var pdf = plugins.file.showFileOpenDialog()
//create 3x5 handouts
var modifiedPdf = plugins.servoyguy_pdf_pro.createHandouts(pdf, 3, 5)
application.showURL('file:///' + modifiedPdf)
//Add an images as a watermark on every page, or the pages specified as a parameter.
var pdf = plugins.file.showFileOpenDialog()
var image = plugins.file.showFileOpenDialog()
var modifiedPdf = plugins.servoyguy_pdf_pro.watermark(pdf, image)
application.showURL('file:///' + modifiedPdf)
var pages = new Array()
pages[0] = '1'
pages[1] = '3'
pages[2] = '5'
var input1 = plugins.file.showFileOpenDialog(1,null,false,'pdf',null,'Select basic file')
var input2 = plugins.file.showFileOpenDialog(1,null,false,'pdf',null,'Select file for overlay')
var output = plugins.file.showFileSaveDialog('overlayedPDF.pdf','Save overlayed file')
var overlayedPdf = plugins.servoyguy_pdf_pro.overlay( input1, input2, output, false, pages )
//var overlayedPdf = plugins.servoyguy_pdf_pro.overlay( input1, input2, output )
//var overlayedPdf = plugins.servoyguy_pdf_pro.overlay( input1, input2, output, false, null )
//var overlayedPdf = plugins.servoyguy_pdf_pro.overlay( input1, input2, output, pages )
application.showURL('file:///' + overlayedPdf)
application.output('Overlayed file path: ' + overlayedPdf)
//Add text over every page at a 45 degree angle.
var pdf = plugins.file.showFileOpenDialog()
var modifiedPdf = plugins.servoyguy_pdf_pro.overlayText(pdf, 'DRAFT', 230, 430, true, 32, 'Helvetica', '#33ff33')
application.showURL('file:///' + modifiedPdf)