Printing a document within author applet

Oxygen general issues.
neon096
Posts: 45
Joined: Wed May 23, 2012 11:20 am

Printing a document within author applet

Post by neon096 »

Is there an API call I can use to issue a print operation? Similar to the print within the oxygen applications. Or do I need to implement my own using the java.awt.print?

Thanks
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: Printing a document within author applet

Post by Radu »

Hi Neil,

You can try this method:

AuthorComponentProvider.print(boolean preview)

This either prints to the printer or shows the print preview dialog.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
neon096
Posts: 45
Joined: Wed May 23, 2012 11:20 am

Re: Printing a document within author applet

Post by neon096 »

Thanks that worked perfectly.
neon096
Posts: 45
Joined: Wed May 23, 2012 11:20 am

Re: Printing a document within author applet

Post by neon096 »

I've now got a problem that the printed document is too big. I'm guessing that the CSS we use in the document display is being used to print. Is there any way to scale the printed documents down?
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: Printing a document within author applet

Post by Radu »

Hi Neil,

Ideally I think that if you would be using in your CSS constructs like:

Code: Select all

@media print {
*{
font-size:10px;
}
}
These "print" media sections would have to be ignore when the XML document is edited but taken into account when the document is printed (this is the way in which a web browser behaves).

Unfortunately Oxygen does not do this yet, I added an improvement request for this.

In the meantime, if you use the "Print Preview" action, the "Print Preview" dialog contains a combo box called "Printing Scale".
This scale is also used when the user prints directly.

You can bundle a set of preferences with an applet distribution so if in a standalone installation you set the printing scale and then export the global preferences to an XML file, this XML file could be used to provide a default set of options for the applet instead of the resources/options.zip.jar which comes with the sample project.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: Printing a document within author applet

Post by Radu »

Hi Neil,

In Oxygen 15.0 which was just released the @media print at-rule should be properly supported when printing from the Author mode.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply