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 "Moses, John {PBSG}" <Jo...@pbsg.com> on 2007/06/14 23:27:23 UTC

Help in removing cached image files - FOP 0.93

Hi,
        
I have an application that uses FOP 0.93 to render JPEG Images in a PDF
document. Each of these Images are unique for a document and never
reused within the same PDF.

I create a PDF of these images roughly 800 images in a PDF. Everytime I
generate this PDF, I end up adding 800 more images in my temp
directory(.tmp files).

My problem now is, as these temp files grow and reach the per process
limit of Weblogic, weblogic can't create any more cache file and
eventually stops listening to my port(error is 'Too many open files'
<BEA-110017>)

I would like to know how I can clear the image cache. I tried using
getImageFactory().clearCaches() of my FopFactory instance and still
doesn't clear the tmp files.

Appreciate any pointers with this.
        
Regards
John Moses

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


Re: Help in removing cached image files - FOP 0.93

Posted by mjohnben <Jo...@pbsg.com>.
Hi,

I tried the option you had suggested(switched the "addProvider" and
recompiled FOP...I also tried with imt.addProvider(jpegImageIOImage)
commented). Didn't make any difference.

Yes. I have only one page-sequence and i use with "page x of y".

I use fo:external-graphic and i use a servlet to pipe my image thats stored
as BLOB in my DB.

Do i have any other options to either clear the image files OR prevent FOP
from creating these tmp files?

Appreciate your help.

Regards,
John


Jeremias Maerki-2 wrote:
> 
> Clearing the cache won't help in this case. The problem is that your
> images are probably all in the same page-sequence. Together with a "page
> x of y" and the fact that ImageIO's JPEG codec copies the JPEG to a
> local temp file for decoding I guess that could easily lead to 800 open
> files.
> 
> Please try the following: Change org.apache.fop.image.ImageFactory
> (around line 94) like this:
> 
> current:
>         imt = new ImageMimeType("image/jpeg");
>         imageMimeTypes.put(imt.getMimeType(), imt);
>         imt.addProvider(jpegImageIOImage);
>         imt.addProvider(jpegImage);
> 
> change to:
>         imt = new ImageMimeType("image/jpeg");
>         imageMimeTypes.put(imt.getMimeType(), imt);
>         imt.addProvider(jpegImage);
>         imt.addProvider(jpegImageIOImage);
> 
> (i.e. switch the two lines with "addProvider" so the "jpegImage" comes
> before "jpegImageIOImage"). Since you're generating PDF you don't need
> the ImageIO variant (i.e. an actual JPEG codec). Using the other JPEG
> provider will not create any temp files and should therefore solve your
> problem. No guarantees, though.
> 
> Of course, you'll need to recompile FOP after the change. Let us know if
> it helps.
> 
> PS: Please don't cross-post to all mailing lists when asking a question.
> It's fully sufficient to just post to fop-users@xmlgraphics.apache.org.
> I've only moderated through the message to fop-users.
> 
> On 14.06.2007 23:27:23 Moses, John {PBSG} wrote:
>> Hi,
>>         
>> I have an application that uses FOP 0.93 to render JPEG Images in a PDF
>> document. Each of these Images are unique for a document and never
>> reused within the same PDF.
>> 
>> I create a PDF of these images roughly 800 images in a PDF. Everytime I
>> generate this PDF, I end up adding 800 more images in my temp
>> directory(.tmp files).
>> 
>> My problem now is, as these temp files grow and reach the per process
>> limit of Weblogic, weblogic can't create any more cache file and
>> eventually stops listening to my port(error is 'Too many open files'
>> <BEA-110017>)
>> 
>> I would like to know how I can clear the image cache. I tried using
>> getImageFactory().clearCaches() of my FopFactory instance and still
>> doesn't clear the tmp files.
>> 
>> Appreciate any pointers with this.
>>         
>> Regards
>> John Moses
> 
> 
> 
> Jeremias Maerki
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Help-in-removing-cached-image-files---FOP-0.93-tf3925802.html#a11183373
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: Help in removing cached image files - FOP 0.93

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Clearing the cache won't help in this case. The problem is that your
images are probably all in the same page-sequence. Together with a "page
x of y" and the fact that ImageIO's JPEG codec copies the JPEG to a
local temp file for decoding I guess that could easily lead to 800 open
files.

Please try the following: Change org.apache.fop.image.ImageFactory
(around line 94) like this:

current:
        imt = new ImageMimeType("image/jpeg");
        imageMimeTypes.put(imt.getMimeType(), imt);
        imt.addProvider(jpegImageIOImage);
        imt.addProvider(jpegImage);

change to:
        imt = new ImageMimeType("image/jpeg");
        imageMimeTypes.put(imt.getMimeType(), imt);
        imt.addProvider(jpegImage);
        imt.addProvider(jpegImageIOImage);

(i.e. switch the two lines with "addProvider" so the "jpegImage" comes
before "jpegImageIOImage"). Since you're generating PDF you don't need
the ImageIO variant (i.e. an actual JPEG codec). Using the other JPEG
provider will not create any temp files and should therefore solve your
problem. No guarantees, though.

Of course, you'll need to recompile FOP after the change. Let us know if
it helps.

PS: Please don't cross-post to all mailing lists when asking a question.
It's fully sufficient to just post to fop-users@xmlgraphics.apache.org.
I've only moderated through the message to fop-users.

On 14.06.2007 23:27:23 Moses, John {PBSG} wrote:
> Hi,
>         
> I have an application that uses FOP 0.93 to render JPEG Images in a PDF
> document. Each of these Images are unique for a document and never
> reused within the same PDF.
> 
> I create a PDF of these images roughly 800 images in a PDF. Everytime I
> generate this PDF, I end up adding 800 more images in my temp
> directory(.tmp files).
> 
> My problem now is, as these temp files grow and reach the per process
> limit of Weblogic, weblogic can't create any more cache file and
> eventually stops listening to my port(error is 'Too many open files'
> <BEA-110017>)
> 
> I would like to know how I can clear the image cache. I tried using
> getImageFactory().clearCaches() of my FopFactory instance and still
> doesn't clear the tmp files.
> 
> Appreciate any pointers with this.
>         
> Regards
> John Moses



Jeremias Maerki


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