When I worked on a similar task I found that using Aspose.BarCode wasn’t strictly necessary. I ended up using ZXing to generate the QR code image, which gave me more flexibility and avoided the licensing hassle with Aspose.
Here’s roughly what I did:
Used QRCodeWriter from ZXing to create the QR code.
Converted the output to a PNG.
Then encoded that image to a Base64 string, which I inserted as the field value in the payload:
{
"fieldName": "QR_CODE_FIELD",
"fieldValue": "<BASE64_STRING>",
"typeCode": "IMAGE_BASE64"
}
One tricky part was making sure the merge field in the template was configured to accept an image. In my case, with Aspose.Words, I had to name it like Image:QR_CODE_FIELD to get it to render the image properly.
Also, when setting up the Gradle dependency for Aspose, I ran into a similar issue—nothing was resolving until I added their own repository:
repositories {
mavenCentral()
maven { url "https://repository.aspose.com/repo/" }
}
Once that was in place, the dependency resolved quickly.
I’ve also come across cases, mostly in marketing or logistics, where people rely on third-party QR code generators instead of generating them locally. This is often done when they want tracking features, like scan counts, timestamps, or redirects. These services handle the PDF to QR code use case by giving you a hosted QR code image that you can embed whenever you like, while also allowing you to track scan activity over time.