2 Replies Latest reply on May 3, 2017 11:40 PM by mariusyk17

    Dynamic barcode generation

    mariusyk17

      I need to generate a PDF417 barcode image as PDF, given a certain value from a textfield.

      I followed this thread (Is there not a method to add a barcode field via Javascript? ) and successfully added an image on a button, but I have to generate another image and then load it again on that button. Is there any way to generate an image using Javascript, without browser support, just the Adobe API?

        • 1. Re: Dynamic barcode generation
          Joel_Geraci Adobe Community Professional

          Assuming you are trying o generate a barcode "image" dynamically...

           

          First create a hidden field that contains the value you want the barcode to represent. Then create a barcode field and put it where you want it to go. In the value tab of the barcode field, add the hidden field to the list and uncheck "include field names". To update the barcode to represent a new value, just set the value of the hidden field through JavaScript.

           

          That said, you can create images using pure JavaScript but you can only use them in dialog boxes or tool buttons, you can't... or at least I haven't found a way to... get them into the document from there.

          • 2. Re: Dynamic barcode generation
            mariusyk17 Level 1

            "Then create a barcode field" - how may I do that? I already tried the following:

            var f = newDoc.addField("textBC", "text", 0, bcCoords);

            f.cFieldType = "barcode";

            and

            var f = newDoc.addField("textBC", "barcode", 0, bcCoords);

            The "newDoc" object is the document I want to generate the image.
            The first creates a normal text field, while the second shows only a blank, gray, readonly textfield.

            I'm on the right track?