All about Lotus Domino Development (AaLDD)

Demo integration Lotus Notes and activePDF

Posted in Applications, activePDF, lotus Domino, lotus notes by quintessens on April 27th, 2007

I received some questions on a previous article on integrating Lotus Notes / Domino with activePDF.

A quick wrapup: yes via LotusScript you can make a connection with activePDF’s server products (in this case I use activePDF server and activePDF Toolkit professional which you can download for evaluation here). With activePDF you can create, stitch, write on PDF’s. Lotus Notes / Domino we use as web-engine, configurator & database to store created PDF’s for furture handling.

In the demo itself I only demonstrate how to write a text-line to a PDF but in the original article you find more examples how to add text area’s, pictures & drawings to a PDF.

How to get it running?

  • Copy the database to your data directory and open the database in Notes.
  • In the ‘Edit DB Settings’ menu-link (which you see if you apply ‘Enforce consistant ACL on all replicas’) you enter a correct path where you want to extract files to.
    • in this path we extract the template PDF we use with already added a nice background
    • this path we also create new PDF’s in which we later delete when we embed them in a Notes document
  • In the DB Settings profile document we also specify which fonts are available we can use in the card profile document. The card profile documents are a more or less the card templates the user can create a PDF from.
    • In the database there is already a card profile document created so you can use that in the demo.
  • Open the database in a browser and ‘F-CardRequest?OpenForm’ in the URL after the database filename.

This is what you will be presented:

card request form

After filling in the requested fields a PDF will be created and presented to you. The result might look like this: (card sample PDF).

I have uploaded the database somewhere and if everything goes you right you should be able to download it here. Please let me know if you have any difficulties opening the location.

So what are possible business solutions?

Solutions I have worked on are:

  • a business cards application
  • a poster / leaflet application where dealers can create personalized marketing material based upon defined corporate standards
  • an application to print out certificates after a workshop
  • ‘new baby born’ cards

Well basically let your creative imagination run free :-)

The nice part of Lotus Notes is that you can distribute the (Notes) documents containing the PDF or add an ordering form to it.

The downpart is that if I understood it correctly activePDF uses a ‘bottom up’ approach so it locates a x-y location from the left bottom of the PDF and writes the information to it. It does not count if the content of this information oversizes the bottom of the PDF file. So it will just keep on writing one one single PDF file.

Integration Domino and activePDF

Posted in Applications, activePDF by quintessens on October 22nd, 2006

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