Not able to open generated pdf

View: New views
5 Messages — Rating Filter:   Alert me  

Not able to open generated pdf

by Amit Dave-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

Hi,

 

I am using iText with Struts in my web application. In my ajax request I am sending the html that should be converted to pdf by iText.

In the execute method, I get the html from the request and convert it to PDF using iText as shown in the example in the iText website: http://itextdocs.lowagie.com/tutorial/general/webapp/index.php

 

But the problem is that I am not able to open the generated pdf file, I have Adobe Reader 9 installed on my system and I am using iText2.1.

What is the action mapping I need to do in the config file for this action ?

What should my execute method return ?

 

Thanks a lot in advance.

 

Amit


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
iText-questions mailing list
iText-questions@...
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions: http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Re: Not able to open generated pdf

by Alexis Pigeon :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Amit,

2009/11/4 Amit Dave <Amit.Dave@...>

Hi,

 I am using iText with Struts in my web application. In my ajax request I am sending the html that should be converted to pdf by iText.

In the execute method, I get the html from the request and convert it to PDF using iText as shown in the example in the iText website: http://itextdocs.lowagie.com/tutorial/general/webapp/index.php

 

But the problem is that I am not able to open the generated pdf file, I have Adobe Reader 9 installed on my system and I am using iText2.1.

What is the action mapping I need to do in the config file for this action ?

What should my execute method return ?

What do you mean by not being able to open the file?
- That it throws an error in Adobe Reader?
 -> Have you tried saving the pdf file on the file system (on the server side) and opening it? With Adobe Reader? With another pdf reader?
- That nothing is returned to the browser?
 -> Have you followed step by step the tutorial you refer to? Have you tried with different browsers?

By answering these counter-questions, you'll help us help you.

Cheers,
alexis

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
iText-questions mailing list
iText-questions@...
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions: http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Re: Not able to open generated pdf

by 1T3XT info :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Amit Dave wrote:
> In the execute method, I get the html from the request and convert it to
> PDF using iText as shown in the example in the iText website:
> http://itextdocs.lowagie.com/tutorial/general/webapp/index.php

That page doesn't show how to convert HTML to PDF.
Have you tried writing a standalone application that generates the PDF?
If so: did that create a valid PDF?

> But the problem is that I am not able to open the generated pdf file,

Can you show us the generated PDF?
Is it a PDF file or some error message in HTML?

> I have Adobe Reader 9 installed on my system and I am using iText2.1.
> What is the action mapping I need to do in the config file for this action ?

Forget about Struts,
first try to have your app working in a web application without Struts.
PDF is a binary format.
Why would you use Struts to generate document in binary format?
Isn't that like eating soup with a fork instead of with a spoon?
--
This answer is provided by 1T3XT BVBA
http://www.1t3xt.com/ - http://www.1t3xt.info

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
iText-questions mailing list
iText-questions@...
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions: http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Re: Not able to open generated pdf

by Amit Dave-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

Hi Alexis,

 

I am expecting that a pdf reader to open up showing my html content in the pdf. Isin’t this possible ?

 

I do not get any error in the logs.

 

No, I am not saving the file, I just want to open up a pdf reader with the converted contents to the user and let user decide where to save it in its local system.

 

Yes I did follow the tutorial step by step and also tried it on different browsers.

 

Is it something related to where I am forwarding my response to the server is not correct. That is why the generated pdf is not opening up ?

 

Thanks,

Amit

From: Alexis Pigeon [mailto:pigeon.alexis@...]
Sent: Wednesday, November 04, 2009 9:52 PM
To: Post all your questions about iText here
Subject: Re: [iText-questions] Not able to open generated pdf

 

Hi Amit,

2009/11/4 Amit Dave <Amit.Dave@...>

Hi,

 I am using iText with Struts in my web application. In my ajax request I am sending the html that should be converted to pdf by iText.

In the execute method, I get the html from the request and convert it to PDF using iText as shown in the example in the iText website: http://itextdocs.lowagie.com/tutorial/general/webapp/index.php

 

But the problem is that I am not able to open the generated pdf file, I have Adobe Reader 9 installed on my system and I am using iText2.1.

What is the action mapping I need to do in the config file for this action ?

What should my execute method return ?

What do you mean by not being able to open the file?
- That it throws an error in Adobe Reader?
 -> Have you tried saving the pdf file on the file system (on the server side) and opening it? With Adobe Reader? With another pdf reader?
- That nothing is returned to the browser?
 -> Have you followed step by step the tutorial you refer to? Have you tried with different browsers?

By answering these counter-questions, you'll help us help you.

Cheers,
alexis


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
iText-questions mailing list
iText-questions@...
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions: http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Re: Not able to open generated pdf

by 1T3XT info :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Amit Dave wrote:
> Hi Alexis,
> I am expecting that a pdf reader to open up showing my html content in
> the pdf. Isin’t this possible ?

Thousands of developers have served iText generated PDFs to the browser
in thousands of applications. So it's possible.
Try for instance: http://itext.ugent.be/articles/filmfestival/

> I do not get any error in the logs.

Your initial question was phrased in a way that gave me doubts about
your code: I'm not convinced that you're generating a PDF file.

> No, I am not saving the file,

This is one major reason for my doubt: you're writing an application
that is supposed to produce a PDF and you haven't even tried to write a
standalone application that writes the PDF to a file first?
That should always be the first step. Once you have tested the
standalone example, it should be a piece of cake to integrate it into a
Java Servlet.

> I just want to open up a pdf reader with
> the converted contents to the user and let user decide where to save it
> in its local system.

That's the final step in the development process of your application.
Also, if it's Struts related, then the question is off-topic on this list.

> Yes I did follow the tutorial step by step and also tried it on
> different browsers.

That tutorial you are referring to is about serving PDF on the fly using
Servlets. The tutorial is obsolete compared to the book, but the
examples work.

> Is it something related to where I am forwarding my response to the
> server is not correct. That is why the generated pdf is not opening up ?

That sounds like a Struts question. Ask this on a Struts forum.
--
This answer is provided by 1T3XT BVBA
http://www.1t3xt.com/ - http://www.1t3xt.info

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
iText-questions mailing list
iText-questions@...
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions: http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/