Integration Domino and activePDF

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.

For more information about both products visit the official websites for IBM Lotus software and activePDF.

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

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.

The case

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
  • ectetera

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.SetTextColor(strColorRed,strColorGreen,strColorBlue,strColorGrey) 
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.

Some conclusions

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!

Demo

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 info@quintessens.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

Advertisements

5 thoughts on “Integration Domino and activePDF

  1. mike kenny 2007-November-4 / 2:42 am

    Hi Patrick,

    I’m working on a project were we would like to collect data via facile forms on a Joomla site (php, mysql). Do you have any ideas on populating an existing pdf application with data collected from the facile forms (e.g., name address, employer, etc. – like a mortgage application from a lender)

    Mike

  2. quintessens 2007-November-4 / 12:45 pm

    sorry mike, but your questions goes above my head…

  3. mike kenny 2007-November-5 / 5:23 am

    I guess to simplify, does anything like activePDF work well in Joomla?

  4. quintessens 2007-November-5 / 10:31 am

    OK Mike, I like simplified questions… well I do not know. How I use activePDF now within Domino applications is that I send command to activePDF via lotusscript, since it is a basic alike programming language activePDF knows how to interpretate it. In Joomla you probably use PHP.

    I cannot answer what you need to know as a PHP developer about VB and what they have in common or how you can VB alike command in PHP to activePDF. Probably you need to read documentation in the developer kit from activePDF or contact them immediately with your question.

    for more a better comparison between LotusScript for Visual Basic programmers take a look here:

    http://www.redbooks.ibm.com/redbooks/pdfs/sg244856.pdf

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s