Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.

Printing color forms in black and white

Avatar

Level 3

We have forms that utilize a lot of color.  Our client is asking that these forms only print in black and white when the form is accessed by the customer.  However, the customers have color printers ;-)....  Is there a programmatic way to print in grayscale when the customer clicks the print button?

Thanks,

Elaine

7 Replies

Avatar

Former Community Member

Most print drivers will expose that as an option that the user can select but I do not believe the Acrobat Print Command exposes that in the print call...but I am not a print expert. In the Javascript reference for Acrobat (not Designer) there is a Print Params object where a number of other settings can be used to control the printer. This object can be passed into the Print command. You might find something there that will do the job for you.

Paul

Avatar

Level 10

There are prePrint and postPrint events you could use to change the color;

prePrint

this.oldFillColor = this.ui.oneOfChild.border.fill.color.value;
this.ui.oneOfChild.border.fill.color.value = "255,255,255";

postPrint

this.fillColor = this.oldFillColor;
this.oldFillColor = null;

If you have color borders you would have to do a similar thing (changing them to gray);

this.oldFillLinearColor = this.border.fill.resolveNode("#linear").color.value;

this.border.fill.resolveNode("#linear").color.value = "196,196,196";

and

this.border.fill.resolveNode("#linear").color.value = this.oldFillLinearColor;

Avatar

Level 3

I tried the prePrint and postPrint code but it turned the form black... I will continue to research.

I also checked out the adobe acrobat javascript reference andit doesn't seem to work in livecycle.  For example, this is unknown in LC:

this.getPrintParams();

Any other thoughts or suggestions appreciated!

Thanks!

Elaine

Avatar

Former Community Member

The "this" keyword in Acrobat refers to the document object. The "this" keyword in XFA Forms refers to the current field. To get to the doc obejct in XFA Forms use event.target. So your command woudl look like this:

event.target.getPrintParams();

Paul

Avatar

Level 3

Well, I have looped through all of the printParams you can get, and I cannot seem to be able to print the form in black and white.  I thought this would do the trick, but no luck:

var pp = myDoc.getPrintParams();
pp.colorOverride = pp.constants.colorOverrides.mono;   //tried each one of these individually
pp.colorOverride = pp.constants.colorOverrides.gray;     //ditto


myDoc.print(pp);

If anyone has any other suggestions, let me know, thanks!

Elaine

Avatar

Level 10

Hi Elaine,

I have a recollection that printParams() was not suported/available in LC Designer. I thought it was restricted to AcroForms. I have looked at the LC 8.2 docs and it indicates that it is supported, but that there isn't a LC equivelent.

I think that you are best going with prePrint / postPrint. Alternatively if the number of colour elements is low, then copy each one directly over the original and set the visibility of the colour objects to "visible screen only" and the greyscale objects to "visible print only".

We had a requirement for a one-page form to appear white on black on the screen, but to print out normally as black on white. We used the second option above.

Not much use. Good luck,

Niall

Avatar

Level 3

Thanks Niall, we did consider duplicating the objects and changing the

visibility on print, ... but that adds increased maintenance and is not a

favored approach. Although I am thinking that's our only option at this

point