DominoPDF return codes

DominoPDF uses a method called DoPDF(), which returns an integer value indicating whether the procedure worked or failed.

The return code can be captured and used as appropriate in LotusScript.

The DoPDF() method returns;

0 - Process was a success.

-1 - Process failed.

DominoPDF will return -1 if a non-existent URL (404 Error) is encountered.

For example;

Dim iRet as Integer

iRet = DoPDF(sURL, sPDF, "")

if iRet <> 0 then
'Handle error here...
End If

Externally Hosted Images Are Not Displayed

Notes / Domino has a setting for Image Security which prohibits showing remote images. "To ensure privacy, do not show remote images without my permission."

DominoPDF will respect this setting and therefore not display externally hosted images.

Ensuring the option is not enabled will resolve the issue.

File and Directory Permissions

As DominoPDF runs under the Domino restrictions you *will* need to ensure that the file path where you specified the PDF to be saved has appropriate permissions at the operating system and Domino restriction levels.

How can I control margins in DominoPDF?

You can control margins by using the setting paramater in the DoPDF method of DominoPDF.

For example;

Call DoPDF(sURL, sPDF, "LeftMargin=10;RightMargin=10;TopMargin=10;RightMargin=10")

By default the measurements are in MM. If you like you can specify in inches.

For example;

Call DoPDF(sURL, sPDF, "LeftMargin=1;RightMargin=1;TopMargin=1;RightMargin=1;UseInches=True")

How can I stamp a PDF file?

The DomPDFAddText() method allows text stamping and you can control the font size by adding a <font> tag into the text.

For example;

Call DomPDFAddText("c:\test.pdf", "<font size=30>Confidetial</font>", "1", 10, 20, 400, 0, 30)

How do I add page numbers?

There are a couple of ways to add page numbers to PDF files generated from DominoPDF.

1. Use HTMLHeader or HTMLFooter settings.

To add page numbering to a PDF you can control it via the settings option in the DoPDF() method.

Call DoPDF(sURL, sPDF, "HTMLFooter=Page {$PAGE} of {$PAGECOUNT ;BottomMargin=20")

The HTMLFooter= option controls the content of the footer with reserved tags for {$PAGE} and {$PAGECOUNT} and the BottomMargin= option controls the height of the footer area so the text is displayed correctly (by default in MM unless UseInches=True is specified).

2. Use DomPDFPages() and DomPDFAddText() methods.

If you want to add page numbers to a PDF after it has been created or add page numbers to any PDF (not necessarily created with DominoPDF) you can use a combination of the DomPDFPages() and DomPDFAddText() methods.

DomPDFPages() will get the page count of any PDF.

iPage = DomPDFPages(sPDF)

DomPDFAddText() can "stamp" text on any PDF.

for t = 1 to iPage
Call DomPDFAddText(sPDF, "Page " & CStr(t), CStr(t), 10, 10, 50, 0, 9)
next t

How do I control / expand section?

On the web you can control section expanding by passing an operator in the URL.

In the DominoPDF installation you can find a PDF named URL Cheat Sheet which details all the options for Domino URLs, including expanding sections etc.

(You can also find it on the web here http://www-128.ibm.com/developerworks/lotus/library/ls-Domino_URL_cheat_sheet/)

As an example;

To collapse a section

http://domain/test.nsf/section?ReadForm&ExpandSection=-1,-2

To expand a section

http://domain/test.nsf/section?ReadForm&ExpandSection=1,2

How do I enable DominoPDF Logging?

Call DoPDF(sURL, sPDF, "LogFile=c:\dompdf.log.txt")

After the method call is made the log file should exist and can be examined accordingly. For production usage logging should be disabled.

How do I force / control page breaks in DominoPDF?

DominoPDF supports page breaks via the CSS page-break-before/inside/after styles.

You can either use style-sheets in your Notes document design, for example;

<style type="text/css">
<!--
.break {page-break-after: always}
-->
</style>

Or a simpler method of in-line HTML, for example;

<p STYLE="page-break-after: always"></p>

By entering this CSS style in your document HTML DominoPDF with recognise the style tags and force a page break accordingly when rendering to PDF.

Page 4 of 7

JoomShaper