RE: [Fckitext-support] HTML to PDF
Status: Beta
Brought to you by:
vungoctan
|
From: Tan Vu N. <vun...@ya...> - 2004-06-30 01:30:08
|
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 > > > org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:658) > > at > > > org.apache.crimson.parser.Parser2.parse(Parser2.java:333) > > at > > > org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448) > > at > > > javax.xml.parsers.SAXParser.parse(SAXParser.java:345) > > at > > > javax.xml.parsers.SAXParser.parse(SAXParser.java:223) > > at > > > TesteHandlerKoreano.main(TesteHandlerKoreano.java:67) > > For input string: "+3" > > > > Is there any way to make the SaxParser ignore > these > > inputs? > > > > Thanks, > > Luiz > > > > > > --- > > Outgoing mail is certified Virus Free. > > Checked by AVG anti-virus system > > (http://www.grisoft.com). > > Version: 6.0.710 / Virus Database: 466 - Release > > Date: 23/6/2004 > > > > > > > > > > > ------------------------------------------------------- > > This SF.Net email sponsored by Black Hat Briefings > & > > Training. > > Attend Black Hat Briefings & Training, Las Vegas > > July 24-29 - > > digital self defense, top technical experts, no > > vendor pitches, > > unmatched networking opportunities. Visit > > www.blackhat.com > > _______________________________________________ > > Fckitext-support mailing list > > Fck...@li... > > > https://lists.sourceforge.net/lists/listinfo/fckitext-support > > > > > > > __________________________________ > Do you Yahoo!? > Yahoo! Mail - 50x more storage than other providers! > http://promotions.yahoo.com/new_mail > > > ------------------------------------------------------- > This SF.Net email sponsored by Black Hat Briefings & > Training. > === message truncated === __________________________________ Do you Yahoo!? Yahoo! Mail - Helps protect you from nasty viruses. http://promotions.yahoo.com/new_mail |