This document will describe briefly the usage of activePDF within a Lotus Domino application. The purpose of this document is to give you an introduction about integrating both software products and give you an impression about the possibilities.
Where to start?
Domino is a great rapid development- and (web) server softwareproduct to capture and display text and rich text information from and to users.
Rich text (images, pdf’s) in Domino should be made ready for display. There is no dynamic composition.
activePDF is a great tool for creating printable files and is based on single line commands. You can add texts and images, drawing boxes and stitching pdf files.
Especially the activePDF Toolkit is the Swiss Army Knife for PDF – virtually any PDF manipulation task can be automated through Toolkit’s robust API. With activePDF Toolkit you can:
- Apply watermarks and stamp images and text into PDF files.
- Merge multiple PDF documents into a single PDF file, adding bookmarks for easy navigation.
- Dynamic PDF form-filling – populate PDF forms with database data and generate form fields on the fly.
- Detect PDF tampering through Toolkit’s fingerprint technology.
- Generate over 20 standard barcode types without requiring third-party utilities or individual barcode fonts.
- Add dynamic headers, footers and page numbering to PDF documents.
- Convert to PDF from over 40 image types on the fly and embed Flash® files within PDFs.
- Digitally sign PDF files and secure documents through PDF encryption.
Would combining these two worlds result in a best of both worlds: dynamically created digital files ready for printing?
The idea is to use Domino as the tool that manages the integration of both products. Via notes documents that describe all the links and commands to activePDF the configuration is defined.
Domino is also the engine that captures the user preferences (which template, selections) and user information entries (text lines) which will be presented in the final result: a user customized PDF.
Everything will be presented within a web site, which is also based upon Domino.
In this case I created a Domino application that enables the users to create highly modifyable leaflets and send their creation as a PDF file with high resolution to a printorder database. From that database the orders could be easily transferred to a que on a professional digital printer.
The setup – activePDF
I installed the activePDF software on the same machine that also operates the Domino server. If you have business critical tasks running on that machine I would advice you to look for alternatives, you never know. But since you probably start working on a test-server…
The setup – Database profile document
I have one database profile document to configure the application within the Domino environment. The document stores information like:
- an extract folder where to extract the initial template PDF’s
- a preview folder where to store the PDF’s that are generate for display (low resolution)
- a final folder where to store the high resolution PDF’s that will be embedded in a new notes document (a printorder document)
- location of a batch program that cleans up all the folders scheduled
- location of the database of the printorders database
Note 1: activePDF works with picking and storing files on a (window) directory structure. Therefor we need to declare where these files can may be created or can be found.
Note 2: the aim for this project is to generate more printorders. The result of a visit is preferably a generated PDF file that the user wants to place for a printorder. This printorder we place in a different Notes application. Describing the process of placing the order into a second database is out of the scope of this document.
Note 3: everything is presented to the user via a webinterface. How the website is set up and how the website elements are implemented within the Notes application will also not be described in this document.
The setup – Leaflet profile
Since the application is a corporate application and users are mostly not aware of the corporate guidelines I created a set of predefined leafets. This also saved the users time, because mostly the part they want to have personalised where the textboxes and the graphical images. All the predefined templates where Notes documents.
Elements on a template:
- a heading
- a single-line subheading
- a multi-lines subheading
- a main image
- thumbnail images
- company logo
- multi-lines text boxes
- drawings (boxes, lines, etcetera) with activePDF Toolkit
Based upon a template one or more of the elements described above appeared.
Basic user navigation
When a user entered the site they have the following options:
- directly create a new PDF file
- view some prefined leaflets based upon the various templates
- view predefined leaflets created by others (with the option to re-order the PDF)
- login and visit the uses history (hoping this will result in some additional re-ordering of previous work)
Creating a new PDF file
Since this is the most exciting part of the process I will only describe this part of the order process. When a user opens a new ‘createPDF’ form he can select from which template he wants to create a personalized PDF.
After selecting a template all the possible elements on the template are being displayed and for each element (a subform) the user has the option to edit it via text-boxes or selecting graphical material (images). When desired the user can uplaod his own graphical material.
When the user thinks he is done he can push a ‘preview’ button and a PDF file in low-resolution (for saving bandwidth) is presented. If the user is not satisfied with the result he can return the ‘createPDF’ form and improve his entries. When he is finaly satisfied the user can select an ‘order’ button and the user is asked to register for the order process or to login to work with saved user information. What a charm!
Into the technique
Important things you need to know about activePDF:
- activePDF works with single command lines. Via lotusscript we can direct activePDF to perform certain actions.
- Because the application runs in a website the steering of activePDF is being done via agents that run on webquerysave or webqueryopen events. Via loops or conditional statements we can make the command lines repetitive as much as we like.
- activePDF works on X and Y coordinates which are from bottom left to upper right. This is important in order to place the design elements such as text and images correcly.
- activePDF is not capable to calculate the distances between elements. For example: it cannot read the end position (y coordinate) of a multi-line textbox. Therefore if we would like to append an image on the bottom of a multi-line textbox dynamically this is not possible.
Example opening an ActivePDF session
In order to be able to work with activePDF via Domino we need to create a session and define activePDF as a new object:
Set varPDF = CreateObject( “aptoolkit.object” )
varPDF.OutputPageHeight = intPaperHeightRec
varPDF.OutputPageWidth = intPaperWidthRec
Call varPDF.OpenOutputFile( strPDFName )
- first we start a session
- declare the width and height of the output PDF (settings defined in a leaflet template document)
- the variable strPDFName contains the windows directory reference and a filename with .pdf extension.
Example inserting an image
Call varPDF.PrintImage( strImageToAttach, intX, intY, intHeight, intWidth, 1)
- via the PrintImage statement an image will be attached.
- StrImageToAttach is a variable that can be a reference to an image from the image-bank that is within the application or an image that the user has uploaded.
- IntX and IntY are the x and y start-coordinates of the image
- IntHeight and IntWidth define the width and height of the image
Example inserting a text
Call varPDF.SetFont( strFontName, intFontSize)
Call varPDF.PrintText( intX, intY, strPrintText )
- via the SetTextColor statement we set the color of a text, this is done in RGB values. We can also add a gray-scale value.
- via the SetFont we set a font type. The type of the font must be installed on the machine
- via PrintText we actually add the text, in the variable strPrintText we have the user’s input
Example inserting a multi-line text
Inserting a multi-line text is pretty similar to inserting a single text line. You declare the font color, type and size. Only the second line differs:
Call varPDF.PrintMultilineText ( strFontName, intFontSize, intX, intY, boxWidth, boxHeight, strPrintText, 0)
For the multi-line textbox you extra declare the width and height of the textbox.
Indeed activePDF and Domino can work together! Still there is surely something missing like a 100% free editor function for users like I have seen in several Flash applications. This would allow the users to add text and images, as much as they want, and where they want.
Nevertheless you can facilitate for your users the possibility to create high-end, print-ready files according to the guidelines and procedures within your organization.
The fact that activePDF cannot interact on the appearance of elements as result from user data entries (for example an image on the bottom of a multi-line textbox) makes it not a flexible tool.
Also the fact that data must be send back and forward from the user to the server and vice versa makes it not preferred solution for applications with many users.
Nevertheless with the buildup experience of the two software products it is possible to create in a short period of development-time a fully web-based, user-friendly, attractive, adjustable, maintainable solution (thanks to Domino) for dynamically creating high-quality, printable image files (thanks to activePDF) according to rules that are setup on behalf of corporate guidelines!
Unfortunately this website is not a Domino based weblog. Unfortunately this weblog is being served on a public server. This makes the demonstration of some solutions not possible.
However if you are interested in more information, screenshots or an example application please contact me at email@example.com.
Applications I have worked on are:
- a generator for business cards
- a website to create leaflets / posters
If you have experience with working with the two worlds I am very interested to share our experiences!
Thank you for reading.
KR // Patrick