Doclinks sample for repository
Sub Initialize
    Dim s As New NotesSession
    Dim db As NotesDatabase
    Dim dc As NotesDocumentCollection
    Dim doc As NotesDocument
    Dim swPDF As New SwPDFCreator
    Dim swPDFDoc As SwPDFDocument
    Dim pdfErr As SwPDFError
    Dim savePath As String, fileName As String
    On Error GoTo ErrorHandler
    Set db = s.CurrentDatabase
    Set dc = db.Unprocesseddocuments
    Set doc = dc.Getfirstdocument()
    savePath = "c:\htdocs\"
    swPDF.Init("<ENTER YOUR LICENSE KEY>")
    'Enable document links
    swPDF.PDFSettings.EnableDocLinks = True
    'Set doclinks settings
    swPDF.PDFSettings.DocLinksDir = savePath
    swPDF.PDFSettings.DocLinksIndexUrl = "http://www.mysever.com/doclinks.html"
    swPDF.PDFSettings.DocLinksBaseHref = "http://www.myserver.com"
    While Not (doc Is Nothing)
        fileName = doc.Title(0) & ".pdf"
        swPDF.PDFSettings.DocLinkLocation = savePath + fileName
        Set swPDFDoc = swPDF.ProcessDocument(doc)
        'Finally, save generated PDF
        Call swPDFDoc.SaveToFile(savePath + fileName)
        Set doc = dc.Getnextdocument(doc)
    Wend
    Exit Sub     
Errorhandler:
    Set pdfErr = swPDF.GetError()
    MsgBox"An error occurred: (" & pdfErr.Code & ") " & pdfErr.Message & " - line " & pdfErr.Position
    Resume Next
End SubLast updated
Was this helpful?