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 Massimo <ma...@snai.it> on 2012/11/30 14:41:23 UTC

Printed blank page when running example class ExampleFO2JPSPrint.java

Hi.
I am interested in using the BufferedImage produced by a custom renderer.
I tried to run the example class ExampleFO2JPSPrint.java and it produced a
blank page instead of "Hello world".
The method renderer.getPageImage(0) returns an image with raster bytes sets
to -1.
Can anyone help me?
Thanks.



--
View this message in context: http://apache-fop.1065347.n5.nabble.com/Printed-blank-page-when-running-example-class-ExampleFO2JPSPrint-java-tp37429.html
Sent from the FOP - Users mailing list archive at Nabble.com.

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


RE: Printed blank page when running example class ExampleFO2JPSPrint.java

Posted by Robert Meyer <rm...@hotmail.co.uk>.
Hi Massimo,

To quote Glenn here:

"Generally speaking, definite dates for future release of FOP are 
not published (or known for that matter). However, speaking for myself, I
 would like to see another release occur in the next six months."

That is about the best answer that can be given at the moment. As you know 1.1 is still relatively new but hopefully it won't take as long to get a new release out the door as it did for 1.1 coming from 1.0. A 6 month release cycle would be ideal but it does take a lot of work to get a stable build out the door, so until it gets closer to the time a date estimate is still unknown. Keep your eyes peeled to the mailing list though as information about new releases will appear here first.

Regards,

Robert Meyer

> Date: Tue, 4 Dec 2012 08:35:18 -0800
> From: massimo.iasevoli@snai.it
> To: fop-users@xmlgraphics.apache.org
> Subject: Re: Printed blank page when running example class ExampleFO2JPSPrint.java
> 
> Hi.
> I tested the trunk version and finally the ExampleFO2JPSPrint.java prints
> "Hello World!".
> I modified the class adding:
> *...
>   transformer.transform(src, res);
> 
>   BufferedImage image = renderer.getPageImage(0);
>   ImageIO.write(image, "PNG", new File("./pippo.png"));
> ...*
> 
> and the saved image contains "Hello World!".
> 
> Now I need the updated libraries to create a custom renderer.
> 
> Do you plan an upcoming stable release?
> 
> Regards,
> Massimo
> 
> 
> 
> --
> View this message in context: http://apache-fop.1065347.n5.nabble.com/Printed-blank-page-when-running-example-class-ExampleFO2JPSPrint-java-tp37429p37459.html
> Sent from the FOP - Users mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
> 
 		 	   		  

Re: Printed blank page when running example class ExampleFO2JPSPrint.java

Posted by Massimo <ma...@snai.it>.
Hi.
I tested the trunk version and finally the ExampleFO2JPSPrint.java prints
"Hello World!".
I modified the class adding:
*...
  transformer.transform(src, res);

  BufferedImage image = renderer.getPageImage(0);
  ImageIO.write(image, "PNG", new File("./pippo.png"));
...*

and the saved image contains "Hello World!".

Now I need the updated libraries to create a custom renderer.

Do you plan an upcoming stable release?

Regards,
Massimo



--
View this message in context: http://apache-fop.1065347.n5.nabble.com/Printed-blank-page-when-running-example-class-ExampleFO2JPSPrint-java-tp37429p37459.html
Sent from the FOP - Users mailing list archive at Nabble.com.

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


RE: Printed blank page when running example class ExampleFO2JPSPrint.java

Posted by Robert Meyer <rm...@hotmail.co.uk>.
Thanks for testing that out Luis as on both my Windows and Linux PC's I could not manage to reproduce the issue on trunk or 1.1. Keep us updated Massimo as to whether using trunk resolves your issue.

> Date: Tue, 4 Dec 2012 00:33:57 +0000
> From: lmpmbernardo@gmail.com
> To: fop-users@xmlgraphics.apache.org
> Subject: Re: Printed blank page when running example class ExampleFO2JPSPrint.java
> 
> 
> Please try with trunk.
> 
> On 12/3/12 11:26 AM, Massimo wrote:
> > Hi.
> >
> > I changed ExampleFO2JPSPrint.java as you recommended and it prints
> > (Sytem.out.println) values only if i change target resolution:
> >
> > *userAgent.setTargetResolution(200);*
> >
> > but the printed page is blank yet.
> >
> > My SO is XP Sp3 and FOP 1.1.
> >
> > Regards,
> > Massimo.
> >
> >
> >
> > --
> > View this message in context: http://apache-fop.1065347.n5.nabble.com/Printed-blank-page-when-running-example-class-ExampleFO2JPSPrint-java-tp37429p37444.html
> > Sent from the FOP - Users mailing list archive at Nabble.com.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> > For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
> 
 		 	   		  

Re: Printed blank page when running example class ExampleFO2JPSPrint.java

Posted by Luis Bernardo <lm...@gmail.com>.
Please try with trunk.

On 12/3/12 11:26 AM, Massimo wrote:
> Hi.
>
> I changed ExampleFO2JPSPrint.java as you recommended and it prints
> (Sytem.out.println) values only if i change target resolution:
>
> *userAgent.setTargetResolution(200);*
>
> but the printed page is blank yet.
>
> My SO is XP Sp3 and FOP 1.1.
>
> Regards,
> Massimo.
>
>
>
> --
> View this message in context: http://apache-fop.1065347.n5.nabble.com/Printed-blank-page-when-running-example-class-ExampleFO2JPSPrint-java-tp37429p37444.html
> Sent from the FOP - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>


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


RE: Printed blank page when running example class ExampleFO2JPSPrint.java

Posted by Robert Meyer <rm...@hotmail.co.uk>.
Hi Massimo,

I would suggest to use the same example but this time write to an actual file. I have modified the PDF example in case you haven't already done so to output PostScript (the same format the print example uses). If it writes "Hello World" to the file correctly then it shows that this is likely to be related to the existing bug and unfortunately until that is resolved the only option will be to render to a file and print from the viewer. If however, it does not write to the file and is blank, then that will suggest something is maybe going wrong at the renderer level.

Note: You may need to change line 122 to change the location of where the helloworld.fo file is being read from.

Regards,

Robert Meyer

> Date: Mon, 3 Dec 2012 03:26:58 -0800
> From: massimo.iasevoli@snai.it
> To: fop-users@xmlgraphics.apache.org
> Subject: RE: Printed blank page when running example class ExampleFO2JPSPrint.java
> 
> Hi.
> 
> I changed ExampleFO2JPSPrint.java as you recommended and it prints
> (Sytem.out.println) values only if i change target resolution:
> 
> *userAgent.setTargetResolution(200);*
> 
> but the printed page is blank yet.
> 
> My SO is XP Sp3 and FOP 1.1.
> 
> Regards,
> Massimo.
> 
> 
> 
> --
> View this message in context: http://apache-fop.1065347.n5.nabble.com/Printed-blank-page-when-running-example-class-ExampleFO2JPSPrint-java-tp37429p37444.html
> Sent from the FOP - Users mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
> 
 		 	   		  

RE: Printed blank page when running example class ExampleFO2JPSPrint.java

Posted by Massimo <ma...@snai.it>.
Hi.

I changed ExampleFO2JPSPrint.java as you recommended and it prints
(Sytem.out.println) values only if i change target resolution:

*userAgent.setTargetResolution(200);*

but the printed page is blank yet.

My SO is XP Sp3 and FOP 1.1.

Regards,
Massimo.



--
View this message in context: http://apache-fop.1065347.n5.nabble.com/Printed-blank-page-when-running-example-class-ExampleFO2JPSPrint-java-tp37429p37444.html
Sent from the FOP - Users mailing list archive at Nabble.com.

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


RE: Printed blank page when running example class ExampleFO2JPSPrint.java

Posted by Robert Meyer <rm...@hotmail.co.uk>.
Hi,

Yes I do get some data which does not equal -1. I used the following:

        BufferedImage img = renderer.getPageImage(0);
        for (int i = 0;i < img.getRaster().getDataBuffer().getSize();i++) {
            if (img.getRaster().getDataBuffer().getElem(i) != -1) {
                System.out.println(img.getRaster().getDataBuffer().getElem(i));
            }
        }

and got the following output:

-16777216
...
-14935012
-789517
-2368549
-16777216
-4605511
...
-11711155
-16053493
-14540254
-4737097
-16777216
-16777216

We do have a bug open which 
occurs on MacOS, although it might also occur on other systems which results in blank pages being sent to the printer. It is 
still open at this stage and can be found here: https://issues.apache.org/bugzilla/show_bug.cgi?id=53249.

Could you tell us the version of FOP you are running and the operating system?

Regards,

Robert Meyer 

> Date: Fri, 30 Nov 2012 06:47:14 -0800
> From: massimo.iasevoli@snai.it
> To: fop-users@xmlgraphics.apache.org
> Subject: RE: Printed blank page when running example class ExampleFO2JPSPrint.java
> 
> Hi Robert.
> 
> Thanks for your quick response.
> 
> I already have those referenced, except xmlgraphics-commons-1.4svn.jar where
> i have xmlgraphics-commons-1.5.jar.
> 
> When i run i get this messages:
> 
> *FOP ExampleFO2JPSPrint
> 
> Preparing...
> Input: XSL-FO (.\xml\fo\helloworld.fo)
> Output: JPS (Java Printing System)
> 
> Transforming...
> Success!*
> 
> No error and no "Hello world".
> 
> Can you tell me if calling *renderer.getPageImage(0)* you see byte raster
> with values *!=* "-1"?
> 
> 
> 
> --
> View this message in context: http://apache-fop.1065347.n5.nabble.com/Printed-blank-page-when-running-example-class-ExampleFO2JPSPrint-java-tp37429p37431.html
> Sent from the FOP - Users mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
> 
 		 	   		  

RE: Printed blank page when running example class ExampleFO2JPSPrint.java

Posted by Massimo <ma...@snai.it>.
Hi Robert.

Thanks for your quick response.

I already have those referenced, except xmlgraphics-commons-1.4svn.jar where
i have xmlgraphics-commons-1.5.jar.

When i run i get this messages:

*FOP ExampleFO2JPSPrint

Preparing...
Input: XSL-FO (.\xml\fo\helloworld.fo)
Output: JPS (Java Printing System)

Transforming...
Success!*

No error and no "Hello world".

Can you tell me if calling *renderer.getPageImage(0)* you see byte raster
with values *!=* "-1"?



--
View this message in context: http://apache-fop.1065347.n5.nabble.com/Printed-blank-page-when-running-example-class-ExampleFO2JPSPrint-java-tp37429p37431.html
Sent from the FOP - Users mailing list archive at Nabble.com.

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


RE: Printed blank page when running example class ExampleFO2JPSPrint.java

Posted by Robert Meyer <rm...@hotmail.co.uk>.
Hi,

I have just tried the example and managed to get it to print fine.

Are you sure you have all the necessary jars in your classpath? I created a small eclipse project and ran with the following jars to get it to work:

avalon-framework-4.2.0.jar
batik-all-1.7.jar
commons-io-1.3.1.jar
commons-logging-1.0.4.jar
fop.jar
xmlgraphics-commons-1.4svn.jar

If you find you already have those referenced, do you get any messages / errors on the command line when printing?

Regards,

Robert Meyer

> Date: Fri, 30 Nov 2012 05:41:23 -0800
> From: massimo.iasevoli@snai.it
> To: fop-users@xmlgraphics.apache.org
> Subject: Printed blank page when running example class ExampleFO2JPSPrint.java
> 
> Hi.
> I am interested in using the BufferedImage produced by a custom renderer.
> I tried to run the example class ExampleFO2JPSPrint.java and it produced a
> blank page instead of "Hello world".
> The method renderer.getPageImage(0) returns an image with raster bytes sets
> to -1.
> Can anyone help me?
> Thanks.
> 
> 
> 
> --
> View this message in context: http://apache-fop.1065347.n5.nabble.com/Printed-blank-page-when-running-example-class-ExampleFO2JPSPrint-java-tp37429.html
> Sent from the FOP - Users mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>