Forum Discussion

johnjohn-Peter's avatar
johnjohn-Peter
Iron Contributor
Mar 08, 2024

Print the SharePoint items barcodes + Titles, using a label printer

I have a gallery showing SharePoint items & beside each item we have a "Print" button, as follow:-

 

the print button should produce an image or pdf file that will get attached to the item, the generated image or pdf should; show the barcode and some of the item info below the barcode , as follow:-

 

 

We enabled barcodes inside the related SharePoint list as follow:-

 

so what is the best way to produce such as image or pdf file, and be able to print it using label printer. the expected image or document dimension should be 15 cm height with 10 cm width, so it can be printer using a label printer. any help or idea of this ?

 

Thanks

  • PriyaRaskar's avatar
    PriyaRaskar
    Copper Contributor

    johnjohn-Peter 

    Option 1:

    1. On Print barcode button click, create an HTML string and put the list item details where you need in that HTML (you can add these values in Power Automate workflow as well)

    2. Send HTML string to Power Automate Workflow to create PDF and attach with same item in the SharePoint list.

    3. Create PDF from HTML follow this


    Option 2: 
    1. On Print Barcode button start workflow to create PDF from HTML

    2. Build your HTML in workflow

    3. Convert HTML to PDF

    4. Attach PDF as attachment to the List Item

     

    sample HTML string:

    "<img src='https://barcodeapi.org/api/"& TextInput1.Text &"'> <br> <label style='font-weight: bold;font-size:25px'>"&Label1.Text&"</label> <br> <label style='font-weight: bold;font-size:25px'>"&Label1_1.Text&"</label>"
     
    I have used barcode api to create Barcode, you can use your saved image's path in img HTML tag.
    Other labels used in above HTML string can be replaced with your current Item values.

     

Resources