The Barcode classes are only for PDF. You'll still need a font for RTF
although for such a simple barcode as 39 you won't need the PdfBarcode
class. Other option is to convert the barcode to an awt image and convert
that image to a PNG to include in the RTF.

df-Barcode---- Original Message ----- 
From: "Kerns, Kelly E - San Mateo, CA - Contractor" <[EMAIL PROTECTED]>
To: "Paulo Soares" <[EMAIL PROTECTED]>
Sent: Thursday, September 08, 2005 12:47 AM
Subject: RE: [iText-questions] PdfBarcode class


Hi Paulo,

I switched to Barcode39 to create my barcodes. That was a good idea
because the user no longer has to have CODE39.TTF installed locally to
see a rendered barcode in the PDF.

However, I'm also producing an RTF with the same content as the PDF, but
now the barcode isn't displayed in the resulting RTF.

Is there a way to add the barcode created with Barcode39 to an RTF?

When I run the following code, I get the message that follows the code.

try {
  PdfContentByte cb = myPdfWriter.getDirectContent();
  Barcode39 bc39 = new Barcode39();
  bc39.setCode(bcString);
  bc39.setStartStopText(false);
  bc39.setFont(null);
  bc39.setBarHeight(10);
  Image image39 = bc39.createImageWithBarcode(cb, null, null);
  Chunk chunk39 = new Chunk(image39, 0, 0);
  Paragraph para39 = new Paragraph(chunk39);
  para39.setAlignment(Element.ALIGN_CENTER);
  pdfDocument.add(para39);
  rtfDocument.add(chunk39);
} catch (BadElementException e) {
  e.printStackTrace();
} catch (DocumentException e1) {
  e1.printStackTrace();
}

com.lowagie.text.DocumentException: Only BMP, PNG, WMF and JPEG images
are supported by the RTF Writer
 at com.lowagie.text.rtf.graphic.RtfImage.<init>(Unknown Source)
 at com.lowagie.text.rtf.RtfMapper.mapElement(Unknown Source)
 at com.lowagie.text.rtf.RtfWriter2.add(Unknown Source)
 at com.lowagie.text.Document.add(Unknown Source)
 at CreateDocs.buildDocs(CreateDocs.java:331)

Thanks,
Kelly

-----Original Message-----
From: Paulo Soares [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 07, 2005 11:45 AM
To: Kerns, Kelly E - San Mateo, CA - Contractor;
itext-questions@lists.sourceforge.net
Subject: Re: [iText-questions] PdfBarcode class

That class was removed because it required external fonts and the other
Barcode classes did a lot more. You can use just the PdfBarcode class if
you
really need it, don't concatenate jars, it may not work in some cases.

----- Original Message ----- 
From: "Kerns, Kelly E - San Mateo, CA - Contractor"
<[EMAIL PROTECTED]>
To: <itext-questions@lists.sourceforge.net>
Sent: Wednesday, September 07, 2005 6:54 PM
Subject: [iText-questions] PdfBarcode class


Hi,

Was the PdfBarcode class purposely dropped from the newest release? I
was using it, but I needed the new functionality of setting the Viewer
Preference to PrintScalingNone. When I switched to the new JAR
(itext-1.3.3), the PdfBarcode class wasn't found. I tried to replace it
with the Barcode class, but my code wouldn't work.

I've concatenated the two JARs in my classpath, so it works, but is
there a better solution?

Thanks,
Kelly




-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to