Subject: Re: Direct Printing and setting print parameters
in FOP 0.94





Jeremias Maerki-2 wrote:
>
> The best approach was to create a new renderer: PageableRenderer. This
> should only implement Pageable and provide the from/to and odd/even
> functionality that the PrintRenderer offers. PrintRenderer can then
> be derived from the PageableRenderer while preserving its original
> behaviour.
>
> This can now be found in FOP Trunk. I've added a minimal example, too:
> http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/examples/embedding/java/embedding/ExampleFO2JPSPrint.java?view=markup
>
> I'll be grateful for feedback on this as I don't have a real-life
> use-case for this, unfortunately, in which I could test this. It was
> simply fun to implement. ;-) HTH
>
>

I used your example to send the form directly to the printer. I checked out
FOP Trunk and build the fop.jar which I used for my test. It works with the
minor issue of the font, which I can't figure out how to fix. The form uses
Arial font with bold, normal, and italic style, but when it is sent directly
to the printer, all the information on the form is printed in what looks
like Arial Bold Italic. When I debugged the code, I saw that after
transform() method is completed, PageableRenderer -> FontInfo -> usedFonts
has these values key = "F28" value = "Arial Negreta cursiva".

Here is the code:

FopFactory fopFactory = FopFactory.newInstance();

FOUserAgent userAgent = fopFactory.newFOUserAgent();
userAgent.setFontBaseURL(fontDir);

PageableRenderer renderer = new PageableRendere...

r();
renderer.setUserAgent(userAgent);

userAgent.setRendererOverride(renderer);

Fop fop = fopFactory.newFop(userAgent);

TransformerFactory factory = TransformerFactory.newInstance();
Transformer transformer = factory.newTransformer(); // identity
transformer

Source src = new StreamSource(fo);

Result res = new SAXResult(fop.getDefaultHandler());

transformer.transform(src, res);

Is there a way to define the fonts for the PageableRenderer in the
fop-config.xml or in any other way?


--
View this message in context:
http://www.nabble.com/Direct-Printing-and-setting-print-parameters-in-FOP-0.94-tp16747594p22087146.html
Sent from the FOP - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xxxxxxxxxxxxxxxxxxxxxx
For additional commands, e-mail: fop-users-help@xxxxxxxxxxxxxxxxxxxxxx



Privacy