Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Are PrintParams overriden by Windows Printer Preferences?

tgoodmannz_bss
Level 4
Level 4

Hi,

I want to create a form which prints silently, and bypasses all settings such as scaling and Duplex settings - I've created a sample form (attached) with the following script on a button click event

var myDoc = event.target;

        var pp = myDoc.getPrintParams();

        // Insert your Printer name here ....

        pp.printerName = "Brother MFC-7420 USB Printer";

        pp.DuplexType = 1;

        pp.nUpNumPagesH = 1;

        pp.nUpNumPagesV = 1;

        pp.tileScale = 1;

        pp.tileOverlap = 0;

        pp.nUpAutoRotate = false;

        pp.reversePages = false;

        pp.interactive = pp.constants.interactionLevel.silent;

        sfmTop.txtPrintOP.rawValue = pp.toSource();

        myDoc.print(0, "0", (xfa.host.numPages - 1).toString(), 0, 0, 0, 0, 0, pp);

Problem is that if the user in Windows has Printer Preferences set then it appears that these override the settings passed in th pp object.

My client needs to ensure that Duplex and reversing is turned off, but it doesn't happen if the printer preferences have these set!

Many Thanks,

Tim

0 Replies
Niall_O_Donovan
Level 10
Level 10

Hi Tim,

getPrintParams is not available in LC Designer XFA forms. It is available in AcroForms (forms designed in Acrobat). I have previously tried to get "getPrintParams" to work, without success. I came across a document/website that stated that getPrintParams was not fully supported, however I cannot find this now.

Using the xfa print command you have control over some printing functions:

xfa.host.print(1, "0", (xfa.host.numPages -1).toString(), 0, 0, 0, 0, 0);

Check the helps file for the eight parameters. For example the 7th parameter deals with reverse order.

Also in the File / Form Properties there is a tab for Print options, where you can set duplex printing.

Check this thread as well with some screenshots. Re: form printing,

Good luck,

Niall

tgoodmannz_bss
Level 4
Level 4

Thanks Niall,

So just to recap - if a user has their default printer preference set to print 2-1 pages, then there is nothing (programmatically) we can do to force it to print 1:1....?

Niall_O_Donovan
Level 10
Level 10

Hi Tim,

Duplex can be specified in the Form Properties / Print Options tab:

Windows 71.png

I have tested it here and if the printer defaults is simplex and the form is set for duplex; then the form settings will override the printer defaults and print in duplex.

In your case you would need to set the form to print in simplex, as per the screen shot above. This should override the printer default of duplex printing.

This is a setting you make a design stage. I don't think you can change the duplex/simplex settings using script. At the end of the XML Source tab you will see the settings from the File / Form Properties tab:

<?PDFPrintOptions embedPrintOnFormOpen 0?>

<?PDFPrintOptions scalingPrefs 0?>

<?PDFPrintOptions enforceScalingPrefs 0?>

<?PDFPrintOptions paperSource 1?>

<?PDFPrintOptions duplexMode 1?>

But I don't think you can access these programmatically.

That said I think you can achieve what you want between the Form Properties and the xfa print parameters.

Good luck,

Niall.

tgoodmannz_bss
Level 4
Level 4

Ah - Thanks Niall,

Adding the XML PDFPrintOptions properties to the File source would be fine..

Is there a setting to turn off the horizontal scaling or 2:1?  Many people print 2 pages on 1 (i.e. 2:1) - to save paper..

I just tried those settings - It definitely doesn't print Duplex any more, but it does still print 2:1 if set.

Thanks again,

Tim

Niall_O_Donovan
Level 10
Level 10

Hi Tim,

You don't need to copy the PDFPrintOptions into the XML source tab, they will be there from the File / Form Properties. I was just showing where the options ended up, to see if we could access them programmatically.

I see what you mean now with 2:1 and 1:1. The only thing I can suggest is to set the page scaling to "no page scaling" and to tick "prevent user from changing" - see previous screenshot. However I am not sure if this will do what you want.

Good luck,

Niall

You could also change the 5th parameter to "1", forcing fit to page.

xfa.host.print(1, "0", (xfa.host.numPages -1).toString(), 0, 1, 0, 0, 0); 

Also I have just spotted your xfa print command and adding the "pp" to the end of the xfa.print parameters will not work.

Message was edited by: Niall O'Donovan

tgoodmannz_bss
Level 4
Level 4

Many Thanks again Niall

I've tried Designer ES2 - it's good that it prevents scaling, but it doesn't stop printing 2:1

The Shrink to Fit could be an option - we actually had to turn it off previously (because it was being used inconsistently) - now we may have to try turning it on..

Thanks for your time helping here ... I think we'll need to look at a solution which involves instructions to the users

Regards,

Tim

tgoodmannz_bss
Level 4
Level 4

Hi Niall,

Sorry to bring this up after such a long time.

I am actually just testing this exact same issue with Simplex/Duplex.

My windows printer default is set to Duplex (albeit manual Duplex).  I have a form which is set to default to Simplex (using the form properties)

When printing the form, it is always going to Duplex (This is occurring on several different printers).

I know you said:

I have tested it here and if the printer defaults is simplex  and the form is set for duplex; then the form settings will override the  printer defaults and print in duplex.

Are you sure it was overriding the Printer Properties in Windows??

Thanks,

Tim

radzmar
Level 10
Level 10

Hi,

I tested several Printers (PCL5 & PostScript) on Win7 64Bit, all ignored the duplex settings by scripting or in the form preferences.

This happens to XFA forms and also to regular PDF files.

It may be that Acrobat/Reader cannot overwrite the printers default setting for specific brands or it's a problem between the OS (64Bit) and the app (32Bit).

tgoodmannz_bss
Level 4
Level 4

Thanks Radzmar

Can you please have a look at the attached file:

https://acrobat.com/#d=8zQHjj7zcLfrAt5RHa5XFA

I have tested this on Windows 7 (64 bit) and Windows XP - both printing to a Printer which the windows preferences are set to be Manual Duplex by default.

The file should default to Simplex, but in each case, it tries to print to Manual Duplex.

Do you see the same thing?

radzmar
Level 10
Level 10

Yes,

it looks the duplex parameters are ignored in every case.

I will file a bug.

Niall_O_Donovan
Level 10
Level 10

Hi Tim and Radzmar,

I have tested your form here on:

  • Windows XP (32-bit)
  • Reader X
  • Duplex printer (set to default to duplex printed and texted).

You form prints simplex (as per your settings). Other docucuments and forms, print duplex, as per the default, but your form prints as simplex without changing settings.

Seems a bit more testing is needed.

Maybe it is a 64-bit issue ????

Here is a form I worked on after this thread on printParams(). I have updated trying to get duplex printing working, but csn only achieve this in booklet mode. See print button on page 2.

https://acrobat.com/#d=Kuivy1SdOSbQnRs3kyeVDQ

Good luck,

Niall

radzmar
Level 10
Level 10

Hi Niall,

you're right, the booklet thing works, but the duplexType doesn't.

I made several tests on Win7 (64Bit) and Vista and XP (32Bit) and with several printer drivers (Kyocera, HP and Lexmark – PostScript and PCL) and I wasn't able to change the duplex setting in any case.

Niall_O_Donovan
Level 10
Level 10

Hi Radzmar,

I think the issue is that the printParams() are changing the Acrobat/Reader page handling settings only, rather than the actual printer defaults:

Parallels Desktop1.png

Because of this I don't think it will be possible to get printParams() to work for doubled-sided printing (duplex) only. Using printParams() will get you single sided OR booklet.

Trust that you are keeping well!

Niall

tgoodmannz_bss
Level 4
Level 4

Thanks Niall and Radzmer,

Let me just summarise the last few posts:  (Please correct me if I am wrong)

The Windows printer defaults for Duplex will not be overridden by the PDF Print Options for Simplex.  Only the Acrobat Page settings for printing will be overwritten.

Sorry - it sounds like Radzmer was able to reproduce the problem, but Niall couldn't.