Subscribe to News feed

Add Barcodes to documents using SharePoint, Workflows, Office 365 or API

Posted at: 18:20 on 21 November 2019 by Muhimbi

barcodeOne of the more popular features of our range of on-premise and Online PDF Converters, is the ability to automatically apply all kind of watermarks (stamps), including text, images, shapes and even QR codes. This is super popular with our customers, but one important type of watermark was missing, regular – old fashioned – barcodes.

Guess what we added in version 10.0 of to the Muhimbi PDF Converter for SharePoint Online, Muhimbi PDF Converter Services Online, and our on-premise solutions? You guessed it right… BARCODES. Loads of them Codabar, Code 11, Code 32, Code 39, Code 93, Code 128 (A/B/C), GS1-128, and QR Code, with more to come.

If you are reading this, you already know why barcodes can be extremely useful. You are probably familiar with barcodes when purchasing products in the supermarket. I still remember the time before barcode readers and let just say that the checkout experience at the supermarket was less than pleasant. But it is not just that, barcodes control how your luggage is routed when travelling, provide you with access to events, tracks lab samples, and – most importantly for our particular customers - Document Management and archiving.
 

Barcode Examples

  
Similar to all other functionality offered by our product line, being it document conversion, file merging, watermarking, applying security or OCR, this new barcode facility is accessible from all supported platforms and technologies:

 
Wow, that is quite the list, but let's have a look at what this actually looks like for SharePoint Designer workflows, Nintex Workflow, Microsoft Flow, Muhimbi Watermark On Open & XML Watermarks, and for APIs.

 

SharePoint Designer Workflows (on-premise and Online)

Regardless of the platform, all SharePoint Designer workflows pretty much look and behave the same, so the following example is the same for SharePoint on-premise, Online, the SP2010 workflow Engine and the 2013 one.

The workflow action name is 'Add Linear Barcode Watermark to PDF'
 

SharePoint Designer Workflow - Barcode

 

Nintex Workflow

In Nintex Workflow, the barcode facility is integrated in the generic 'Watermark PDF' Nintex action. Just select the 'Linear Barcode' watermarks type and fill in the blanks. Make sure you enable the Muhimbi Nintex actions first.
 

Nintex Workflow - Barcode

 

Microsoft Flow (Power Automate) / Azure Logic Apps

Similar to Muhimbi's other Flow actions, there is no need to install any software. Just insert a new action in the flow and type 'Muhimbi Watermark' to surface all our watermarking facilities.

Don't be put off by the sheer number of options in the screenshot below. Most are hidden by default unless the 'Show advanced options' link is clicked. A great tutorial can be found here.
 

Microsoft Flow - Barcode

 

Watermark on open / XML Watermarks

Muhimbi's SharePoint products come with this awesome facility to automatically add watermarks when files are opened (See SharePoint on-premise and SharePoint Online details). As this new barcode facility behaves just like any other watermark, barcodes can now be added using our real-time watermarking facility as well.

Barcode watermarks must be added using Muhimbi's XML based watermarking syntax. An example is provided below:

<watermark 
    hPosition="right" 
    vPosition="top" 
    width="200"
    height="100"
    zOrder="1"
    opacity="100"
    printOnly="false"
    pageOrientation="both">
    <linearBarcode
      width="200" 
      height="100" 
      text="1234567890"
      barcodeType="Codabar"
      omitStartStopSymbols="false"
      disableCheckDigit="false"
      showCheckDigit="true"
      textLocation="Bottom"
      barcodeToTextGapHeight="3"
      fontFamilyName="Arial"
      FontSize="8"
      fontStyle="regular"
      textAlignment="Center"
      margin="5" />  
</watermark>
  
 

REST / API

Similar to Muhimbi's other Online facilities, the barcode watermark is also available via a REST API call. You can find details about the various actions in the API Docs. The on-premise versions of the product supports the same functionality using the built-in SOAP Webservice interface.

In the following example we use Curl to make a POST request. Note how we are passing in the source PDF file using the base64 command (Ours is called test.pdf). The output JSON is fed into the jq command (sudo apt install jq), which extracts the output file. This output file - which is Base64 encoded - is then decoded into a binary PDF file.

REST calls can be executed via most modern programming languages, including Python, Java, JavaScript, C#, and PHP. Various examples can be found in our GitHub repository.

Make sure you enter your API_KEY in the example below. You can get one for free by signing up for the Muhimbi PDF Converter Services Online
 

curl "https://api.muhimbi.com/api/v1/operations/linear_barcode_watermark" \
  -X POST \
  -d "{\"source_file_name\":\"Testing.pdf\",\"use_async_pattern\":false, \
     \"source_file_content\": \"$( base64 -w 0 test.pdf)\" ,\"content\":\"1234567890\", \
     \"barcode_type\":\"Codabar\",\"omit_start_stop_symbols\":\"false\",\
     \"disable_checkdigit\":\"false\",\"show_checkdigit\":\"true\",\"margin\":\"5\", \
     \"font_family_name\":\"Arial\",\"font_size\":\"8\",\"font_style\":\"Regular\", \
     \"label_placement\":\"Bottom Center\",\"position\":\"Top Center\",\"width\":\"200\", \
     \"height\":\"100\",\"opacity\":\"100\",\"start_page\":0,\"end_page\":0,\"page_interval\":0, \
     \"page_orientation\":\"Portrait\",\"print_only\":\"false\",\"fail_on_error\":true}" \
  -H "API_Key: [INSERT_YOUR_API_KEY_HERE]" \
  -H "Content-Type: application/json" \
  | jq -r '.processed_file_content' | base64 --decode > watermarked.pdf
  

 
When executing this command using Bash, or a similar shell, you may want to copy it into a text editor first. Then make sure all line endings are saved using the Unix format (LF).

 

Parameters

Although the syntax is slightly different depending on the platform / situation, they all support the same parameters. Everything is largely self-describing, but the key ones are described below:

  • Type: The barcode type including Codabar, Code11, Code32, Code39, Code39Extended, Code93, Code93Extended, Code128, Code128A, Code128B, Code128C, GS1Code128.
  • Content: The content for the barcode, please make sure that the specified content is compatible with the data that may be stored in the selected barcode type.
  • Check digit: If relevant to the barcode type, calculate and encode the check digit into the barcode.
     

Even though this is a pretty long blog post, it only scratches the surface of this powerful new barcode facility. Any questions? Leave a comment below or contact our support desk, we love to help.

.

Labels: , , , , , , , , , , , ,

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

Need support from experts?

Access our Forum

Download Free Trials