Invalid argument creating root bookmark

This Forum is for the use of Software Developers requiring help and assistance for Tracker Software's PDF-Tools SDK of Library DLL functions(only) - Please use the PDF-XChange Drivers API SDK Forum for assistance with all PDF Print Driver related topics or PDF-XChange Viewer SDK if appropriate.

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Tracker Supp-Stefan

hortica
User
Posts: 1
Joined: Thu May 29, 2014 7:35 pm

Invalid argument creating root bookmark

Post by hortica »

I'm trying to create a pdf by merging a series of pdfs and add a bookmark for each pdf I've merged. I've got the merging working but when I go to create the root bookmark I'm getting an "Invalid argument" error This is VB 2010 with .Net 4

'open pdf
Dim intPdfManual As Integer
Dim res As Integer = XCPro40_Defs.PXCp_Init(intPdfManual, XCPro40_Defs.g_RegKey, XCPro40_Defs.g_DevCode)
res = XCPro40_Defs.PXCp_ReadDocumentW(intPdfManual, Manual.PdfPath, 0)

'ensure any prior bookmarks are cleared
res = XCPro40_Defs.PXCp_BMDeleteAllItems(intPdfManual)

'build root bookmark with min required info
Dim bmItem As New XCPro40_Defs.PXCp_BMInfo
bmItem.cbSize = XCPro40_Defs.PXCp_BMInfo_Size
bmItem.Mask = XCPro40_Defs.PXCp_BMInfoMask.BMIM_TitleW
bmItem.TitleW = System.Runtime.InteropServices.Marshal.StringToHGlobalUni("BookMark Root")

'insert root bookmark
Dim intRootBM As Integer
res = XCPro40_Defs.PXCp_BMInsertItem(intPdfManual, vbNull, XCPro40_Defs.PXCp_OutlinePos.PBM_ROOT, intRootBM, bmItem)

I know I just must be missing something obvious. any help is appreciated
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17960
Joined: Mon Jan 12, 2009 8:07 am
Location: London

Re: Invalid argument creating root bookmark

Post by Tracker Supp-Stefan »

Hello Ben,

Did you see the code snippet provided on this page?
Seems like you are not specifying all the needed information for the bookmarks you are creating and that's why you are getting errors.

Regards,
Stefan