I had this problem.  The solution: put "<?xml
version="1.0" encoding="UTF-8" ?>", although you
will also have to specify the XHTML DTD if the
parser is going to treat everything correctly...

The SAXmyHtmlHandler class only handex XHTML, not
normal HTML.  Luckily, converting from HTML to
XHTML isn't a very painful process.  

Checkout http://tidy.sourceforge.net/ . I believe
it is capable of doing the HTML to XHTML
conversion.

You may also want to check out:
http://itextpdf.sourceforge.net/

I've heard a rumor that Paulo's version has a
class called HTMLWorker, which is more robust
than SAXmyHtmlHandler.

--- adam <[EMAIL PROTECTED]> wrote:

> 
> 
> 
>  Date: 2004-10-08 17:55
>  From: adam
>  To: [EMAIL PROTECTED]
>  Subject: html to pdf iText
> 
> 
> 
>  To: [EMAIL PROTECTED]
>  From: [EMAIL PROTECTED]
>  Subject: html to pdf iText
> Message-ID:
> <[EMAIL PROTECTED]>
> X-Mailer: Calypso Version 3.30.00.00 (4)
> Date: Fri, 08 Oct 2004 17:55:36 +0200
> From: "adam" <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: html to pdf iText
> Mime-Version: 1.0
> Content-Type: multipart/alternative;
> boundary="=====_109725093641=_"
> 
> 
> Hi !
> i've got problems with iText
> I have following code:
> 
>     Document document = new Document();
>     PdfWriter pdfw = null;
> 
>          try {
>             pdfw =
> PdfWriter.getInstance(document, new
>
FileOutputStream("..\\webapps\\bank1\\files\\pdf\\adam.pdf"));
> 
>             document.open();
> 
>           SAXParser parser =
> SAXParserFactory.newInstance().newSAXParser();
>           SAXmyHtmlHandler htmlH =
>           new SAXmyHtmlHandler(document );
> 
>           parser.parse("c:\\t.htm",htmlH);
> 
>         }
>          catch(Exception e) {
>             
> System.err.println(e.getMessage());
>          }
> 
>          document.close();
> 
> I have found almost the same example
> (generating pdf) on mailing list,
> My code doesn't work
> It's exception:The document has no pages
> I think that should be good, becouse when I put
> string to pdf (document.add(new Paragraph("This
> is page "));)  it's good
> 
> thanks for any help
> duke
> 
> 



                
_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com


-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to