I'm using the 5.0.7-SNAPSHOT.

-----Original Message-----
From: Mark Storer [mailto:msto...@autonomy.com]
Sent: Thu 3/17/2011 5:42 PM
To: Post all your questions about iText here
Subject: Re: [iText-questions] java.lang.OutOfMemoryError
 
It looks like JPXDecode (JPEG2000) was added between 2.x and the current
release.  What version are you using?
 
--Mark Storer
  Senior Software Engineer
  Cardiff.com
 
import legalese.Disclaimer;
Disclaimer<Cardiff> DisCard = null;
 
 


________________________________

        From: Martin Schwartzman [mailto:mschwartz...@ittvis.com] 
        Sent: Thursday, March 17, 2011 2:55 PM
        To: Post all your questions about iText here
        Subject: Re: [iText-questions] java.lang.OutOfMemoryError
        
        

        I'm testing with a j2c code stream.

         

        From: Mark Storer [mailto:msto...@autonomy.com] 
        Sent: Thursday, March 17, 2011 3:06 PM
        To: Post all your questions about iText here
        Subject: Re: [iText-questions] java.lang.OutOfMemoryError

         

        What format is the image in?  IIRC, JPEG files are pretty much
copied verbatium, while other formats need to be parsed and coverted and
so forth.  I'm guessing that JPEG images will have a smaller memory
footprint.

         

        --Mark Storer

          Senior Software Engineer

          Cardiff.com

         

        import legalese.Disclaimer;

        Disclaimer<Cardiff> DisCard = null;

         

         

                 

                
________________________________


                From: Martin Schwartzman
[mailto:mschwartz...@ittvis.com] 
                Sent: Thursday, March 17, 2011 11:52 AM
                To: itext-questions@lists.sourceforge.net
                Subject: [iText-questions] java.lang.OutOfMemoryError

                The OutOfMemoryError occurs at the cb.addImage(img)
line. The image I'm trying to write is about 210,703 KB. I'm running the
below code fragment from a Servlet in JBOSS-5.0.1.GA, Itextpdf-5.0.7,
and java version "1.6.0_20".

                 

                I'm wondering if there is a simple fix to this problem
like turning streaming to disk on for large images which I've read does
occur so I'm not sure what the problem is. This problem does not occur
in a standalone Java class but so far only when run in my servlet
container. I'm running the 32 bit version of JBOSS so I can't up the VM
(-Xms1280m -Xmx1280m) memory any more then I already have. The images
are only going to get bigger.

                 

                java.lang.OutOfMemoryError

                        at java.io.FileOutputStream.writeBytes(Native
Method)

                        at
java.io.FileOutputStream.write(FileOutputStream.java:260)

                        at
java.io.BufferedOutputStream.write(BufferedOutputStream.java:105)

                        at
com.itextpdf.text.pdf.OutputStreamCounter.write(OutputStreamCounter.java
:157)

                        at
java.io.ByteArrayOutputStream.writeTo(ByteArrayOutputStream.java:109)

                        at
com.itextpdf.text.pdf.PdfStream.toPdf(PdfStream.java:353)

                        at
com.itextpdf.text.pdf.PdfIndirectObject.writeTo(PdfIndirectObject.java:1
57)

                        at
com.itextpdf.text.pdf.PdfWriter$PdfBody.add(PdfWriter.java:396)

                        at
com.itextpdf.text.pdf.PdfWriter$PdfBody.add(PdfWriter.java:376)

                        at
com.itextpdf.text.pdf.PdfWriter$PdfBody.add(PdfWriter.java:329)

                        at
com.itextpdf.text.pdf.PdfWriter.addToBody(PdfWriter.java:780)

                        at
com.itextpdf.text.pdf.PdfWriter.add(PdfWriter.java:3096)

                        at
com.itextpdf.text.pdf.PdfWriter.addDirectImageSimple(PdfWriter.java:3071
)

                        at
com.itextpdf.text.pdf.PdfWriter.addDirectImageSimple(PdfWriter.java:2998
)

                        at
com.itextpdf.text.pdf.PdfContentByte.addImage(PdfContentByte.java:1228)

                        at
com.itextpdf.text.pdf.PdfContentByte.addImage(PdfContentByte.java:1110)

                        at
com.itextpdf.text.pdf.PdfContentByte.addImage(PdfContentByte.java:1094)

                 

                Code fragment:

                PdfWriter writer = PdfWriter.getInstance(document, new
FileOutputStream(outPutFile));                      

                document.open();        

                PdfContentByte cb = writer.getDirectContent();

                Image img = Image.getInstance(firstImageName);

                PdfLayer group = new PdfLayer("Layers", writer);

                PdfLayer layer1 = new PdfLayer("image", writer);

                group.addChild(layer1);

                cb.beginLayer(group);

                cb.endLayer();

                cb.beginLayer(layer1);

                cb.addImage(img); // the addImage where the out of
memory occurs

                cb.endLayer();

                document.close();

                 

                 

                Thanks.

                 

                 


<<winmail.dat>>

------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to