Does anybody have experience with Foxit ActiveX SDK pro in Excel VBA?
I would like to add bookmarks to specific pages in a PDF using Foxit ActiveX SDK pro in Excel VBA.
Can somebody please help?
The code I have for now is this, but the last part does not work:
Sub Test_Foxit_Open_PDF_in_Userform()
'This will open a PDF in a userform (in excel), insert another existing PDF,
'add a watermark and save as another PDF
'Dim PDFPrinter As New FoxitPDFSDKProLib.FoxitPDFSDK
Dim sPDFfile As String, sPDFfile2 As String
Dim sSaveAsFileName As String
Dim IsFileOpen As Boolean
Dim lPageCount As Long
Dim bResult As Boolean
sPDFfile = "C:\Users\frank.van.eygen\Documents\PDF files\Exact3.pdf"
sPDFfile2 = "C:\Users\frank.van.eygen\Documents\PDF files\Test Frank.pdf"
sSaveAsFileName = "C:\Users\frank.van.eygen\Documents\PDF files\Test_Foxit.pdf"
Load UserForm1
IsFileOpen = UserForm1.FoxitPDFSDK1.OpenFile(sPDFfile, "")
lPageCount = UserForm1.FoxitPDFSDK1.PageCount
bResult = UserForm1.FoxitPDFSDK1.InsertPage(lPageCount, sPDFfile2, "", "0")
bResult = UserForm1.FoxitPDFSDK1.AddWaterMark(1, "This is a watermark", 50, 200, 90, ColorConstants.vbCyan, 0, 100, 45)
UserForm1.FoxitPDFSDK1.SaveAs (sSaveAsFileName)
'adding a bookmark does not work
'UserForm1.FoxitPDFSDK1.SetBookmarkContextMenuString ("Page1")
'UserForm1.FoxitPDFSDK1.GetOutlineFirstChild()
UserForm1.Show
Unload UserForm1
End Sub