HI Paulo,

Thanks for your reply. But how will ByteArrayInputStream help me. I have
HTML data(HTML Code) in StringBuffer.

In the following code, The last line is responsible for parsing given html
file and generating pdf data into ByteArrayOutputStream.

//OutputStream which will contain output pdf data
ByteArrayOutputStream  objByte = new ByteArrayOutputStream();

//Document object
Document document = new Document(PageSize.A4, 80, 50, 30, 65);

//PDFWriter to get PDF output
PdfWriter.getInstance(document, objByte);

//This html will be parsed and set into document.
HtmlParser.parse(document, "Chap0702.html");


This is where I have problem. I don't have an HTML file containing my HTML
code rather there is a StringBuffer containing HTML code. I don't want to
create a temporary HTML file to store HTML code contained by StringBuffer.
So rather than a file containing HTML, I have a StringBuffer containing
HTML(In the above scenario StringBuffer will contain the contents of file
Chap0702.html). How would ByteArrayInputStream help me?

Can you please elaborate your solution?


Regards,
Achhar Singh
----- 9 October 2003 5:22 PM ------

 -----Original Message-----
From:   Paulo Soares [mailto:[EMAIL PROTECTED]
Sent:   Thursday, October 09, 2003 4:33 PM
To:     '[EMAIL PROTECTED]'; [EMAIL PROTECTED]
Subject:        RE: [iText-questions] Generating PDF from StringBuffer

Use a ByteArrayInputStream.

Best Regards,
Paulo Soares

> -----Original Message-----
> From: Achhar Singh (Patni - GE GDC) [SMTP:[EMAIL PROTECTED]
> Sent: Thursday, October 09, 2003 7:29
> To:   [EMAIL PROTECTED]
> Subject:      [iText-questions] Generating PDF from StringBuffer
> Importance:   High
>
> Hi,
>
> I have just started exploring itext for generating PDF from html file. I
> tried using a servlet and itext to generate pdf from an html page stored
> on
> server and displaying it in browser, which worked.
>
> In my case there is a method in java file which returns me a StringBuffer
> containing the HTML code, which I want to convert to pdf.
>
> One option is to create a temporary HTML file on server and dump the
> StringBuffer in it and then convert it to PDF. But this will involve lot
> of
> I/O operations(file writing), which I don't want to do.
>
> What I want to know is there any way by which I can generate pdf, using
> the
> StringBuffer containing the HTML code?
>
> Would appreciate an early solution/sample code to do this.
>
> Thanks in advance.
>
> Regards,
> Achhar Singh
> ----- 9 October 2003 11:42 AM ------
>
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: SF.net Giveback Program.
> SourceForge.net hosts over 70,000 Open Source Projects.
> See the people who have HELPED US provide better services:
> Click here: http://sourceforge.net/supporters.php
> _______________________________________________
> iText-questions mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/itext-questions



-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
SourceForge.net hosts over 70,000 Open Source Projects.
See the people who have HELPED US provide better services:
Click here: http://sourceforge.net/supporters.php
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to