Page 1 of 1

Correct Syntax for add/edit Custom Forms

Posted: Tue Dec 05, 2017 12:47 pm
by apx
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.

https://help.pdf-xchange.com/pdfxps ... forms.html

Re: Correct Syntax for add/edit Custom Forms

Posted: Fri Dec 22, 2017 7:37 pm
by Ivan - Tracker Software
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"

Re: Correct Syntax for add/edit Custom Forms

Posted: Tue Jan 09, 2018 10:11 am
by apx
Thanks, that will help me.

Re: Correct Syntax for add/edit Custom Forms

Posted: Tue Jan 09, 2018 3:40 pm
by Tracker Supp-Stefan
:D

Re: Correct Syntax for add/edit Custom Forms

Posted: Thu Dec 06, 2018 10:12 am
by twonests
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?

Re: Correct Syntax for add/edit Custom Forms

Posted: Thu Dec 06, 2018 1:31 pm
by Tracker Supp-Stefan
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

Re: Correct Syntax for add/edit Custom Forms

Posted: Thu Dec 06, 2018 2:43 pm
by twonests
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?

Re: Correct Syntax for add/edit Custom Forms

Posted: Thu Dec 06, 2018 2:47 pm
by Tracker Supp-Stefan
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

Re: Correct Syntax for add/edit Custom Forms

Posted: Thu Dec 06, 2018 5:44 pm
by twonests
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()