Correct Syntax for add/edit Custom Forms

PDF-XChange Drivers API (only) V4/V5
This Forum is for the use of Software Developers requiring help and assistance for Tracker Software's PDF-XChange Printer Drivers SDK (only) - VERSION 4 & 5 - Please use the PDF-Tools SDK Forum for Library DLL assistance.

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

Post Reply
apx
User
Posts: 24
Joined: Tue Sep 12, 2017 1:43 pm

Correct Syntax for add/edit Custom Forms

Post by apx » Tue Dec 05, 2017 12:47 pm

Hi,

I do not understand the documentation here. How do I have to proceed to create a template or change an existing one?

PDFPrinter.Option["CustomForms.ID"] = "Test"
PDFPrinter.Option["CustomForms.Name"] = "Test"
PDFPrinter.Option["CustomForms.Unit"] = 0
PDFPrinter.Option["CustomForms.Width"] = 1230
PDFPrinter.Option["CustomForms.Height"] = 1230

Is that the correct Syntax? I would like to take over the formats of a real printer to create PDF documents in the paper format.

http://help.tracker-software.com/pdfxps ... forms.html

Ivan - Tracker Software
Site Admin
Posts: 3585
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada
Contact:

Re: Correct Syntax for add/edit Custom Forms

Post by Ivan - Tracker Software » Fri Dec 22, 2017 7:37 pm

Unfortunately, there is no way to add custom form using API. Instead, you have to setup paper size using DEVMODE as for any regular printer, or, you can use undocumented "DevMode" section:

Code: Select all

PDFPrinter.Options["DevMode.PapSize"] = 256; // stands for DMPAPER_CUSTOM
PDFPrinter.Options["DevMode.CWidth"] = 1230;
PDFPrinter.Options["DevMode.CHeight"] = 1230;
PDFPrinter.ApplyOptions(0);
Please note, that will work for V5/V6. In V7, "DevMode" section was removed and its options are available in "Paper" section. So, in V7 the same task can be done in the following way:

Code: Select all

PDFPrinter.Options["Paper.Size"] = 256; // stands for DMPAPER_CUSTOM
PDFPrinter.Options["Paper.CWidth"] = 1230;
PDFPrinter.Options["Paper.CHeight"] = 1230;
PDFPrinter.ApplyOptions(0);
P.S. To get all available options, you can run on cmd.exe and run a command:

Code: Select all

"%ProgramFiles%\Tracker Software\PDF-XChange 6\pdfSaver6.exe" /DumpOption /Printer "PDF-XChange Standard V6"
or, in case of V7:

Code: Select all

"%ProgramFiles%\Tracker Software\PDF-XChange Standard\pdfSaver.exe" /DumpOptions /Printer "PDF-XChange Standard"
Tracker Software (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.

apx
User
Posts: 24
Joined: Tue Sep 12, 2017 1:43 pm

Re: Correct Syntax for add/edit Custom Forms

Post by apx » Tue Jan 09, 2018 10:11 am

Thanks, that will help me.

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

Re: Correct Syntax for add/edit Custom Forms

Post by Tracker Supp-Stefan » Tue Jan 09, 2018 3:40 pm

:D

twonests
User
Posts: 3
Joined: Thu Dec 06, 2018 9:00 am

Re: Correct Syntax for add/edit Custom Forms

Post by twonests » Thu Dec 06, 2018 10:12 am

Hi,

thank you for your help. We are currently using V7 , create avirtual printer with the driver API. Then we set to Paper size, height and width with:

Code: Select all

PDFPrinter.Options["Paper.Size"] = 256; // stands for DMPAPER_CUSTOM
PDFPrinter.Options["Paper.CWidth"] = 1230;
PDFPrinter.Options["Paper.CHeight"] = 1230;
PDFPrinter.ApplyOptions(0);
Finally is the printer as defauflt defined.

Unfortunately, in the application, when printing the settings are not used.
We have to open manually the printer settings window and click on apply (without changing anything..)...
Any ideas how to fix it?

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

Re: Correct Syntax for add/edit Custom Forms

Post by Tracker Supp-Stefan » Thu Dec 06, 2018 1:31 pm

Hello twonests,

These settings should be called for and applied immediately before your own application sends a print job to our printer.
These are not intended for you to e.g. set things up and then show a GUI from which the user can select a printer and have the settings auto applied.
If you would be showing a UI window - do that first, capture the user input, and then use it to set the printer options as required by the user before starting the actual print job.

Regards,
Stefan

twonests
User
Posts: 3
Joined: Thu Dec 06, 2018 9:00 am

Re: Correct Syntax for add/edit Custom Forms

Post by twonests » Thu Dec 06, 2018 2:43 pm

Oh quick response. This is exactly what we do. We set the default settings and then send the job to the printer. But as already stated, the predefined settings are not correctly applied. More curious it was perfectly working with v6. Did you change anything?

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

Re: Correct Syntax for add/edit Custom Forms

Post by Tracker Supp-Stefan » Thu Dec 06, 2018 2:47 pm

Hello twonests,

Can you please share with us a sample project illustrating the problem?
(Please make sure to remove any license info from it before uploading to the forums!)

Regards,
Stefan

twonests
User
Posts: 3
Joined: Thu Dec 06, 2018 9:00 am

Re: Correct Syntax for add/edit Custom Forms

Post by twonests » Thu Dec 06, 2018 5:44 pm

Here is the python code that we are using. This code printsin A4 (and not A0)...:

Code: Select all

import logging
import win32com.client
import os
import collections
import time

com = win32com.client.Dispatch("PXCComLib7.CPXCControlEx")

code = """
sdfsdfdsf
"""

printer = com.Printer('', 'SIMBA_PRINTER_V7_2', code, "blabla")

printer.SetOption('Paper.Orientation', 2)
printer.SetOption("Paper.Size", 256)
printer.SetOption("Paper.CWidth", 5930)
printer.SetOption("Paper.CHeight", 8410)
# printer.SetOption("DevMode.PapSize" , 256)
# printer.SetOption("DevMode.CWidth" , 5930)
# printer.SetOption("DevMode.CHeight" , 8410)
printer.SetOption('Save.File', r"\\v00925\Simba\90_Persoenlich\u222223\tmp\my_pdf.pdf")

printer.SetOption('Save.ShowSaveDialog', False)
printer.SetOption('Save.RunApp', False)
printer.SetOption('Save.WhenExists', 'Append')
printer.SetOption('Saver.ShowProgress', False)

printer.ApplyOptions(0)
printer.SetAsDefaultPrinter()

visum_com = win32com.client.Dispatch("Visum.Visum.16")
visum_com.LoadVersion(r"System_v05_Ref_Test_AA.ver")

visum_com.Graphic.Plot()

Post Reply