# How to convert a document collection using multiple alternate forms

For a quick introduction to using alternate forms in PDF Converter, check out the following article:

{% content-ref url="/pages/-MlF6m12cpRuO4mEV88o" %}
[Using alternate forms](/pdf-converter-for-notes/how-to/how-to-use-alternate-forms.md)
{% endcontent-ref %}

This example converts a document collection into a single PDF document.

```
Use "SwPDFMain"
Sub Click(Source As Button)
    Dim w As New NotesUIWorkspace, s As New NotesSession, dc As NotesDocumentCollection
    Dim swPDF As New SwPDFCreator, swPDFDoc As SwPDFDocument, pdfErr As SwPDFError
    Dim DestFilePath As Variant
    
    ' Get documents selection from view
    Set dc = s.CurrentDatabase.UnprocessedDocuments
    
    If dc.Count > 0 Then
        ' 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
            
            ' Procceed with PDF conversion
            ' Initialize PDF creation process; license key is required
            If swPDF.Init("") Then
                If dc.Count = 1 Then
                    ' Convert doc to PDF
                    
                    Set swPDFDoc = swPDF.ProcessDocument(dc.GetFirstDocument)
                Else
                    ' Set alternate forms
                    Dim temp (2) As String
                    temp(0)= "TestForm1|altTestForm1"
                    temp(1) = "TestForm2|altTestForm2"
                    swPDF.PDFSettings.AlternateFormsCol = temp
                    Set swPDFDoc = swPDF.ProcessDocCollection(dc, w.CurrentView.ViewName)
                End If
                
                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
    Else
        Msgbox "You must select at least one document.", 0+48, "WARNING"
    End If
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/how-to/how-to-convert-a-document-collection-using-multiple-alternate-forms.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.
