Hi,

I'm trying to parse an XML file and generate a corresponding PDF file just
like it is done in chapter 7 example 2 in the iText tutorial.

Is there any way to add a barcode, for example Code 39, to the PDF file?
I don't want to change the method of generating, it's very convinient in my
situation.

My code:

 private void XmlToPdf() throws Exception {
        try {
               FontFactory.register(".\\fonts\\times.ttf");
               FontFactory.register(".\\fonts\\code39.ttf");
               Document document = new Document();
               PdfWriter.getInstance(document, new
FileOutputStream("out.pdf"));
               SAXParser parser =
SAXParserFactory.newInstance().newSAXParser();
               Reader r = new InputStreamReader(new
FileInputStream(".\\rach.xml"),"Cp1250");
               parser.parse(new InputSource(r), new
SAXiTextHandler(document));
        }//try
        catch (Exception e)
 {
            throw (e);
        } //catch

    }//XmlToPdf


My XML file:
<?xml version="1.0" encoding="Cp1250" ?>
<!DOCTYPE ITEXT SYSTEM "http://itext.sourceforge.net/itext.dtd";>
<itext creationdate="Thu Oct 02 14:56:45 CEST 2003" producer="aaa">
 <paragraph font="Times New Roman" encoding="ISO8859-2">
  System Times font: ABCDEFGHIJK  ąśęćżźółń aaaaa
 </paragraph>
 <paragraph font="./fonts/cour.ttf" encoding="ISO8859-2">
  Courier font: ABCDEFGHIJK  ąśęćżźółń aaaaa
 </paragraph>
 <chunk font="./fonts/times.ttf" encoding="ISO8859-2">
  Times font: ABCDEFGHIJK ąśęćżźółń aaaaa
 </chunk>
 <chunk font="Code 39">
  1239103981
 </chunk>
 <table columns="3" width="80.0%" align="Center" cellpadding="5.0"
cellspacing="5.0" widths="33.333332;33.333332;33.333332" borderwidth="1.0"
left="true" right="true" top="true" bottom="true" red="0" green="0"
blue="255">
   <row>
   <cell borderwidth="0.5" left="true" right="true" top="true" bottom="true"
horizontalalign="Default" verticalalign="Default" colspan="3" header="true"
leading="18.0">
    <paragraph leading="18.0" font="Times New Roman" encoding="ISO8859-2"
style="italic" align="right">
     Polskie znaki: ąśęćżźółń koniec
    </paragraph>
   </cell>
  </row>
 </table>
</itext>


Polish fonts are OK but  the following code doesn't work in the way I would
expected to do.
<chunk font="Code 39">
  1239103981
 </chunk>


Best regards
Marek Bednarczyk



-------------------------------------------------------
This SF.Net email sponsored by: ApacheCon 2003,
16-19 November in Las Vegas. Learn firsthand the latest
developments in Apache, PHP, Perl, XML, Java, MySQL,
WebDAV, and more! http://www.apachecon.com/
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to