Hi Michael,
I am using FileInputStream
inputStreamNew = new FileInputStream(tempFile);
On Fri, Jun 21, 2013 at 3:40 PM, <
itext-questions-requ...@lists.sourceforge.net> wrote:
> Send iText-questions mailing list submissions to
> itext-questions@lists.sourceforge.net
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://lists.sourceforge.net/lists/listinfo/itext-questions
> or, via email, send a message with subject or body 'help' to
> itext-questions-requ...@lists.sourceforge.net
>
> You can reach the person managing the list at
> itext-questions-ow...@lists.sourceforge.net
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of iText-questions digest..."
>
>
> Today's Topics:
>
> 1. java design pattern (Leo Donahue - RDSA IT)
> 2. Re: Generated PDF differs on Windows vs Linux (Jacob Certain)
> 3. Application stopped unexpectedly (Joed Cueto)
> 4. [SPAM] Re: Application stopped unexpectedly (mkl)
> 5. Re: Generated PDF differs on Windows vs Linux (iText Info)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Thu, 20 Jun 2013 12:54:26 -0700
> From: Leo Donahue - RDSA IT <leodona...@mail.maricopa.gov>
> Subject: [iText-questions] java design pattern
> To: "iText-questions@lists.sourceforge.net"
> <iText-questions@lists.sourceforge.net>
> Message-ID:
> <
> d72c174d3cac0a4e812fad012d646e9f255722c...@cms1.enterprise.maricopa.gov>
>
> Content-Type: text/plain; charset="us-ascii"
>
> iText5.4.0 - Java version
>
> I have the 2007 iText in Action text and I'm reading through chapter 17
> where it talks about using the ByteArrayOutputStream in web applications.
> I see the examples in the text show generating a pdf using a servlet and
> all the plumbing takes place in the servlet (PdfWriter, creating the
> document, adding content, etc...)
>
> I'm looking for some general design advice. My web interface is a JSF 2.0
> facelets template. My first attempt at jumping out of the JSF lifecycle to
> display a pdf was to create a bean (as a singleton) that holds the values
> for the pdf I'm trying to generate, and then populate that bean from the
> model and then from the servlet get an instance of that bean to populate
> the pdf cells.
>
> But I would really like to generate the pdf in the model using the
> ByteArrayOutputStream method described in the text. Then I can simply
> write that output stream to the ServletOutputStream and then I don't have
> to populate a bean for the sake of holding data for the pdf.
>
> Is this the wrong approach?
>
> I have a need to generate a pdf from roughly 40+ GIS datasets, which use
> cursors that one has to iterate over to get results, and I have access to
> all of those in the model. The reason I ask about the
> ByteArrayOutputStream is that on one of the pages, the author alludes to
> using this approach as a "pity", which makes me wonder if it is a huge
> performance hit? Trying to understand that comment.
>
> Leo
>
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
>
> ------------------------------
>
> Message: 2
> Date: Thu, 20 Jun 2013 13:08:12 -0700
> From: Jacob Certain <jcert...@gilbertschools.net>
> Subject: Re: [iText-questions] Generated PDF differs on Windows vs
> Linux
> To: Post all your questions about iText here
> <itext-questions@lists.sourceforge.net>
> Message-ID: <20130620200812.GA22050@jace.local>
> Content-Type: text/plain; charset=us-ascii
>
> On 2013-06-20 12:30, Thu, Cynthia Jeness wrote:
> > No, we are not embedding. We defined the font as the Helvetica family
> > along with the font size and style in a separae parameter file and then
> > create the font as follows:
>
> If you're not embedding the font, then the font actually rendered might
> have properties that you're not expecting. Like, the actual font's
> metrics might be different enough to break the rest of your code's
> expectations.
>
> Also, it's difficult to say why you're getting the wrong behaviour
> without seeing your code. Making a simple example of the problem would
> be useful: http://www.sscce.org/
> .
>
>
>
> ------------------------------
>
> Message: 3
> Date: Fri, 21 Jun 2013 03:47:19 +0800
> From: Joed Cueto <joed.cu...@pointwest.com.ph>
> Subject: [iText-questions] Application stopped unexpectedly
> To: itext-questions@lists.sourceforge.net
> Message-ID:
> <CA+ewT9XYHnVtdVJpb=An-LEs5_2EbtSa7gZ1=
> srm3wdbd6b...@mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hi,
>
> I have an application that convert an inputSteam to pdf. Below is the
> content of the method that converts input stream to pdf. However, the
> application suddenly stopped on line "*RandomAccessFileOrArray ra = new
> RandomAccessFileOrArray(inputStream);" *without throwing any error or
> exception which is kind of weird. Is it a known bug, can you give some
> solution for this?? Thank you.. Badly needed. Please help
>
> Code Content >>>>
>
> ByteArrayOutputStream baosPDF = new ByteArrayOutputStream();
>
> try
> {
> Document document = new Document(PageSize.A4);
> PdfWriter.getInstance(document, baosPDF);
> log.info("Document.open");
> document.open();
>
> *RandomAccessFileOrArray ra = new RandomAccessFileOrArray(inputStream);*
> int pages = TiffImage.getNumberOfPages(ra);
> for(int i = 1; i <= pages; i++){
> Image img = TiffImage.getTiffImage(ra, i);
> if((img.getScaledWidth() > 525) || (img.getScaledHeight() > 800))
> {
> img.scaleToFit(525, 800);
> }
> document.add(img);
> }
> document.close();
> }
> catch (DocumentException de)
> {
> log.error(de.getMessage());
> throw de;
> }
> catch (IOException ioe)
> {
> log.error(ioe.getMessage());
> throw ioe;
> }
> catch (Exception ex){
> log.error(ex.getMessage());
> throw ex;
> }
>
> return baosPDF;
>
> --
>
> Joed G. Cueto
> Software Engineer, Java Practice
> Business: +632 814 1100
> Email: joed.cu...@pointwest.com.ph
> Website: www.pointwest.com.ph
> Pointwest Technologies Corporation
> [image: Pointwest Logo]
> 12/F Citibank Center, 8741 Paseo de Roxas, Makati City, PH 1226
>
> CONFIDENTIALITY NOTICE: This email may contain confidential and privileged
> material for the sole use of the intended recipient(s). Any review, use,
> distribution or disclosure by others is strictly prohibited. If you have
> received this communication in error, please notify the sender immediately
> by e-mail and delete the message and any file attachments from your
> computer. There is no warranty that this email is error, virus or defect
> free. If this is a private communication it does not represent the views of
> Pointwest Technologies Corporation or their related entities.
> -------------- next part --------------
> An HTML attachment was scrubbed...
>
> ------------------------------
>
> Message: 4
> Date: Fri, 21 Jun 2013 00:12:31 -0700 (PDT)
> From: mkl <m...@wir-sind-cool.org>
> Subject: [iText-questions] [SPAM] Re: Application stopped unexpectedly
> To: itext-questions@lists.sourceforge.net
> Message-ID: <1371798751002-4658576.p...@n4.nabble.com>
> Content-Type: text/plain; charset=us-ascii
>
> Joed Cueto,
>
> Joed Cueto wrote
> > I have an application that convert an inputSteam to pdf. Below is the
> > content of the method that converts input stream to pdf. However, the
> > application suddenly stopped on line "*RandomAccessFileOrArray ra = new
> > RandomAccessFileOrArray(inputStream);" *without throwing any error or
> > exception which is kind of weird. Is it a known bug, can you give some
> > solution for this?? Thank you.. Badly needed. Please help
>
> The RandomAccessFileOrArray constructor you use attempts to fully read the
> stream in question into a byte[] until the stream signals its end. Then the
> constructor initialize its instance with this byte[] and returns only
> thereafter. Thus, this constructor is not suited for all kinds of
> InputStreams, only for streams with a clear cut end and fast access.
>
> What kind of InputStream do you use?
>
> Regards, Michael
>
>
>
> --
> View this message in context:
> http://itext-general.2136553.n4.nabble.com/Application-stopped-unexpectedly-tp4658575p4658576.html
> Sent from the iText - General mailing list archive at Nabble.com.
>
>
>
> ------------------------------
>
> Message: 5
> Date: Fri, 21 Jun 2013 09:40:33 +0200
> From: iText Info <i...@1t3xt.info>
> Subject: Re: [iText-questions] Generated PDF differs on Windows vs
> Linux
> To: Post all your questions about iText here
> <itext-questions@lists.sourceforge.net>
> Message-ID: <51c40371.1090...@1t3xt.info>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> Op 20/06/2013 18:30, Cynthia Jeness schreef:
> > No, we are not embedding. We defined the font as the Helvetica family
> > along with the font size and style in a separae parameter file and then
> > create the font as follows:
> >
> > Font font = new Font(FontFactory.getFont(
> > item.getFont().family,
> > fontSize,
> > item.getFont().style));
> >
> > Then we set it in the chunk that we are creating.
>
> Please take a look at figure 2.4 in this chapter:
> http://www.manning.com/lowagie2/samplechapter2.pdf
>
> Then read the text that comes with the figure.
> Does this describe the problem you're seeing?
> Or are you talking about something completely different?
> (Because you're not entirely clear in your question.)
>
>
>
> ------------------------------
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Windows:
>
> Build for Windows Store.
>
> http://p.sf.net/sfu/windows-dev2dev
>
> ------------------------------
>
> _______________________________________________
> 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
>
> End of iText-questions Digest, Vol 85, Issue 30
> ***********************************************
>
--
Joed G. Cueto
Software Engineer, Java Practice
Business: +632 814 1100
Email: joed.cu...@pointwest.com.ph
Website: www.pointwest.com.ph
Pointwest Technologies Corporation
[image: Pointwest Logo]
12/F Citibank Center, 8741 Paseo de Roxas, Makati City, PH 1226
CONFIDENTIALITY NOTICE: This email may contain confidential and privileged
material for the sole use of the intended recipient(s). Any review, use,
distribution or disclosure by others is strictly prohibited. If you have
received this communication in error, please notify the sender immediately
by e-mail and delete the message and any file attachments from your
computer. There is no warranty that this email is error, virus or defect
free. If this is a private communication it does not represent the views of
Pointwest Technologies Corporation or their related entities.
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:
Build for Windows Store.
http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
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