PDF Editor 6.0.318 - Programatically print a PDF silently without print UI.  SOLVED

PDF-XChange Editor SDK for Developers

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.
Post Reply
docu-track99
User
Posts: 518
Joined: Thu Dec 06, 2007 8:13 pm

PDF Editor 6.0.318 - Programatically print a PDF silently without print UI.

Post by docu-track99 »

I have a PDF already loaded via code and the below code stopped working and it used to with build 318. Can you help guide me in the right direction to fixing this, please and thanks?
The line "op = pdfCtrl.Inst.CreateOp(2553)" produces Nothing and fails when it is called at Dim input As "PDFXEdit.ICabNode = op.Params.Root("Input")"

Private Sub PerformSilentPrint()

Try
Dim op As PDFXEdit.IOperation = Nothing
op = pdfCtrl.Inst.CreateOp(2553)

Dim doc As PDFXEdit.IPXV_Document = pdfCtrl.Doc
Dim input As PDFXEdit.ICabNode = op.Params.Root("Input")
input.Add().v = doc

Dim opExecFlags As Integer = 0
pdfCtrl.Inst.AsyncDoAndWaitForFinish(op, CUInt(opExecFlags))

Catch ex As Exception
End Try

End Sub
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17941
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: PDF Editor 6.0.318 - Programatically print a PDF silently without print UI.

Post by Tracker Supp-Stefan »

Hello docu-track99,

You had posted in the end user forums - and those are not as actively monitored by our devs as the SDK section.
I've now moved your topic to the correct place and will ask a colleague to take a look!

Cheers,
Stefan
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17941
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: PDF Editor 6.0.318 - Programatically print a PDF silently without print UI.

Post by Tracker Supp-Stefan »

Hello docu-track99,

The reply I got was that you should not use number ID values as those will differ from build to build.

Regards,
Stefan
docu-track99
User
Posts: 518
Joined: Thu Dec 06, 2007 8:13 pm

Re: PDF Editor 6.0.318 - Programatically print a PDF silently without print UI.

Post by docu-track99 »

Ok, I need help with changing my code then. If I can't use the number then what should be the proper process or how can I get the ID to use?

Thanks,
Steve.
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: PDF Editor 6.0.318 - Programatically print a PDF silently without print UI.

Post by Sasha - Tracker Dev Team »

Hello Steve,

The proper way would be to use the same method as you used to get the 2553 number - Str2ID method.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
docu-track99
User
Posts: 518
Joined: Thu Dec 06, 2007 8:13 pm

Re: PDF Editor 6.0.318 - Programatically print a PDF silently without print UI.

Post by docu-track99 »

Thanks for your response. I have used the Str2ID before but I need the string to pass into it. The code I have shared with you came from you so I never new what the ID represented as a string. Please let me know.

Thanks.
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: PDF Editor 6.0.318 - Programatically print a PDF silently without print UI.

Post by Sasha - Tracker Dev Team »

Hello Steve,

I could not have passed the number value like that as a parameter. It probably might of been a numerical variable that was converted from the string representation of the ID. Though there still was an ID that it was converted from. Anyways, what operation are you using here?

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
docu-track99
User
Posts: 518
Joined: Thu Dec 06, 2007 8:13 pm

Re: PDF Editor 6.0.318 - Programatically print a PDF silently without print UI.

Post by docu-track99 »

Hi,

The code was given to me by this forum to use about a year ago but since we upgraded to 318 it stopped working. I really don't know what 2553 is supposed to represent that is why I am asking you to for your assistance so I can get it working again. The code provided allowed our program to print an opened PDF silently without the print dialogue appearing.

Does this make sense now?
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: PDF Editor 6.0.318 - Programatically print a PDF silently without print UI.

Post by Sasha - Tracker Dev Team »

Hello Steve,

Then it seems that it is the op.document.printPages.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
docu-track99
User
Posts: 518
Joined: Thu Dec 06, 2007 8:13 pm

Re: PDF Editor 6.0.318 - Programatically print a PDF silently without print UI.  SOLVED

Post by docu-track99 »

It works: Here is my working code.


Private Sub PerformSilentPrint()

Try
Dim op As PDFXEdit.IOperation = Nothing
op = pdfCtrl.Inst.CreateOp(pdfCtrl.Inst.Str2ID("op.document.printPages"))

Dim doc As PDFXEdit.IPXV_Document = pdfCtrl.Doc
Dim input As PDFXEdit.ICabNode = op.Params.Root("Input")
input.Add().v = doc

Dim opExecFlags As Integer = 0
pdfCtrl.Inst.AsyncDoAndWaitForFinish(op, CUInt(opExecFlags))

Catch ex As Exception
End Try

End Sub
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: PDF Editor 6.0.318 - Programatically print a PDF silently without print UI.

Post by Sasha - Tracker Dev Team »

:)
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Post Reply