Hi, I want parse a XHTML to PDF this my XHTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title></title> </head> <body> <i>Prot. n.</i> <br/> <P style="TEXT-ALIGN: right">City, date</P> <br/> <P style="TEXT-ALIGN: right">Name</P> <P style="TEXT-ALIGN: right">Address</P> <P style="TEXT-ALIGN: right">zip, City</P> <br/><br/> <p><i>Object: Align text to right</i></p> </body> </html> and this JAVA CODE: Document document = new Document(PageSize.A4, 0, 0, 0, 0); try { FileInputStream fis = new FileInputStream("c:/letter.xhtml"); ByteArrayOutputStream baos = new ByteArrayOutputStream(); PdfWriter.getInstance(document, new FileOutputStream("c:/test1.pdf")); Tidy tidy = new Tidy(); tidy.setXHTML(true); tidy.setTidyMark(false); tidy.setMakeClean(true); tidy.parse(fis, baos); fis.close(); ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); baos.close(); //HtmlParser.parse(document, bais); SAXParser parser = SAXParserFactory.newInstance().newSAXParser(); parser.parse(bais, new SAXmyHtmlHandler(document)); FileOutputStream fos = new FileOutputStream(new File("c:/test1.html")); fos.write(baos.toByteArray()); } catch (Exception e) { e.printStackTrace(); System.err.println(e.getMessage()); } when parse the document the text with right align is aligned to left, I tried with the attribute "align" and use a tag div, but unable to align the text to the right, have you a solution?? Thanks ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://itext.ugent.be/itext-in-action/
