Add metadata

PDF metadata can be enabled and customized using SWING PDF Converter LotusScript and Java API. There are several metadata options:

  • Metadata from Lotus Notes document.

  • Custom medatada + metadata from Lotus Notes document.

  • Custom metadata only.

Add metadata from Lotus Notes document

Metadata from Lotus Notes document adds string values of all fields (except RTF fields) as metadata to PDF. Metadata is stored in XML format in PDF document.

Function MetadataSample(doc As NotesDocument) As String
	Dim s As New NotesSession
	Dim swPDF As New SwPDFCreator
	Dim swPDFDoc As SwPDFDocument
	Dim pdfErr As SwPDFError
	
	' Initialize PDF creation process; license key is required
	If swPDF.Init("") Then
		' Transfer all the items from Notes document to PDF metadata
		swPDF.PDFSettings.EnableMetadata = True
		' Also, set built-in PDF properties
		Call swPDF.SetPdfProperties(doc.Title(0), "", s.CommonUserName, "Sample document")
		' Convert doc to PDF
		Set swPDFDoc = swPDF.ProcessDocument(doc)
		
		If Not swPDFDoc Is Nothing Then
			MetadataSample = swPDFDoc.GetMetadata()
		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 Function

Add custom metadata + metadata from Lotus Notes document

Custom metadata is added to PDF document by defining string array which size is equal to number of custom metadata entries. Custom metadata format is:

"Metadata name"|"Metadata value"

Dim customMetadata(2) As String customMetadata(0) = "Name|Value" customMetadata(1) = "Other name|Other value"

Custom metadata can be applied to Swing PDF Converter trough SwPDFSettings using property or function:

swPDF.PDFSettings.CustomMetadata = customMetadata swPDF.PDFSettings.SetCustomMetadata(customMetadata as Variant, customMetadataOnly as Boolean

Function MetadataSample(doc As NotesDocument) As String
	Dim s As New NotesSession
	Dim swPDF As New SwPDFCreator
	Dim swPDFDoc As SwPDFDocument
	Dim pdfErr As SwPDFError
	
	' Initialize PDF creation process; license key is required
	If swPDF.Init("") Then

           ' Define custom metadata array
           Dim customMetadata(2) As String
           customMetadata(0) = "Name|Value"
           customMetadata(1) = "Other name|Other value"
     
           ' Transfer all the items from Notes document to PDF metadata
	   swPDF.PDFSettings.EnableMetadata = True
           ' Set custom metadata
           swPDF.PDFSettings.CustomMetadata = customMetadata
	   ' Also, set built-in PDF properties
	   Call swPDF.SetPdfProperties(doc.Title(0), "", s.CommonUserName, "Sample document")
	   ' Convert doc to PDF
	   Set swPDFDoc = swPDF.ProcessDocument(doc)
		
	   If Not swPDFDoc Is Nothing Then
	      MetadataSample = swPDFDoc.GetMetadata()
	   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 Function

Add custom metadata only

Custom metadata is added to PDF document by defining string array which size is equal to number of custom metadata entries. Custom metadata format is:

"Metadata name"|"Metadata value"

Dim customMetadata(2) As String customMetadata(0) = "Name|Value" customMetadata(1) = "Other name|Other value"

Custom metadata can be applied to Swing PDF Converter trough SwPDFSettings function:

swPDF.PDFSettings.SetCustomMetadata(customMetadata as Variant, customMetadataOnly as Boolean)


Function MetadataSample(doc As NotesDocument) As String
	Dim s As New NotesSession
	Dim swPDF As New SwPDFCreator
	Dim swPDFDoc As SwPDFDocument
	Dim pdfErr As SwPDFError
	
	' Initialize PDF creation process; license key is required
	If swPDF.Init("") Then

           ' Define custom metadata array
           Dim customMetadata(2) As String
           customMetadata(0) = "Name|Value"
           customMetadata(1) = "Other name|Other value"
     
           ' Transfer all the items from Notes document to PDF metadata
	   swPDF.PDFSettings.EnableMetadata = True
           ' Set custom metadata only
           swPDF.PDFSettings.SetCustomMetadata(customMetadata, true)
	   ' Also, set built-in PDF properties
	   Call swPDF.SetPdfProperties(doc.Title(0), "", s.CommonUserName, "Sample document")
	   ' Convert doc to PDF
	   Set swPDFDoc = swPDF.ProcessDocument(doc)
		
	   If Not swPDFDoc Is Nothing Then
	      MetadataSample = swPDFDoc.GetMetadata()
	   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 Function

Last updated