Details
-
Type: Bug
-
Status: Closed
-
Priority: Minor
-
Resolution: Fixed
-
Affects Version/s: 3.1.2
-
Fix Version/s: 4.0
-
Component/s: Documentation
-
Labels:None
-
Environment:LINUX: 2.6.31-15-generic #50-Ubuntu SMP Tue Nov 10 14:54:29 UTC 2009 i686 GNU/Linux
Java(TM) SE Runtime Environment (build 1.6.0_16-b01)
-
ICEsoft Forum Reference:
-
Workaround Exists:Yes
-
Workaround Description:
Description
The PrintServices example printed my pdf fine, however being in UK, the Letter size paper meant that the printout was not correctly aligned on my printer.
I then modified printServices example to set the paper size to A4 and the orientation to LANDSCAPE.
printRequestAttributeSet.add(OrientationRequested.LANDSCAPE);
docAttributeSet.add(OrientationRequested.LANDSCAPE);
printRequestAttributeSet.add(MediaSizeName.ISO_A4);
docAttributeSet.add(MediaSizeName.ISO_A4);
However despite modifying the settings of printRequestAttributeSet, docAttributeSet they never made any difference to the printer output.
Having looked at the source of PrinterHelper (with my very limited Java skills) it seems that private class variables of the same name are created in PrinterHelper and the values from PrintServices are never passed into PrinterHelper.
I also notice that there are 2 different variables in PrinterHelper called printServices. It is defined as a private class variable and also as a local variable inside the printHelper constructor.
I am unsure whether this is intentional design however in order to get pdfs to print correctly on A4 paper I passed the values of printRequestAttributeSet, docAttributeSet from printServices into the printHelper constructor. This then ensured my settings were correctly set.
I am not sure if it was necessary, but I also passed the value of selectedService from printServices as follows:
AKCPrintHelper printHelper = new AKCPrintHelper(vc, document.getPageTree(), selectedService, printRequestAttributeSet, docAttributeSet);
I hope this is sufficient information for you to look at this issue Patrick.
Regards
Alec
I then modified printServices example to set the paper size to A4 and the orientation to LANDSCAPE.
printRequestAttributeSet.add(OrientationRequested.LANDSCAPE);
docAttributeSet.add(OrientationRequested.LANDSCAPE);
printRequestAttributeSet.add(MediaSizeName.ISO_A4);
docAttributeSet.add(MediaSizeName.ISO_A4);
However despite modifying the settings of printRequestAttributeSet, docAttributeSet they never made any difference to the printer output.
Having looked at the source of PrinterHelper (with my very limited Java skills) it seems that private class variables of the same name are created in PrinterHelper and the values from PrintServices are never passed into PrinterHelper.
I also notice that there are 2 different variables in PrinterHelper called printServices. It is defined as a private class variable and also as a local variable inside the printHelper constructor.
I am unsure whether this is intentional design however in order to get pdfs to print correctly on A4 paper I passed the values of printRequestAttributeSet, docAttributeSet from printServices into the printHelper constructor. This then ensured my settings were correctly set.
I am not sure if it was necessary, but I also passed the value of selectedService from printServices as follows:
AKCPrintHelper printHelper = new AKCPrintHelper(vc, document.getPageTree(), selectedService, printRequestAttributeSet, docAttributeSet);
I hope this is sufficient information for you to look at this issue Patrick.
Regards
Alec
Updated PrintHelp and demo to make this process a lot easier for 4.0. Docs can be found here. http://wiki.icefaces.org/display/PDF/Print+Services+Example