Page 1 of 1

Help for ExportToImages under VB6 needed

Posted: Thu May 16, 2019 3:35 pm
by AndreasH
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

Re: Help for ExportToImages under VB6 needed

Posted: Fri May 17, 2019 7:06 am
by Sasha - Tracker Dev Team
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

Re: Help for ExportToImages under VB6 needed

Posted: Fri May 17, 2019 10:43 am
by AndreasH
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

Re: Help for ExportToImages under VB6 needed

Posted: Fri May 17, 2019 11:15 am
by Sasha - Tracker Dev Team
:)