RE: [Fckitext-support] HTML to PDF
Status: Beta
Brought to you by:
vungoctan
|
From: taa b. <dan...@ya...> - 2004-06-30 01:45:18
|
Hi, I found this source code in the http://www.lowagie.com/iText/tutorial/ch07.html <!DOCTYPE ITEXT SYSTEM "http://itext.sourceforge.net/itext.dtd"> I did not use it anywhere in my project so it is better to be ignored 1-Just remove this tag in the html source..tidy will have some problem to process this 2-(not prefered) Add ignore code in the NesoneSAXHtmlHandler ::startElement .... if (name.equalsIgnoreCase("doctype")) /* i am not sure at this line of code..but please send me your output.out.. i will consider...you can try to change the doctype to some thing relevent...need some more testing */ { System.out.println("NesoneSAXHtmlHandler - startElement - isTitle - We do nothing with " + name ); // we do nothing return; } ............ hope this help --- Tan Vu Ngoc <vun...@ya...> wrote: > Hi, > > Please consider those code as a reference..It > suceed!! > > You might need to change your data encoding to > > tidy.setCharEncoding(Configuration.LATIN1); > > Add this code to > > http://www.lowagie.com/iText/tutorial/ch07.html > > <?xml version="1.0" encoding="ISO-8859-1"?> > > and below is some reference > > ==================================================== > //BEGIN:tidy up HTML code to XML-like > FileInputStream in; > FileOutputStream out; > > Tidy tidy = new Tidy(); > > try { > tidy.setErrout(new PrintWriter(new > FileWriter(errOutFileName), true)); > > in = new FileInputStream(fileTestName); > > out = new FileOutputStream(outValidFileName); > tidy.setXmlOut(true); > tidy.setUpperCaseTags(false); > tidy.setUpperCaseAttrs(false); > tidy.setQuoteNbsp(false); > tidy.setQuoteAmpersand(false); > tidy.setNumEntities(true); > tidy.setCharEncoding(Configuration.LATIN1); > tidy.parse(in, out); > > } > catch ( IOException eio ) { > throw eio; > } > in.close(); > out.close(); > //END:tidy up HTML code to XML-like > > > Hope this help > > Vu Ngoc Tan > > http://www.vietclever.com > http://www.sinhcafe.net > http://www.pdfone.net > > --- Luiz Fernando Rodrigues > <lfr...@te...> wrote: > > Here is my source, I pass to the SaxParser the > > output of tidy. The > > problem is that the parser tells that the DocType > in > > output.out is not > > ok. Once I edit the output.out the parser works. > Is > > there a way to make > > tidy not write in output.out the Doctype? I tried > > the method setDocType > > but it doesn't seem to work. > > > > Thanks in advance, > > Luiz > > > > FileOutputStream out = new > > FileOutputStream("output.pdf"); > > PdfWriter writer = PdfWriter.getInstance(document, > > out); > > SAXParser parser = > > SAXParserFactory.newInstance().newSAXParser(); > > > > URL url = new > > > URL("http://www.lowagie.com/iText/tutorial/ch07.html"); > > InputStream in = url.openStream(); > > InputSource is = new InputSource(in); > > > > //my private method that generates the output of > > tidy > > tidy(in,"output.out"); > > > > parser.parse("output.out",new > > NesoneSAXHtmlHandler(document,null,writer)); > > > > > > > > //tidy method > > private static void tidy(InputStream in, String > > output) > > { > > FileOutputStream out; > > Tidy tidy = new Tidy(); > > > > try { > > tidy.setErrout(new PrintWriter(new > > FileWriter("tidy.error"), > > true)); > > out = new FileOutputStream(output); > > > > > > tidy.setXmlOut(true); > > tidy.setUpperCaseTags(true); > > tidy.setUpperCaseAttrs(true); > > tidy.setQuoteNbsp(false); > > tidy.setQuoteAmpersand(false); > > tidy.setNumEntities(true); > > tidy.setCharEncoding(Configuration.UTF8); > > tidy.parse(in, out); > > > > } > > catch ( IOException eio ) > > { > > eio.printStackTrace(); > > } > > } > > > > -----Original Message----- > > From: fck...@li... > > > [mailto:fck...@li...] > > On Behalf Of taa > > boo > > Sent: segunda-feira, 28 de junho de 2004 21:48 > > To: Luiz Fernando Rodrigues; > > fck...@li... > > Subject: Re: [Fckitext-support] HTML to PDF > > > > Here is documents about HtmlTidy > > > > http://www.w3.org/People/Raggett/tidy/ > > > > I really don't understand your situation with > > DocType > > tag...where did I use that also!!! > > > > Could yould please send me your source code to > show > > how did you use Html2Pdf???? > > > > I only have NesoneHtmlParser, NesoneSAXHtmlHandler > > and > > Html2Pdf. They are main players > > > > You need to download Html2Pdf.exe and Sample > Package > > at > > > > > http://www.pdfone.net/opensource/nesonewysiwyg_html2pdf/index.php? > > > > sample of how to use Html2Pdf.jar can be found > > inside > > FCKitext version 1.1 at > > > > http://www.pdfone.net > > > > > > tell me if you can start with those stuffs > > succesfully > > > > best regards, > > > > Vu ngoc tan > > > > --- Luiz Fernando Rodrigues > > <lfr...@te...> wrote: > > > Dear Taa Boo, > > > > > > I'm using your handler but I'm not having > success > > > in making > > > SaxParser work with it. I think the problem is > > with > > > the DocType that > > > tidy writes into its output file. Please, where > > can > > > I find the Tidy > > > documentation of the .jar you are using with > > > Html2PDF example? > > > When I remove the DocType tag from Tidy's > output > > I > > > get an > > > exception complaining about the kind of String > the > > > parser receives: > > > > > > java.lang.NumberFormatException: For input > string: > > > "+3" > > > at > === message truncated === __________________________________ Do you Yahoo!? Yahoo! Mail - 50x more storage than other providers! http://promotions.yahoo.com/new_mail |