# 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 Sub
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.swingsoftware.com/pdf-converter-for-notes/for-developers/lotusscript-code-samples/doclinks-sample-for-repository.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
