I'm using iText to dynamically generate PDF docs. Now I'm trying to dynamically create a barcode in this PDF. Adobe Live Cycle has a barcode function built-in. You can just drag the barcode text box on the page and it's created.
Problem:
I placed the barcode field in the PDF. Then pass a number to the barcode field from the JSP page. But only the number appears. The barcode lines never display
The number, 20099002, is visible on the PDF doc, but the barcode lines fail to appear. I tried several other barcode options in LiveCycle but the all give the same result.
OurJavaPage.java
public class ExampleForm extends BaseOutput {
private static final Log LOG = LogFactory.getLog(ExampleForm.class);
public OutputStream generate() throws IOException, DocumentException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PdfReader reader;
reader = new PdfReader(BASEDIR + "MailingExample.pdf");
PdfStamper stamper = new PdfStamper(reader, baos);
Participant participantHome = home.getParticipant();
Set<Location> homeLocs = participantHome.getLocations();
final AcroFields form = stamper.getAcroFields();
setFormField(form, "addrNumber[0]", addrMaster.getStreetNum());
setFormField(form, "dateMiddle[0]", formatDate("MM-dd-yyyy", new Date()));
// *********** Here's the problem *****************************
setFormField(form, "Code128ABarcode1[0]", "20099002");
// ************************************************************
debugAcrobatForm("ExampleForm", form);
stamper.setFormFlattening(true);
stamper.close();
return baos;
}
}
Operating System: Linux
Programming: Java, .jsp, iText
Software: Adobe Live Cycle Designer ES 8.1