Moderators:TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan
Forum rules DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.
When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
Well that's because you have not specified a path correctly - if you read an Acrobat JS Documentation you would have seen that you should have specified a device independent path.
Thank you Alex,
Effectively, with the correct path, it now works in both JS consoles.
But we still struggle to make it works in our PowerBuilder app.
Do you see something that could be wrong in the following code?
Or maybe you have a example in another programming language thant C# that would be closer to PowerBuilder.
We are so close to success - annotations import/export is the only thing left we have to implement in our proof of concept and confirm the switch from PDF-Viewer SDK to PDF-Xchange Editor SDK!
Just a thought - why would you need to execute a JS when you can just open the xfdf file with the OpenDocFromPath method and it will be automatically converted to the PDF. Give it a try.
We will try it but I think that even if it works, we would still have to find a way to export those annotations in a separate xfdf file. With the Viewer SDK, the only way was through Javascript.
oleobject myDoc
oleObject pxcInst
oleObject afsInst
oleObject myPath
//Save menu setting... it works
ole_pdfxchange_editor_control.object.Inst.SaveUserSettings(ole_pdfxchange_editor_control.object.Inst.CreateString('C:\Temp\@@setting_annotation_pdf.dat'))
// Create instances to CORE API Layers
pxcInst = ole_pdfxchange_editor_control.object.Inst.GetExtension("PXC")
afsInst = ole_pdfxchange_editor_control.object.Inst.GetExtension("AFS")
// BTW we don't know how to do it for the PDF Editor Layer ("PXV") and if it's required
//Try to create an IAFS_Name param to pass in exportCommentsAndField command... It doesn't work :-(
myPath = afsInst.DefaultFileSys.StringToName(ole_pdfxchange_editor_control.object.Inst.CreateString('C:\Temp\abc2.xfdf'))
myDoc = ole_pdfxchange_editor_control.Object.Doc
//We didn't made it so far since myPath was not created. But if we do, do we have to call the "PXV" layer?
pxcInst.exportCommentsAndFields(myDoc, myPath)
The problem was that you've passed an IString whilst the StringToName method needs a normal string as an input parameter. Please read parameter types more carefully.
Dim Path As IAFS_Name
Dim p_fsInst As PDFXEditCtl.IAFS_Inst
Set p_fsInst = PXV_Control1.Inst.GetExtension("AFS")
Set Path = p_fsInst.DefaultFileSys.StringToName(App.Path + "\sample.pdf")
Hi,
Would it be possible for you to supply us a more complete VB6 example of a call to ExecuteJS with importAnXFDF as javascript command?
Something that would show the declaration, initialization and usage of the 5 parameters would really help us to finally complete our proof of concept and confirm that we can switch from the Viewer SDK. After the last week, we're still stuck.
Thank you very much,
Best regards,
Eric
Dim res As IString
Set res = PXV_Control1.Inst.CreateString()
Dim script As String
Set script = "importAnXFDF('/C/Temp/annots.xfdf');"
Call PXV_Control1.Inst.ExecuteJS(PXV_Control1.Doc, script, PAEC_External, PAESC_Exec, Nothing, res)
Thank you so much Alex,
We will hopefully make it work in PowerBuilder.
On a side note, we were made aware that PowerBuilder only supports external functions that were exported using the WINAPI (_stdcall) format.
Is this requirement applicable to PDF -XChange Editor SDK? May be this could explain our struggles.
Here is an extract of PB Documentation
Use _stdcall convention
C and C++ compilers typically support several calling conventions, including _cdecl (the default calling convention for C programs), _stdcall (the standard convention for Windows API calls), _fastcall, and thiscall. PowerBuilder, like many other Windows development tools, requires external functions to be exported using the WINAPI (_stdcall) format. Attempting to use a different calling convention can cause an application crash.
When you create your own C or C++ DLLs containing functions to be used in PowerBuilder, make sure that they use the standard convention for Windows API calls.
Thank you,
Eric
Last edited by Erickc on Tue Jul 11, 2017 1:48 pm, edited 1 time in total.