Can't donwload with template generation variables

WebViewer Version: 10.6.0

I am using Angular framework for pdftron/webviewer. I am opening the PDF perfectly. Inserting the variables too. Like, {{ document.name }}. It shows the inserted value, for example “Name of the Document” gets place of the variable.
However, If I try to download the file, it does not download with inserted values. But the raw variable names, like {{ document.number }} etc… Still the UI shows the updated view.

Here is the download function body.

const doc = await this.wvInstance.Core.documentViewer.getDocument();
await doc.getDocumentCompletePromise();
const xfdfString =
await this.wvInstance.Core.annotationManager.exportAnnotations();
const data = await doc.getFileData({
xfdfString,
downloadType: ‘pdf’,
});
const blob = new Blob([data], { type: ‘application/pdf’ });
window.open(URL.createObjectURL(blob));

1 Like

Hello umar,

We will take a look at the issue presented and will contact you as soon as we have more information.

1 Like

Hello umar,

Based on your description, we were unable to reproduce the issue. Could you please go to Document Generation using Loops with JSON Data Demo | Apryse WebViewer
and after pressing Fill Template, pass the following code snippet into console:

const doc = await instance.Core.documentViewer.getDocument();
      await doc.getDocumentCompletePromise();
      const xfdfString = await instance.Core.annotationManager.exportAnnotations();
      const data = await doc.getFileData({
        xfdfString,
        downloadType: 'pdf',
      });
      const blob = new Blob([data], { type: 'application/ pdf' });
    window.open(URL.createObjectURL(blob));

Can you tell us how are you applying template values? Can you also provide us with the files you have been using to reproduce the issue, if they are confidential, we will have to find another way around it (please do not post any sensitive matters on the forum).
You can check the guide here: Apryse Documentation | Documentation
Otherwise could you please provide us with a minimal runnable reproducible sample, so we can do our internal testing.

*A minimal runnable reproducible sample refers to a simplified version of your project where unrelated/unnecessary code has been removed. The issue should still be reproducible in this simplified version.

This helps us isolate and understand the problem more efficiently. You can provide us with a download link or GitHub repo.

1 Like

I am implementing the WebViewer and also seem to be facing the same issue as described by umar.

I was able to run the snippet in the demo with the attached files (2x very simple examples with a single line of text and a single variable) which reproduces the behaviour described. I can confirm that although the interface shows the template values, the tags are not replaced in the downloaded PDF document.

test.docx (12.0 KB)
test2.docx (11.7 KB)

Hello Umar and Jake,

Our development team has a fix for this issue and it is in the latest stable 10.6 nightly build.

For npm you can do:

npm install @pdftron/webviewer@10.6.0-20240103

Or you can download directly from our downloads page:
https://dev.apryse.com/nightly/stable/2024-01-03/webviewer

Let me know if this works for you!

Best regards,
Tyler

1 Like

Hi Tyler,

Thanks for your reply on this; I have checked with the test documents and I can confirm that this is now working with the latest nightly build.

Many thanks for the quick turn around on this one!

1 Like

Hello umar,

Have you been able to resolve the issue as well?

1 Like