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 "Oosterbaan, Douglas S. (LNG-DAY)" <Do...@lexisnexis.com> on 2005/09/21 01:37:08 UTC

Can't get PNG images

For some reason, I'm not able to include PNG images in my PDF 
documents.  I'm trying to use jai rather than jimi for this.
I downloaded the fop0.20.5 source code and installed
the jai_core.jar and jai_codec.jar files under the
.../fop-0.20.5/lib directory, then built everything using build.sh.

Interestingly, in the messages coming out to the screen I saw:
prepare-jimi:

prepare-jai:
     [echo] JAI library is present. Installing JAI support.

But in the build.log that gets created I saw:
prepare-jimi:

prepare-jai:

I don't know why the prepare-jai: target is different between the
two, or if that's even what my problem is.  I understand the 
jimi lib not being present since that's not distributed with the 
source for licensing issues.

In my testing, I have a directory that contains jpg's, bmp's, and
png's.  I'm able to pick up all of the jpg's and bmp's but not any
of the png's.

FWIW, my fop.jar does contain at least the following JAI image class:
3698 Fri Aug 19 13:56:40 EDT 2005 org/apache/fop/image/JAIImage.class

Below is the relevant piece of FO, I'm placing this in the xsl-region-body:

<fo:block span="all" space-after="1em"/>
<fo:block white-space-treatment="preserve" white-space-collapse="false"
text-align="center" margin-left="0.833333in" margin-right="0.833333in"
span="all" font-family="Times" font-size="10pt" color="#000000"
font-weight="normal" font-style="normal" text-decoration="no-underline
no-line-through" >
<fo:external-graphic src="file:D:\workspace\fofiles\apolloImage_5.png"/>
</fo:block>
<fo:block span="all" />

Am I missing something that is preventing me from being able to get PNG
images?

Thank you for any help you can provide.


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


Re: Is there a way to stop the creation of a PDF when the user close the browser windows?

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Manuel Mall wrote:
> You also said that you must wait for the report to be generated before 
> starting to send it. There is no intrinsic need to do

Well, IEx (at least up to 5.5) usually has problem if the content-length
HTTP header isn't set properly. That's why all the sample servlets
stream the PDF into a in-memory buffer, the write it to the ouput
stream.

J.Pietschmann

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


Re: Is there a way to stop the creation of a PDF when the user close the browser windows?

Posted by Manuel Mall <mm...@arcus.com.au>.
On Wed, 21 Sep 2005 10:20 am, David Gagnon wrote:
> Hi
>
> >I don't think so if backwards compatibility with IE 5 and older
> > browsers is important.
>
> I don`t care about IE5 .. are you saying it's works with IE6 .. I
> remember having tried that without success ...
>
Hmm, just tried it myself and its inconclusive. Seems to works sometimes 
and sometimes not and works always when hitting refresh. Which probably 
means it doesn't work near good enough for production use. So you are 
stuck with rendering the document fully first to be able to set the 
content length before serving it and if the users closes the browser or 
navigates away you just have to deal with the exception.

> /David
>
Manuel

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


Re: Is there a way to stop the creation of a PDF when the user close the browser windows?

Posted by David Gagnon <dg...@siunik.com>.
Hi

>>    
>>
>I don't think so if backwards compatibility with IE 5 and older browsers 
>is important.
>  
>
I don`t care about IE5 .. are you saying it's works with IE6 .. I 
remember having tried that without success ...

/David

>  
>
>>I know when I generate an HTML report I get a
>>java.net.SocketException when I close the browser window while the
>>report is generated and send over the internet).  Is there a way I
>>can test if the socket is still open while I generate the report?
>>    
>>
>Again, I don't think so. Until you write to the outputstream and the 
>outputstream actually attempts to write to the underlying socket which 
>may not happen until it flushes its buffers you won't know if the 
>connection is still up. And if all this goes through a frontend like 
>Apache who knows what happens as the servlet outputstream actually goes 
>to the Apache connector and it is Apache who manages the connection to 
>the client browser.
>  
>




>  
>
>>>For example in a servlet
>>>type environment you could connect the fop outputstream directly to
>>>the servlet outputstream.
>>>      
>>>
>>I worked this problem a while ago .. but your telling my I don't need
>>to set the content length ?!  My solution need to work with IE too
>>...
>>
>>
>>Thanks for your help !
>>
>>/David
>>
>>    
>>
>>>My recommendation - just catch the exception and do any cleanup
>>>required.
>>>
>>>Manuel
>>>      
>>>
>
>Sorry, but it seems you are stuck with leaving it as it is know and just 
>deal with the exception.
>
><snip/>
>
>---------------------------------------------------------------------
>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: Is there a way to stop the creation of a PDF when the user close the browser windows?

Posted by Manuel Mall <mm...@arcus.com.au>.
On Wed, 21 Sep 2005 08:38 am, David Gagnon wrote:
> Hi thanks for you answer,
>
> >The short answer is no - there is no means in the FOP API to
> > interrupt a rendering run.
> >
> >The long answer is more like: it depends. What's your environment?
> > How do you invoke FOP? How do you serve the data to the client? For
> > example if you invoke FOP as a spawned process you could simply
> > kill it.
>
> It`s run in a servlet.

In that case you most likely can't interrupt it at least not with the 
published API.

>
> >You also said that you must wait for the report to be generated
> > before starting to send it. There is no intrinsic need to do that
> > but may be your application architecture requires that.
>
> No doesn`t need it but I thought it`s was a limitation of the
> environnement since we need to set the  Content Length in the anwser
> before sending the data i.e.:
> response.setContentLength(content.length);
>
> Is there a way to avoid that .. That will be so nice?
>
I don't think so if backwards compatibility with IE 5 and older browsers 
is important.

> I know when I generate an HTML report I get a
> java.net.SocketException when I close the browser window while the
> report is generated and send over the internet).  Is there a way I
> can test if the socket is still open while I generate the report?
Again, I don't think so. Until you write to the outputstream and the 
outputstream actually attempts to write to the underlying socket which 
may not happen until it flushes its buffers you won't know if the 
connection is still up. And if all this goes through a frontend like 
Apache who knows what happens as the servlet outputstream actually goes 
to the Apache connector and it is Apache who manages the connection to 
the client browser.

>
> >For example in a servlet
> >type environment you could connect the fop outputstream directly to
> > the servlet outputstream.
>
> I worked this problem a while ago .. but your telling my I don't need
> to set the content length ?!  My solution need to work with IE too
> ...
>
>
> Thanks for your help !
>
> /David
>
> >My recommendation - just catch the exception and do any cleanup
> >required.
> >
> >Manuel

Sorry, but it seems you are stuck with leaving it as it is know and just 
deal with the exception.

<snip/>

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


Re: Is there a way to stop the creation of a PDF when the user close the browser windows?

Posted by David Gagnon <dg...@siunik.com>.
Hi thanks for you answer,

>The short answer is no - there is no means in the FOP API to interrupt a 
>rendering run.
>
>The long answer is more like: it depends. What's your environment? How 
>do you invoke FOP? How do you serve the data to the client? For example 
>if you invoke FOP as a spawned process you could simply kill it.
>  
>

It`s run in a servlet. 


>You also said that you must wait for the report to be generated before 
>starting to send it. There is no intrinsic need to do that but may be 
>your application architecture requires that. 
>
No doesn`t need it but I thought it`s was a limitation of the 
environnement since we need to set the  Content Length in the anwser before
sending the data i.e.:
response.setContentLength(content.length);

Is there a way to avoid that .. That will be so nice?

I know when I generate an HTML report I get a java.net.SocketException 
when I close the browser window while the report is generated and send 
over the internet).  Is there a way I can test if the socket is still 
open while I generate the report?



>For example in a servlet 
>type environment you could connect the fop outputstream directly to the 
>servlet outputstream.
>  
>
I worked this problem a while ago .. but your telling my I don't need to 
set the content length ?!  My solution need to work with IE too ...


Thanks for your help !

/David


>My recommendation - just catch the exception and do any cleanup 
>required.
>
>Manuel
>On Wed, 21 Sep 2005 08:05 am, David Gagnon wrote:
>  
>
>>Hi all,
>>
>>  I think all have been said in the subject.  I have an application
>>and when I generate a report in PDF i must wait for the report to be
>>completed before starting to send it.  But if the user close the
>>browser window the report will continue until it`s finished.  I will
>>got an exception when I will start sending the report.
>>
>>Is there any way to stop processing when the user close it`s browser
>>windows ?
>>
>>Thanks for your help!!!
>>
>>/David
>>
>>---------------------------------------------------------------------
>>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
>
>
>  
>


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


Re: Is there a way to stop the creation of a PDF when the user close the browser windows?

Posted by Manuel Mall <mm...@arcus.com.au>.
The short answer is no - there is no means in the FOP API to interrupt a 
rendering run.

The long answer is more like: it depends. What's your environment? How 
do you invoke FOP? How do you serve the data to the client? For example 
if you invoke FOP as a spawned process you could simply kill it.

You also said that you must wait for the report to be generated before 
starting to send it. There is no intrinsic need to do that but may be 
your application architecture requires that. For example in a servlet 
type environment you could connect the fop outputstream directly to the 
servlet outputstream.

My recommendation - just catch the exception and do any cleanup 
required.

Manuel
On Wed, 21 Sep 2005 08:05 am, David Gagnon wrote:
> Hi all,
>
>   I think all have been said in the subject.  I have an application
> and when I generate a report in PDF i must wait for the report to be
> completed before starting to send it.  But if the user close the
> browser window the report will continue until it`s finished.  I will
> got an exception when I will start sending the report.
>
> Is there any way to stop processing when the user close it`s browser
> windows ?
>
> Thanks for your help!!!
>
> /David
>
> ---------------------------------------------------------------------
> 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


Is there a way to stop the creation of a PDF when the user close the browser windows?

Posted by David Gagnon <dg...@siunik.com>.
Hi all,

  I think all have been said in the subject.  I have an application and 
when I generate a report in PDF i must wait for the report to be 
completed before starting to send it.  But if the user close the browser 
window the report will continue until it`s finished.  I will got an 
exception when I will start sending the report.

Is there any way to stop processing when the user close it`s browser 
windows ?

Thanks for your help!!!

/David

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


Re: Can't get PNG images

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Please make sure that the JAI libraries are in the class path when you
run FOP. I assume they are currently not.

On 21.09.2005 01:37:08 Oosterbaan, Douglas S. (LNG-DAY) wrote:
> 
> For some reason, I'm not able to include PNG images in my PDF 
> documents.  I'm trying to use jai rather than jimi for this.
> I downloaded the fop0.20.5 source code and installed
> the jai_core.jar and jai_codec.jar files under the
> .../fop-0.20.5/lib directory, then built everything using build.sh.
> 
> Interestingly, in the messages coming out to the screen I saw:
> prepare-jimi:
> 
> prepare-jai:
>      [echo] JAI library is present. Installing JAI support.
> 
> But in the build.log that gets created I saw:
> prepare-jimi:
> 
> prepare-jai:
> 
> I don't know why the prepare-jai: target is different between the
> two, or if that's even what my problem is.  I understand the 
> jimi lib not being present since that's not distributed with the 
> source for licensing issues.
> 
> In my testing, I have a directory that contains jpg's, bmp's, and
> png's.  I'm able to pick up all of the jpg's and bmp's but not any
> of the png's.
> 
> FWIW, my fop.jar does contain at least the following JAI image class:
> 3698 Fri Aug 19 13:56:40 EDT 2005 org/apache/fop/image/JAIImage.class
> 
> Below is the relevant piece of FO, I'm placing this in the xsl-region-body:
> 
> <fo:block span="all" space-after="1em"/>
> <fo:block white-space-treatment="preserve" white-space-collapse="false"
> text-align="center" margin-left="0.833333in" margin-right="0.833333in"
> span="all" font-family="Times" font-size="10pt" color="#000000"
> font-weight="normal" font-style="normal" text-decoration="no-underline
> no-line-through" >
> <fo:external-graphic src="file:D:\workspace\fofiles\apolloImage_5.png"/>
> </fo:block>
> <fo:block span="all" />
> 
> Am I missing something that is preventing me from being able to get PNG
> images?
> 
> Thank you for any help you can provide.


Jeremias Maerki


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