# How to convert password protected HTML content

If a HTML code is pointing to a protected resource (for example: ![](http://www.swingsoftware.com/images/lamp.gif) where lamp.gif is a password protected image on the [www.swingsoftware.com](http://www.swingsoftware.com) server), then in order to render such content to PDF, your Java policy document should be modified to allow password authentication from Lotus Notes.

In order to modify your Java policy document follow these steps:

1\. Open Java policy document in your text editor.

* The document path for a local installation is\Notes\jvm\lib\security\java.policy
* The document path for a server installation is\Domino\jvm\lib\security\java.policy

2\. In java.policy document locate the grant section and add below two lines:&#x20;

* permission java.net.NetPermission "setDefaultAuthenticator";
* permission java.net.NetPermission "requestPasswordAuthentication";

The java.policy document should now appear as in the below image:&#x20;

![](/files/-MlEXUSBwqSrW8F9Gb9p)

3\. User authentication is performed using LotusScript and Java API. Here is a code example for authenticating the user using LotusScript:

```
Use "SwPDFMain"
    Sub Click(Source As Button)
    Dim s As New NotesSession
    Dim w As New NotesUIWorkspace
    Dim db As NotesDatabase
    Dim dc As NotesDocumentCollection
    Dim doc As NotesDocument
    Dim swPDF As New SwPDFCreator, swPDFDoc As SwPDFDocument, pdfErr As SwPDFError
    Dim DestFilePath As Variant

    On Error Goto Ooops
    ' 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
    ' Get currently opened Notes document
    Set db = s.CurrentDatabase
    Set dc = db.UnprocessedDocuments
    Set doc = dc.GetFirstDocument

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

    ' enable font embedding for non ascii characters
    swPDF.PDFSettings.EnableFontEmbedding = True

    ' set user HTTP credentials    
    Call swPDF.PDFSettings.SetHTTPCredentials("Username","Password")

    ' 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
    Exit Sub
    Ooops:
    Msgbox "Error: " + Error + " On line: " + Erl
    Exit Sub
    End Sub
```

&#x20;  &#x20;


---

# 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-password-protected-html-content.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.
