This is in continuation of the issue I was having last week(unable to generate pdf from jsp). And I have know choice due to limitations in the technology we are using. I have to use JSP, though its not great to generate binary output.
ExceptionConverter: java.io.IOException: The document has no pages.
though test5 message is returning true, seems like page is not getting created, i am not sure what is the problem, I am new to this, is there a work around, also is there any setups needed to be done on the sever or should the server have adobe or anything installed?
I put all my JSP files under the OA_HTML folder of oracle apache server, This is a part of oracle apps.
I would appreciate any suggestions, tips or help on this issue. Thanks
Last week I was able to open some file but file name was getting created with illegal characters and starting with %PDF, now this is another issue, Thanks in advance for any suggestion or help.
Regards,
Satish
<%@
page import="java.io.*,
com.lowagie.text.*,
com.lowagie.text.pdf.*"
%><%
//
// Template JSP file for iText
// by Tal Liron
//
out.println("TEST1");
response.setContentType( "application/pdf" );
// step 1: creation of a document-object
Document document = new Document();
out.println("TEST2");
// step 2:
// we create a writer that listens to the document
// and directs a PDF-stream to a temporary buffer
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
PdfWriter.getInstance( document, buffer );
out.println("TEST3");
// step 3: we open the document
document.open();
out.println("test4");
// step 4: we add a paragraph to the document
boolean test5= false;
test5 = document.add(new Paragraph("Hello World"));
out.println(test5);
// step 5: we close the document
document.close();
out.println("test6");
// step 6: we output the writer as bytes to the response output
DataOutput output = new DataOutputStream( response.getOutputStream() );
byte[] bytes = buffer.toByteArray();
response.setContentLength(bytes.length);
for( int i = 0; i < bytes.length; i++ ) { output.writeByte
( bytes[i] ); }
%>
HiThanks for the reply, I did not realize that, I will try the same and get back . Appreciate your feedback.Regards,Satish
On 7/20/06, Bruno Lowagie < [EMAIL PROTECTED]> wrote:Satish wrote:
> Here is my code -- helloworld.jsp- same as what is available in the
> itext tutorial
>
>
> <%@ page import="java.io.*"%>
> <%@ page import="com.lowagie.text.*"%>
> <%@ page import="com.lowagie.text.pdf.*"%>
>
No, it is ABSOLUTELY NOT the same as in the tutorial:
I see lots of newline characters and spaces.
Those are forbidden!
Because you have these newline characters,
the PDF doesn't start with %PDF
br,
Bruno
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions