Easily create table of contents with n2pdf
Did you already know that you can create a clickable and adjustable table of contents with n2pdf? You want to create a manual or just convert a number of documents e. g. structured in the report format, into the PDF? n2pdf is the perfect solution for that!
With its numerous functions n2pdf enables you to create a PDF file, which can simplify the work outside of Lotus Notes for you, your colleagues and also your customers, considerably. You can transfer many functions “held dear” into the PDF, so that the “look & feel” corresponds with that of the common Lotus Notes environment. … and if that wasn’t enough, n2pdf does more – table of contents on the basis of your documents.
Note: All examples mentioned here can also be found in the sample database “n2pdf_TOC.nsf”, which comes with n2pdf.
How do you activate the creation of the table of contents?
This option in your script activates the creation of your table of contents.
Call N2PDFSetOption ( JobID, N2PDFOPTION_TOC, N2PDFVALUE_True, “” )
In order that n2pdf knows, which content it is suppose to convert into entries in your table of contents, you have to define the desired content. A header makes sense here.
Here an example from a n2pdf sample database:
Example: The following text…
Welcome to Lotus Notes! Lotus Notes gives you instant access to all the information that is
[TOC:1] What is Lotus Notes?
Lotus Notes is powerful, multi-faceted software for
[TOC:2] Getting Help
Online Help is available for most views and dialog boxes. You can …
… is converted into this table of contents:
1. Getting Started
2. What is Lotus Notes?
2.1. Getting Help
The TOC in parentheses shows n2pdf that the following text is an entry in the table of contents. The number after the colon indicates the level structure – that way sub-categories of a main category can also be displayed
Alternatively you can also submit the required declaration during the transfer of the respective notes fields.
Here is also an example:
There is a field named “ChapterLevel” for the level and “ChapterTitle” for the title in the document. Afterwards the further content is read from the RichText field “Body”.
TOCText = “[TOC:” + Trim$(CStr(doc.ChapterLevel(0)))+”]” +_ CStr(doc.ChapterTitle(0)) + Chr(13)
Call N2PDFAddContent ( JobID, N2PDFVALUE_CONTENT_BODY,N2PDFVALUE_CRLF_AFTER, TOCText )
Call N2PDFAddRTContent ( JobID, N2PDFVALUE_CONTENT_BODY, PageBreak,_
db.Server, db.FilePath, doc.UniversalID, “Body”)
There are many more options available for formatting. You can for example add a header or a footer to the table of contents or you can give the level structure a different numbering form, in order to use e. g. Roman numerals.
At this point we would like to explain, how you can further enhance the visual appearance of the created table of contents.
For adjustment and formatting purposes n2pdf offers a template model, which enables you to give each level its own look.
Thus you can define font, font size, font color and much more.
The following parameter indicates, which level you want to edit:
… and now practical use:
Example – Set font “Verdana” and font size “10” for the first level:
Call N2PDFSetOption ( JobID, N2PDFOPTION_PARAGRAPH_FONT_NAME,_
“Verdana”, N2PDFVALUE_TOC_LEVEL1_PARAGRAPH_NAME )
Call N2PDFSetOption ( JobID, N2PDFOPTION_PARAGRAPH_FONT_SIZE,_
“10”, N2PDFVALUE_TOC_LEVEL1_PARAGRAPH_NAME )
Here is a possible result:
Just test the possibilities of n2pdf for yourself! SoftVision offers numerous support options as e. g. the n2pdf online help, as well as a variety of sample databases.
Of course our technical support is available anytime and free of charge.
We hope you enjoy testing our product and wish you a lot of success!