  | Mailing List | | Home | | Forum Home | | JBoss - Java Application Server | | Tomcat - JSP/Servlet container | | Struts - A MVC web framework | | iText - An open source PDF Java Library | | JDOM - JDOM XML Parser | | J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition | | J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog | | JSP - A mailing list about Java Server Pages specification and reference | | Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology | |
Struts & Hibernate
|
|
|
  | | | 2 czech Characters getting lost when parsingthrough IText | 2 czech Characters getting lost when parsingthrough IText 2006-07-22 - By Paulo Soares
Back
-- -- Original Message -- -- From: "Bela Sharma" <belaSharma@(protected)> To: <itext-questions@(protected)> Sent: Friday, July 21, 2006 10:47 AM Subject: [iText-questions] 2 czech Characters getting lost when parsingthrough IText
> Hi > I get a strange issue with 2 of the czech characters when generating PDF > using IText version 1.4.2. > When customerNumber=Pr??erne ?lutouck? is sent as as input to IText after > doing following steps > // Step 1: creation of a document-object > document = new Document(PageSize.A4); > > // step 2: create a writer that listens to the document > writer = PdfWriter.getInstance(document, baos); > // step 3: we create a parser and set the document handler > parser = > SAXParserFactory.newInstance().newSAXParser(); > InputSource isrc = new InputSource(bais); > isrc.setEncoding(getEncodingType()); > CustomTagHandler cth= new > CustomTagHandler(document, writer, getCustomMap(),"ISO-8859 (See http://ISO-8859.ora-code.com)-2"); > > // step 4: we parse the document > parser.parse(isrc,cth); > System.out.println(" in GenericContracttoPdfconv. > parser:"+parser.toString()); > // step 5: close the document object > document.close(); > > The 2 characters ? and ? are lost and we get boxes in their place. > > Here's the constructor for CustomTagHandler > > public CustomTagHandler(DocListener _doclistener, PdfWriter > _writer,HashMap hashmap,String encoding_loc)throws DocumentException, > IOException > { > super(_doclistener); > > setStrMethodName("CustomTagHandler"); /* NOI18N */ > fillLocaleFont(); > > if (encoding_loc.indexOf("-locale-") != -1){ > position = encoding_loc.indexOf("-locale-"); > System.out.println("CTH sit_loc:"+encoding_loc+" > pos:"+position); > encoding = encoding_loc.substring(0, position); > locale = encoding_loc.substring(position+8); > System.out.println("CTH enc:"+encoding+" locale:" > +locale); > }else{ > encoding = encoding_loc; > System.out.println("CTH enco:"+encoding); > } > > > filename=getFontFile(locale); > setBaseFont(BaseFont.createFont(filename, > encoding,BaseFont.EMBEDDED)); > setMyTags(hashmap); > setWriter(_writer); > setDoclistener(_doclistener); > setCb(_writer.getDirectContent()); > stackThis = new java.util.Stack (); > isStackReadyForText = false; > leftText = null; > centerText = null; > rightText = null; > > > } > > Can you please guide us as to what should we do for those 2 missing > characters.
Use a font and encoding that covers the two characters.
Paulo
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV __ ____ ____ ____ ____ ____ ____ ____ ____ ____ iText-questions mailing list iText-questions@(protected) https://lists.sourceforge.net/lists/listinfo/itext-questions
|
|
 |