General Discussion

  • 1.  Barcode: show form identifier

    Adopter
    Posted 02-06-2025 10:17

    Hello,

    I would like to show in a handlebards document the form identifier number as a barcode.

    My first option is to add the code directly into the document and show the identifier as a barcode. I found some scripts online, but when I use them in the TrueContext editor, they do not work. Example:

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Barcode Example</title>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.7.7/handlebars.min.js"></script>
        <script src="https://cdn.jsdelivr.net/npm/jspdf@2.4.0/dist/jspdf.umd.min.js"></script>
        <script src="https://cdn.jsdelivr.net/npm/jsbarcode@3.11.0/dist/JsBarcode.all.min.js"></script>
    </head>
    <body>
        <script id="barcode-template" type="text/x-handlebars-template">
            <svg id="barcode"></svg>
            <p>{{string}}</p>
        </script>

        <script>
            document.addEventListener("DOMContentLoaded", function() {
                const templateSource = document.getElementById('barcode-template').innerHTML;
                const template = Handlebars.compile(templateSource);

                // Example string to be converted into a barcode
                const context = {
                    string: "123456789012"
                };

                const html = template(context);
                document.body.innerHTML += html;

                // Generate the barcode
                JsBarcode("#barcode", context.string, {
                    format: "CODE128", // You can change the format as needed
                    width: 2,
                    height: 100,
                    displayValue: true
                });
            });
        </script>
    </body>
    </html>

    Do this kind of scripts work in the handlebars editor? If so, how?

    My second option would be to have a barcode question in the form that gets somehow the identifier of the form and then show it in the doc. Is it possible? If so, how?



    ------------------------------
    Alicia Rico
    CI
    Johnson Controls
    ------------------------------


  • 2.  RE: Barcode: show form identifier

    Staff
    Posted 02-10-2025 11:17

    Hi Alicia,

    Would you be able to share a little bit more about the use case you're looking to do this for? Whats the bar code going to be used for at the end of the workflow?



    ------------------------------
    Chris Fraser
    Customer Success Manager
    TrueContext
    ------------------------------



  • 3.  RE: Barcode: show form identifier

    Adopter
    Posted 02-10-2025 11:32

    Hello Chris,

     

    We have been asked if our delivery notes number could be shown as a barcode in the document, so that when the goods are delivered, with a barcode scanner the number can de read and there is no need of typing it manually. We use the form identifier as delivery note number.

     

    Any ideas on how to accomplish that?

     

    Thanks a lot.

    Alicia


    Johnson Controls - © 2024 - All Rights Reserved


    Johnson Controls - © 2024 - All Rights Reserved






  • 4.  RE: Barcode: show form identifier

    Staff
    Posted 02-11-2025 14:17

    Hi Alicia,

    This is not something that can be done at the moment using our Freemarker of Handlebars document editor however it is something that can be done by our Professional Services team when building out full custom document outputs. 



    ------------------------------
    Chris Fraser
    Customer Success Manager
    TrueContext
    ------------------------------



Reminder: Content posted to our Community is public content.  Please be careful not to post Intellectual Property that you do not have permission to share.  For more information please refer to our Terms Of Use