How to have working doclinks in PDF files

Notes documents can contain links (i.e. doclinks) to other Notes documents and preserving these links also in PDF is a challenging task. SWING PDF Converter converts Notes document links to special hyperlinks in the generated PDF files. Each such hyperlink will link to a corresponding PDF file (i.e. the rendering of the target Notes document that the original document link was referring to).

When considering the export of doclinks to PDF, there are two main usage scenarios:

1. Documents are exported to disk 2. Documents are exported to an online document repository (e.g. Microsoft SharePoint, IBM FileNet etc.)

1. Exporting documents to disk

When exporting documents to multiple PDF files using PDF Converter's toolbar icon, the conversion of document links will be enabled by default. In this case, PDF Converter will install an Adobe JavaScript file (swpdfc.js) on your machine and it will also create a doclinks.xml file in the destination folder you selected.

When a user clicks on the converted doclink in the PDF file, the installed JavaScript will read from the doclinks.xml file and if it finds a linked document in doclinks.xml, it will try to open the second PDF file using the location (i.e. the relative file path) which is read from the doclinks.xml file. This will work automatically on any machine where PDF Converter is installed. If you move your PDF files to a machine where PDF Converter is not installed, you will also need to copy the swpdfc.js file manually into the Javascript folder (inside the Adobe Reader installation folder).

Multiple Notes documents may also be exported to a Single PDF file with a Bookmarks view. In this case the document links will also remain functional within the scope of the PDF file (and only if both the source and the target Notes document have been exported to the PDF file).

Additional information is available in the following article:

pageAre Notes document links supported?

2. Exporting documents to repository

Preserving the links between generated PDF files (when the files are uploaded into a document repository) is currently possible only by writing a custom code and using our API functions. Before you start writing your code, you will also need to know what the exact URL of each PDF file will be after they get uploaded to a document repository. This is done by specifying root URL in your repository, under which all documents will be available according to its relative paths. Based on this information, you can configure our API functions so that when the PDF files are created, the doclinks will be converted to proper hyperlinks which will link to the correct PDF files on the server.

Each time you run a conversion job using our API functions in this way, PDF Converter will also create (or update if file is already there) a doclinks.xml file which contains "pairing" data (that matches linked Notes document to its PDF representation).

When the generated PDF files have been uploaded to the document repository and the xml file is in place, the users can start using the PDF files and clicking on the provided hyperlinks. When a user clicks on a hyperlink, the hyperlink will open a web page in the user's default web browser. This web page contains a JavaScript code which redirects the user to the linked PDF document.

Most of the process to convert the document links and the XML file is performed automatically, however the administrator will still need to upload the "doclinks.xml" and the "doclinks.html" file to a specified URL (DocLinksIndexUrl), after conversion is finished. Both files will be available in the user defined folder on the disk (this is the same folder where Notes documents will be exported to as well).

Example of an indirect link which replaces a Notes doclink in the resulting PDF file:Structure: <DocLinksIndexHtml>&db=<DB_REPLICA_ID>&doc=<DOC_UNID>

Pairs of Document ID - relative URL in doclinks.xml

<?xml version="1.0" encoding="UTF-8"?>
    <element id="C1257B48003C4B53-224DF71697F4E942C125794300515040">
        <location>SWING PDF Converter v5 - WORK/Samples/Wheel Trucks, ACME Inc..pdf</location>
    <element id="C1257B48003C4B53-D3DF6E62619150C0C1257919004CC1DC">
        <location>SWING PDF Converter v5 - WORK/Samples/TEST 3.pdf</location>
    <element id="C1257B48003C4B53-934D5EB20B88DADFC12577F100491125">
        <location>SWING PDF Converter v5 - WORK/Samples/TEST - SWING Integrator - Office integration for Lotus Notes Domino.pdf</location>
    <element id="C1257B48003C4B53-5C44B844BF75F633C1257919004BFFDC">
        <location>SWING PDF Converter v5 - WORK/Samples/SWING Integrator - Office integration for Lotus Notes Domino.pdf</location>

Code sample

LotusScript code samples > Doclinks sample for repository

pageDoclinks sample for repository

SwPDFSettings class properties

Conversion-level properties


String. Root folder on disk, where all the PDF documents will be available at. This folder is used to evaluate relative paths to linked documents. For example: if DocLinksDir is set to "c:\PDFExport" and DocLinkLocation is set to "c:\PDFExport\Documents\doc1.pdf", relative path will be evaluated to "Documents/doc1.pdf". This relative path will then be used together with DocLinksBaseHref property, to open correct document link. Also, both "index.html" and "data.xml" will be available in this folder.


String. Location of "index.html" (or its code), that will be placed in every PDF file containing document links. This URL must be available at all times if you want doclinks functionality on the web server or repository (for example Sharepoint). If your PDF files are on local machine then Adobe JavaScript is used to open doclinks and this setting need to be empty.


String. Base location where generated PDF files will be stored, for example """. It will be used by "index.html" to generate actual link to a PDF document another document is linking to.

Document-level properties


String. Generated PDF file path, that will be used as a reference for all documents that contains links to the currently converted document. If document links are enabled, this property needs to be set for every single document that is being exported and should contain the full path to a disk location where generated PDF file is stored.

Last updated