You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Neil Guinto <ng...@mincron.com> on 2004/07/14 00:03:04 UTC

printing on dot matrix printer

Ver:  FOP 0.20.5

I need to print a report using a dot matrix printer.  The paper size 
that I'll be using is 8.5in x 14.875in.  I initially test it on our 
laser printer using a letter size paper.  The output looks good.  On a 
dot matrix printer (Lexmark 2381+) the font size and line height is 
totally wrong and its printed sideways.

This report will be generated by a batch program.  In most cases it will 
be sent to the printer without user intervention.  (this part I have a 
handle by following the servlet example).  Other reports will have to 
use pre-printed forms.  I would appreciate it if anybody could respond 
to this problem and point out some best practice concerning the use of 
dot matrix printer on FOP.

The following is a sample FO file of my report.

<?xml version="1.0" encoding="UTF-8"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master margin-right="0.5in" margin-left="0.5in" 
margin-bottom="0.0in" margin-top="0.0in" page-width="14.875in" 
page-height="8.5in" master-name="Continuous-Form-Wide">
<fo:region-body/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence line-height="8pt" font-size="10pt" 
font-family="Courier" master-reference="Continuous-Form-Wide">
<fo:flow flow-name="xsl-region-body">
<fo:block space-after.optimum="3pt"> </fo:block>
<fo:block space-after.optimum="3pt"> </fo:block>
<fo:block 
space-after.optimum="3pt">    JTRP006 - QPRINT      Override w/ Printer File     Page:     1                                                                  </fo:block>
<fo:block space-after.optimum="3pt"> </fo:block>
<fo:block 
space-after.optimum="3pt">This will print LPI(8) &amp; CPI(12).                                                                                                   </fo:block>
<fo:block 
space-after.optimum="3pt">This will print LPI(8) &amp; CPI(12).                                                                                                   </fo:block>
<fo:block 
space-after.optimum="3pt">This will print LPI(8) &amp; CPI(12).                                                                                                   </fo:block>
<fo:block 
space-after.optimum="3pt">This will print LPI(8) &amp; CPI(12).                                                                                                   </fo:block>
<fo:block 
space-after.optimum="3pt">This will print LPI(8) &amp; CPI(12).                                                                                                   </fo:block>
<fo:block 
space-after.optimum="3pt">This will print LPI(8) &amp; CPI(12).                                                                                                   </fo:block>
<fo:block 
space-after.optimum="3pt">This will print LPI(8) &amp; CPI(12).                                                                                                   </fo:block>
<fo:block 
space-after.optimum="3pt">This will print LPI(8) &amp; CPI(12).                                                                                                   </fo:block>
<fo:block 
space-after.optimum="3pt">This will print LPI(8) &amp; CPI(12).                                                                                                   </fo:block>
<fo:block 
space-after.optimum="3pt">This will print LPI(8) &amp; CPI(12).                                                                                                   </fo:block>
<fo:block 
space-after.optimum="3pt">This will print LPI(8) &amp; CPI(12).                                                                                                   </fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


Re: printing on dot matrix printer

Posted by Clay Leeds <cl...@medata.com>.
On Jul 13, 2004, at 3:03 PM, Neil Guinto wrote:
> Ver:  FOP 0.20.5
>
> I need to print a report using a dot matrix printer.  The paper size 
> that I'll be using is 8.5in x 14.875in.  I initially test it on our 
> laser printer using a letter size paper.  The output looks good.  On a 
> dot matrix printer (Lexmark 2381+) the font size and line height is 
> totally wrong and its printed sideways.
>
> This report will be generated by a batch program.  In most cases it 
> will be sent to the printer without user intervention.  (this part I 
> have a handle by following the servlet example).  Other reports will 
> have to use pre-printed forms.  I would appreciate it if anybody could 
> respond to this problem and point out some best practice concerning 
> the use of dot matrix printer on FOP.

I don't know how to help you, but I recall seeing reference to a 
SourceForge Project Mogwai on the FOP Resources page[1] which may 
help[2]. Please report back about your success.

Web Maestro Clay

[1]
http://xml.apache.org/fop/resources.html#products-fop-add-ons

[2]
http://mogwai.sourceforge.net/


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


Re: printing on dot matrix printer

Posted by Neil Guinto <ng...@mincron.com>.
>
> I am using the PrintRenderer.   I find TXTRenderer don't preserve the 
> white space on my report which is critical for me for proper 
> positioning and alignment.
>
Correction I just realized that I am using an inner class that extends 
the AWTRenderer.  So what I'm really using is AWTRenderer.


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


Re: printing on dot matrix printer

Posted by Clay Leeds <cl...@medata.com>.
On Jul 14, 2004, at 8:54 AM, Neil Guinto wrote:
> I am using the PrintRenderer.   I find TXTRenderer don't preserve the 
> white space on my report which is critical for me for proper 
> positioning and alignment.

It might also be good if you could 'improve' the TXTRenderer to 
preserve the white space in a way desirable to you. I suspect others 
might benefit from this type of contribution. We've thought of using 
TXTRenderer as a means of testing changes in template rendering (diff'g 
the output).

Web Maestro Clay


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


Re: printing on dot matrix printer

Posted by Neil Guinto <ng...@mincron.com>.
Chris Bowditch wrote:

> Neil Guinto wrote:
>
>> Ver:  FOP 0.20.5
>>
>> I need to print a report using a dot matrix printer.  The paper size 
>> that I'll be using is 8.5in x 14.875in.  I initially test it on our 
>> laser printer using a letter size paper.  The output looks good.  On 
>> a dot matrix printer (Lexmark 2381+) the font size and line height is 
>> totally wrong and its printed sideways.
>
>
> You don't say which renderer you are using? As a guess I would say you 
> are trying to use Text Renderer, which has a very poor quality of output.

I am using the PrintRenderer.   I find TXTRenderer don't preserve the 
white space on my report which is critical for me for proper positioning 
and alignment.

>
>>
>> This report will be generated by a batch program.  In most cases it 
>> will be sent to the printer without user intervention.  (this part I 
>> have a handle by following the servlet example).  Other reports will 
>> have to use pre-printed forms.  I would appreciate it if anybody 
>> could respond to this problem and point out some best practice 
>> concerning the use of dot matrix printer on FOP.
>
>
> My old dot matrix used to support PCL. Have you tried generating PCL 
> output and sending that instead of plain Text? It may also be useful 
> if posted a snippet of the code you use to send the generated output 
> to the printer.
>
> <snip/>

    protected void render(Source src, Transformer transformer)
        throws FOPException, TransformerException, PrinterException, 
IOException {

        PrinterJob pj = PrinterJob.getPrinterJob();
        pj.setCopies(1);
        pj.setPrintService(getPrintService());
        PrintRenderer renderer = new PrintRenderer(pj);

        //Setup FOP
        Driver driver = new Driver();
        driver.setRenderer(renderer);

        //Setup output
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        driver.setOutputStream(out);

        //Make sure the XSL transformation's result is piped through to FOP
        Result res = new SAXResult(driver.getContentHandler());

        //Start the transformation and rendering process
        transformer.transform(src, res);

        out.close();
    }



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


Re: printing on dot matrix printer

Posted by Chris Bowditch <bo...@hotmail.com>.
Neil Guinto wrote:

> Ver:  FOP 0.20.5
> 
> I need to print a report using a dot matrix printer.  The paper size 
> that I'll be using is 8.5in x 14.875in.  I initially test it on our 
> laser printer using a letter size paper.  The output looks good.  On a 
> dot matrix printer (Lexmark 2381+) the font size and line height is 
> totally wrong and its printed sideways.

You don't say which renderer you are using? As a guess I would say you are 
trying to use Text Renderer, which has a very poor quality of output.

> 
> This report will be generated by a batch program.  In most cases it will 
> be sent to the printer without user intervention.  (this part I have a 
> handle by following the servlet example).  Other reports will have to 
> use pre-printed forms.  I would appreciate it if anybody could respond 
> to this problem and point out some best practice concerning the use of 
> dot matrix printer on FOP.

My old dot matrix used to support PCL. Have you tried generating PCL output 
and sending that instead of plain Text? It may also be useful if posted a 
snippet of the code you use to send the generated output to the printer.

<snip/>

Chris


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org