Aspose Words.NET and merging QR Codes into PDF documents

Aspose version: Aspose Words.NET version 23.6.0

Environment: Windows and Linux

Please may I confirm my understanding with you as to the merging of barcode fields (specifically resulting in a QR code) into a Word document using Aspose.Words (.NET).

As an example, the merging of: {MergeBarcode URL QR \q 3} where URL is an address such as “http://www.microsoft.com”.

My understanding is:

1) When using Aspose.Words to mail merge (MailMerge.Execute()) a document containing {MergeBarcode URL QR \q 3} and saving the resultant merge to Word .docx format:

  • Aspose.Words will merge the field to {DISPLAYBARCODE “http://www.microsoft.com” QR \q 3}.

  • When opening the .docx in applicable / compatible versions of Microsoft Word, Word can natively render the QR code for the new DISPLAYBARCODE field.

2) However, if the merged result is saved to PDF format (not .docx) using Aspose.Words:

  • Aspose.Words will not automatically render the DISPLAYBARCODE field in the PDF and will result in the text: “Error! Bar code generator is not set”.

3) To render the QR code in the PDF when saving to PDF (using Aspose.Words), another component / additional implementation is required (such as Aspose.BarCode for example) – Aspose.Words cannot implement this by itself?

My Questions:

  1. Is my above understanding correct please?

  2. For licensing, is Aspose.Barcode treated as separate to Aspose.Words? That being, if we are only licensed for Aspose.Words and need to use Aspose.Barcode for the above, is an additional licence for Aspose.Barcode required?

  3. Would you be able please to include a link to up-to-date Aspose documentation on how to correctly implement this please.

Thanks in advance for your help,

James

@JamesMurdoch

Can you please clarify if you are asking for confirmation on your understanding of the merging process or if you have specific implementation questions regarding Aspose.Words and Aspose.BarCode?

@JamesMurdoch

  1. Yes, your understanding is correct. After executing mail merge MERGEBARCODE field is converted to DISPLAYBARCODE. MS Word updates the value of this field itself, but to render it in PDF it is required to use external barcode rendering tool, like Aspose.BarCode.

  2. Aspose.Words and Aspose.BarCode are separate products and you will need both Aspose.Words and Aspose.BarCode licenses to use the components without evaluation version limitations. Alternatively you can use Aspose.Total license that includes all Aspose components, but anyways the license should be applied for both components:

Aspose.Words.License wordsLic = new Aspose.Words.License();
wordsLic.SetLicense(@"X:\awnet\TestData\Licenses\Aspose.Total.NET.lic");

Aspose.BarCode.License barLic = new Aspose.BarCode.License();
barLic.SetLicense(@"X:\awnet\TestData\Licenses\Aspose.Total.NET.lic");
  1. You can find documentation here:
    https://docs.aspose.com/words/net/how-to-generate-a-custom-barcode-image-for-displaybarcode-field/
    Also you can find code examples in our github:
    https://github.com/aspose-words/Aspose.Words-for-.NET/

Thank you Alexey for your prompt reply and answers.

1 Like