PDF Converter for Notes
DocsSupport RequestWebsite
  • PDF Converter for Notes
  • Installation / uninstallation
    • Installing and activating
      • Installing PDF Converter toolbar icon
      • Installing PDF Converter toolbar icon for multiple users
      • Installing PDF Converter on server for automated archiving
      • Installing PDF Converter on Linux server
      • Offline license activation
      • PDF Converter sample on web
      • System Requirements
    • Uninstalling
      • Removing the PDF Converter toolbar icon
      • Removing the PDF Converter toolbar icon for multiple users
      • Removing PDF Converter completely from your system
    • Upgrading
      • Upgrade PDF Converter to a new release
      • Upgrade PDF Converter design elements in a custom application
    • Release History
  • Getting started
    • PDF Converter terminology
      • PDF package
      • PDF attachments
      • Separate PDF files
      • Flat vs. structured document export
      • Single PDF file with a bookmark view
      • Alternate Notes forms
      • Archiving jobs
    • Screencasts
    • Settings
      • General Settings
      • PDF Settings
      • Toolbar Icon Settings
    • Converting client-side
      • How to export emails to a PDF package
      • How to append emails to a PDF package
      • How to export emails to multiple PDFs
      • How to export mail folders to PDF
      • How to export view categories to PDF
      • How to export all emails to PDF
      • How to export parent-child documents
      • How to manage PDF document settings
      • How to export Notes metadata
      • How to export documents to PDF/A format
      • How to convert attachments to PDF
      • How to export attachments to disk
      • How to set PDF headers and footers
      • How to reduce PDF file size
      • How to use alternate forms
      • How to create a naming rule for the PDFs
      • Summary of export options
    • Converting server-side
      • How to export multiple databases to hard disk
      • How to schedule Notes email export to PDF
      • How to export a custom/programmatic document selection
      • How to export Notes metadata
      • How to classify PDF records using folders
      • How to run post-processing tasks on the PDF files
      • How to apply PDF settings to an archiving job
  • How to...
    • How to use the conversion dialog
    • How to set up a custom naming convention for PDF files
    • How to add header and footer to a PDF document
    • Using alternate forms
    • How to convert a document collection using multiple alternate forms
    • How to convert password protected HTML content
    • How to disable HTTP stream
    • How to enable international characters
    • How to enable/disable the low-level renderer
    • How to export documents ordered as in Lotus Notes view
    • How to find your Notes Installation and Notes Data directories
    • How to enable single category export using high level renderer [embedded views]
    • How to manually activate an API enabled database
    • How to reduce the PDF file size
    • How to search a PDF package
    • How to search PDF attachments
    • How to see your PDF Converter version number
    • How to send error-prone documents/emails to the Support
    • How to set custom PDF settings from LotusScript
    • How to use alternate forms in an archiving job
    • How to set PDF security
    • How to have working doclinks in PDF files
  • Tips / miscellaneous
    • About PDF metadata
    • Are Notes document links supported?
    • Types of output
    • Attachment options
    • Can I export OLE objects to PDF?
    • Deployment check-list
    • Disabling access for non-administrators
    • Do I need to have the latest JRE (Java Runtime Environment) installed on my Workstation/Server?
    • Exporting large sets of documents/emails using the toolbar icon
    • Extracting ZIP archive files
    • How to enable Microsoft Office conversion on Domino server
    • How to enable PDF search in Windows (64-bit)
    • How to get the SharePoint repository ID
    • Java files (jar) list
    • Merging attachments with PDF forms
    • PDF filename Unicode compliance tips
    • PDF/A format description
    • Product limitations
    • Single-Click Exports
    • There's no "Show Java Debug Console" option in my Lotus Notes client
    • What is the SWING PDF Converter installation footprint?
    • Where can I find my attachments?
    • Which view/folder types are supported
  • For developers
    • Enabling your applications
    • API Design elements description
    • LotusScript API reference
      • Class SwPDFDocument
        • Public Function AppendTo(DestFilePath As String)
        • Public Function GetAsRTItem() As NotesRichTextItem
        • Public Function GetAsRTItemEx(attachmentName As String) As NotesRichTextItem
        • Public Function GetFilePath()
        • Public Function GetMetadata() as String
        • Public Function IsCollection() As Boolean
        • Public Function Recycle()
        • Public Function SaveToFile(FilePath As String)
      • Class SwPDFCreator
        • Public Function GetError() As SwPDFError
        • Public Function GetVersion() As String
        • Public Function Init(LicenseKey As String) As Boolean
        • Public Function InitWithActivationResponse(ActivationResponse As String) As Boolean
        • Public Function LoadSettingsFromUNID(PDFSettingsUNID As String, UseGeneralSettings As Boolean) As Bo
        • Public Function ProcessDocCollection(dc As NotesDocumentCollection, DbView As String) As SwPDFDocume
        • Public Function ProcessDocCollectionFromFile(FilePath As String, DbServer As String, DbPath As Strin
        • Public Function ProcessDocument(doc As NotesDocument) As SwPDFDocument
        • Public Function ProcessFolders(dbSrc As NotesDatabase, FoldersList As Variant, IncludeResponses As B
        • Public Function ProcessRTItem(rtItemSource As NotesRichTextItem) As SwPDFDocument
        • Public Function ProcessUrl(url As String) As SwPDFDocument
        • Public Function ProcessViewCategories(view As NotesView, CatList As Variant, IncludeResponses As Boo
        • Public Function SetPdfProperties(Title As String, Subject As String, Author As String, Keywords As S
        • Public Function SetWatermarkFont(fontFamily As String, size As Integer, style As Integer, colorR As
        • Public Function SetWatermarkImage(filePath As String, position As Integer, margin As Double) - Learn
        • Public Function SetWatermarkText(wmText As String, rotation As Double, position As Integer, margin A
      • Class SwPDFSettings
        • Public Function SetHTTPProxy(proxyHost As String, proxyPort As Integer)
        • Public Function SetCustomMetadata(CustomMetadata As Variant, CustomMetadataOnly As Boolean) As Boole
      • Class SwPDFRegistration
        • Public Function GetVersion() As String
        • Public Function GetLicense() As SwPDFLicense
        • Public Function Register(LicenseKey As String) As Variant
      • Class SwPDFLicense
      • Class SwPDFProgress
        • Public Function GetCurrentIndex() As Integer
        • Public Function GetStatus() As Integer
      • Class SwPDFError
    • LotusScript code samples
      • Button on form
      • Button on view
      • Add metadata
      • Add custom header/footer to PDF document
      • PDF conversion on the Web
      • Convert large number of documents
      • Change document orientation
      • Convert single document from UI
      • Doclinks sample for repository
      • View to PDF package
  • Troubleshooting
    • Troubleshooting Guide
    • Error messages
      • Error - Type mismatch in method OP_CHECK_TOS_INST AINSTANCE found, Unknown expected
      • Error - Cannot write or create file (file or disk is read-only)
      • Error - DLL issue on 64-bit servers
      • Error - Domino HTTP Error Loading Java Virtual Machine
      • Error - Exception in thread "Launcher: SwCreatePDF" java.lang.NoClassDefFoundError: -SOME CLASS-
      • Error - ExceptionConverter: java.security.NoSuchAlgorithmException
      • Error - INITIALIZE ERROR: EXTRACTJAVARESOURCES (nn) : 91 - Object variable not set - INIT (nn) - Lea
      • Error - java.security.AccessControlException: Access denied ([SOME CLASS EXCEPTION]) - Learning Cent
      • Error - ReferenceError: openLInkPriv is not defined
      • Error - swllrend.dll corrupted or not extracted
      • Error - SWPDFSAVETODISK (29) : 53 - File not found
      • Error - There is another PDF conversion process already started
      • Error - Type mismatch (13)
    • General issues
      • Archiving jobs agent timeout
      • Concurrent execution issues
      • Conversion speed is slow
      • Document links not working
      • Email images do not appear in PDF
      • Header and footer not visible in my emails
      • Header and footer not visible or partially visible
      • How to enable SWING PDF Converter with Symantec Endpoint Protection (SEP)
      • Numerous "Trust to..." prompts appearing
      • PDF toolbar icon does not appear after installation
      • PDF toolbar icon not shown in IBM Notes 9 toolbar
      • PDF toolbar icon is still on my toolbar after uninstalling
      • Select categories / folders applet is failing to start
      • ZIP files can not be detached from PDF
      • PDF fonts not embedded for Asian/Arabic documents
      • Thai symbols not shown in PDF document
    • History log
      • Archiving job logs
      • Conversion and error logs
      • Notes crashes during conversion
  • Seascape for Notes
  • Support
    • Support Request
    • Premium Export Services
Powered by GitBook
On this page

Was this helpful?

  1. How to...

How to set custom PDF settings from LotusScript

Create instance of SwPDFSettings class: Dim pdfSettings As New SwPDFSettings

Then, set values that suites your needs. For example: pdfSettings.MarginLeft = 5

Finally, apply settings to SwPDFCreator class: Set swPDF.PDFSettings = pdfSettings

Here is the full code example that can be used in form action on any form:

Option Declare
Use "SwPDFMain"

Sub Click(Source As Button)
    Dim w As New NotesUIWorkspace, doc As NotesDocument
    Dim swPDF As New SwPDFCreator, swPDFDoc As SwPDFDocument, pdfErr As SwPDFError, pdfSettings As New SwPDFSettings, DestFilePath As Variant

    On Error Goto ErrorHandler

    If w.CurrentDocument.IsNewDoc Then
        Msgbox "Document must be saved first in order to convert it to a PDF.", 0+48, "WARNING"
    Else
        ' Get destination file path
        DestFilePath = w.SaveFileDialog(False, "Save document", "PDF Files (*.pdf)|*.pdf", "", "test.pdf")
        If Not Isempty(DestFilePath)Then
            If Dir$(DestFilePath(0)) <> "" Then
                dialogRes = Messagebox(DestFilePath(0) & " already exists." & Chr$(13) & Chr$(10) & "Do you want to replace it?", 4, "Save document")
                If dialogRes = 7 Then
                    Exit Sub
                Else
                    Kill DestFilePath(0)
                End If
            End If

            'Get currently opened Notes document
             Set doc = w.CurrentDocument.Document

            'Initialize PDF creation process; license key is required
            If swPDF.Init("<ADD YOUR LICENCE HERE>") Then

                pdfSettings.MarginLeft = 5
                'Add all settings here
                Set swPDF.PDFSettings = pdfSettings
        
                'Convert doc to PDF
                Set swPDFDoc = swPDF.ProcessDocument(doc)
    
                If Not swPDFDoc Is Nothing Then
                    'Finally, save generated PDF to a file on disk
                    Call swPDFDoc.SaveToFile(DestFilePath(0))
                    Msgbox "PDF successfully created in " & DestFilePath(0)
                Else
                    'There was an error in PDF conversion
                    Set pdfErr = swPDF.GetError()
                    Msgbox pdfErr.Message, 0+16, "ERROR"
                End If
            Else
                'There was an error in PDF initialization
                Set pdfErr = swPDF.GetError()
                Msgbox pdfErr.Message, 0+16, "ERROR"
            End If

         End If

    End If

    Exit Sub

    ErrorHandler:
        Msgbox "Error " + Error + " -> " + Erl
        Exit Sub
End Sub

List of available settings in the SwPDFSettings class:

PDFSettingsUNID
    String. Read/write. Universal ID of the document containing PDF settings (must be created with ".PDFSettings" form).
    If set, it automatically overrides all the other corresponding SwPDFSettings options.

PageHeight
    Double. Read/write. Page height in inches; defaults to 11in.

PageWidth
    Double. Read/write. Page width in inches; defaults to 8.5in.

MarginTop
    Double. Read/write. Margin top in inches; defaults to 1in.

MarginLeft
    Double. Read/write. Margin left in inches; defaults to 0in.

MarginBottom
    Double. Read/write. Margin bottom in inches; defaults to 1in.

MarginRight
    Double. Read/write. Margin right in inches; defaults to 0.5in.

AlternateForm
    String. Read/write. Name of the alternate form that will be used for PDF conversion instead of the form documents
    has been created with.

AlternateFormsCol
    Variant. Read/write. Multi-value string list of alternate forms that will be used with document collections. Each
    element in this list should contain actual form name and alias form name, separated with "|" character (e.g. "FormName|AliasFormName").
    If document from collection is created with a form that is contained in this property, corresponding alias form will
    be used instead. If form is not contained within this property, AlternateForm property will then be used (if defined;
    otherwise, original form will be used to create PDF).

IncludeAttachments
    Boolean. Read/write. True, if Notes document attachments needs to be embedded to a resulting PDF file; otherwise False.

AttachmentsOption
    Integer. Read/write. This property will be used only when IncludeAttachments is set to True. Possible values
    are: SWPDF_ATTACH_NATIVE (default), SWPDF_CONVERT_AND_ATTACH, SWPDF_CONVERT_AND_APPEND, SWPDF_ATTACHMENTS_ONLY

IncludeWebAttachments
    Boolean. Read/write. If set to True, PDF document will also contain "web attachments" (attachments that are not associated with any RTF).
    Default is False.

UserPassword
    String. Read/write. Password required to open PDF document.

MasterPassword
    String. Read/write. Password required to change PDF document.

Enable128bitEncryption
    Boolean. Read/write. True, if encryption level needs to be set to 128-bit RC4 (Acrobat 5.x¸ 6.x); defaults to False,
    which is 40-bit RC4 (Acrobat 3.x¸ 4.x) encryption. This property takes effect only when either UserPassword or MasterPassword is set.

EnablePrinting
    Boolean. Read/write. If set to False, PDF document printing will be disabled; default is True. This property takes effect only
    when either UserPassword or MasterPassword is set.

EnableChanging
    Boolean. Read/write. If set to False, modifying PDF document content will be disabled; default is True. This property
    takes effect only when either UserPassword or MasterPassword is set.

EnableCopying
    Boolean. Read/write. If set to False, PDF document copying will be disabled; default is True. This property takes effect only
    when either UserPassword or MasterPassword is set.

EnableComments
    Boolean. Read/write. If set to False, PDF document comments will be disabled; default is True. This property takes effect only
    when either UserPassword or MasterPassword is set.

EnableFormFields
    Boolean. Read/write. If set to False, PDF document form fields will be disabled; default is True. This property takes
    effect only when either UserPassword or MasterPassword is set.

HTMLContainer
    String. Read/write. Name of the field on document that will contain HTML, that needs to be converted to PDF.
    Note that this field should be visible in read mode in order to get PDF with rendered HTML.

EnableFontEmbedding
    Boolean. Default is False. In order to enable font embedding, SystemFontsDir parameter must also be set.

EnableCJKSupport
    Boolean. Set this property to True, if Chinese, Japanese, Korean or Vietnamese characters are used. Default is False.

SystemFontsDir
    String. System folder where fonts are stored (e.g. c:\windows\fonts on Windows OS).

PreviousHow to send error-prone documents/emails to the SupportNextHow to use alternate forms in an archiving job

Last updated 3 years ago

Was this helpful?