SwingController: keeping printHelper settings
[Logo]
Forums for ICEfaces and ICEpdf
[Search] Search   [Recent Topics] Recent Topics   [Groups] Home Page | www.icefaces.org  [Register] Register  [Login] Login 
SwingController: keeping printHelper settings  XML
Forum Index -> ICEpdf General
Author Message
dmaass

Joined: 07/05/2009 00:00:00
Messages: 3
Offline


Hi,
maybe this issue was solved elsewhere, so ignore it if it isn't of interest..

When i used the SwingController to display a document the printer dialog always used the letter page size as default when i pressed the print button. I wanted to change this beavior using the following
Code:
       SwingController controller;
           ... // some initialization incl. call controller.openDocument(...)
       controller.getViewModel().setPrintHelper(
           new PrintHelper( controller.getDocumentViewController(), controller
               .getDocument().getPageTree(), MediaSizeName.ISO_A4,
               PrintQuality.NORMAL ) );
 

This did not help. The reason is, that the printHelper is always overwritten in SwingController#initialisePrinting(...).

The attached patch helped me. Should i file a bug?
 Filename icepdf-4.0.0.patch [Disk] Download
 Description SwingController.java-Patch
 Filesize 972 bytes
 Downloaded:  26 time(s)

patrick.corless

Joined: 26/10/2004 00:00:00
Messages: 680
Offline


I would probably argue that this isn't a bug as the Viewer RI was intended to be modified by the end user for custom applications.

If you want to change the default printer I would recommend you change the PrintHelper constructor as follows:

Code:
public PrintHelper(DocumentViewController viewController, PageTree pageTree) {
         this(viewController, pageTree, MediaSizeName.NA_A4, PrintQuality.DRAFT);
     }


This question is asked quite a lot by the European community. I think the easiest thing to do on my end it to add a new property to the viewers properties files that would allows uses to change the default printer.
[Email]
patrick.corless

Joined: 26/10/2004 00:00:00
Messages: 680
Offline


Created to enhancement bug to track this change. http://jira.icefaces.org/browse/PDF-157.
[Email]
dmaass

Joined: 07/05/2009 00:00:00
Messages: 3
Offline


Thank you for your quick reply!

Why not simply use the attributes of an already existing PrintHelper as in the proposed patch? I thought this was intended by the writer of (SwingController#initialisePrinting)
Code:
 PrintHelper printHelper = viewModel.getPrintHelper();
 

and the error is at the next line
Code:
 printHelper = new PrintHelper(documentViewController, getPageTree());
 

??
patrick.corless

Joined: 26/10/2004 00:00:00
Messages: 680
Offline


I see your point now. I'll also make sure the attributes get copied over as your patch states.

Since you're now an official contributor to ICEpdf I need you to sign and send in our contributors agreement for all the wonderful legal reasons. You can download the agreement here, http://www.icepdf.org/community/contribute.html



[Email]
 
Forum Index -> ICEpdf General
Go to:   
Powered by JForum 2.1.7ice © JForum Team