Help for ExportToImages under VB6 needed

PDF-XChange Editor SDK for Developers

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

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.
Post Reply
AndreasH
User
Posts: 3
Joined: Thu May 16, 2019 3:08 pm

Help for ExportToImages under VB6 needed

Post by AndreasH » Thu May 16, 2019 3:35 pm

Hi,
i have to migrate a prog using the Pdf-XChangeViewer to the current version of Pdf-XChange-Editor, where the prog is written in VB6. Migrating the whole prog to C++ is no option because the gui and the underlying logic is a little bit complex, also the lifetime of the prog is expected to end in the nearer future. The change to the Pdf-XChange-Editor is necessary because my company wants to drop the Pdf-XChangeViewer.
So far i'm able to open and save a pdf, also reading and saving of settings works, but the function ExportToImages doesn't work for me. I understand that i have to pass a structure like a registry-entry or a ini-file to the function. That's my code (not working):

Private Sub cmdExport_Click()
Dim nID As Long
Dim Op As pdfxeditctl.IOperation
Dim data As pdfxeditctl.ICab
Dim inp As pdfxeditctl.ICabTemplate

nID = pxvInst.Str2ID("op.document.exportToImages", False)
'nID = AxPXV_Control1.Inst.Str2ID("op.document.exportToImages", False)
'Set Op = AxPXV_Control1.Inst.CreateOp(nID)
Set Op = pxvInst.CreateOp(nID)

Set inp = Op.Params.Root.Add("Input")
inp.CreateCab = "d:\test.pdf"
Set Options = Op.Params.Root("Options")
Options("PagesRange.Type").v = "All"
Options ["PagesRange.Text"].v = "1-3"
Options ["DestFolder"].v = "D:\\TestFolder\\" 'Output folder
Options ["ExportMode"].v = "AllToMultiPage"
Options ["Zoom"].v = 100

Set fmtParams = Options("FormatParams")
fmtParams("COMP").v = 5
fmtParams("DPIX").v = 300
fmtParams("DPIY").v = 300
fmtParams("iTYP").v = 8
fmtParams("PRED").v = 0
fmtParams("THUM").v = 0

Call Op.Do

End Sub


I get an error "argument not optional" in line "inp.CreateCab = "d:\test.pdf"" during runtime.
I have tried some other ways, but with no luck. Could anyone give me a hint how to solve my problem? Any help would be higly appreciated.

Greetings
Andreas

User avatar
Sasha - Tracker Dev Team
User
Posts: 4190
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Help for ExportToImages under VB6 needed

Post by Sasha - Tracker Dev Team » Fri May 17, 2019 7:06 am

Hello Andreas,

Well here's the sample written on the C#:
https://sdkhelp.tracker-software.com/vi ... rtToImages
If you look carefully, you will notice that input is an array of IUnknown and the IPXC_Document interface should be added as a first item of an array - not a string added to the node itself.

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

AndreasH
User
Posts: 3
Joined: Thu May 16, 2019 3:08 pm

Re: Help for ExportToImages under VB6 needed

Post by AndreasH » Fri May 17, 2019 10:43 am

Hello Alex,
thank's for the quick reply. I have traced back my problem to the wrong definition of variables. This snippet now works for me :D :

Private Sub cmdExport_Click()
Dim nID As Long
Dim Op As PDFXEditCtl.IOperation
Dim data As PDFXEditCtl.ICab
Dim inp As PDFXEditCtl.CoAUX_Cab
Dim Options As PDFXEditCtl.CoAUX_Cab
Dim fmtParams As PDFXEditCtl.CoAUX_Cab
Dim Doc As PDFXEditCtl.IPXC_Document

nID = pxvInst.Str2ID("op.document.exportToImages", False)

Set Op = pxvInst.CreateOp(nID)
Set inp = Op.Params.Root("Input")
Set Doc = Me.AxPXV_Control1.Doc.CoreDoc
inp.Add().v = Doc

Set Options = Op.Params.Root("Options")
Options("PagesRange.Type").v = "All"
'Options("PagesRange.Text").v = "1-3"
Options("DestFolder").v = "D:\\TestFolder\\" 'Output folder
Options("ExportMode").v = "AllToMultiPage"
Options("Zoom").v = 100
Options("DpiX").v = 300 'real DPI
Options("DpiY").v = 300 'real DPI
Options("ShowResultFolder").v = 0

Set fmtParams = Options("FormatParams")
fmtParams("FMT").v = 1414088262 'TIFF
fmtParams("COMP").v = 4 'CCITT FAX G4
fmtParams("DPIX").v = 300 'Only Metadata
fmtParams("DPIY").v = 300 'Only Metadata
fmtParams("ITYP").v = 1 'B&W
fmtParams("PRED").v = 0
fmtParams("THUM").v = 0 'Thumbnail = NO

Op.Do

End Sub


Cheers
Andreas

User avatar
Sasha - Tracker Dev Team
User
Posts: 4190
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Help for ExportToImages under VB6 needed

Post by Sasha - Tracker Dev Team » Fri May 17, 2019 11:15 am

:)
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

Post Reply