Server SDK - Save Filled Template as DOCX

Product: Server SDK Node (Mac)

Product Version: 10.9

Please give a brief summary of your issue:
Save Filled Docx Template as Docx

Please describe your issue and provide steps to reproduce it:
I would like to save the Filled Docx Template as a Docx file. I did see this forum link https://community.apryse.com/t/save-docx-template-back-to-docx/8485 but it appears to be specific to the Web implementation.

The save function of PDFNet.PDFDoc does not have an overly obvious option flag to save as a word doc.

Please provide a link to a minimal sample where the issue is reproducible:

        // Create a TemplateDocument object from an input office file.
        const templateDoc = await PDFNet.Convert.createOfficeTemplateWithPath(inputFile, options);

        // Fill the template with data from a JSON string, producing a PDF document.
        const pdfdoc = await templateDoc.fillTemplateJson(json);

        //How do I save the file as Docx?

Hi Steve,

I believe we have developed a new method that allows this. I am currently in discussion with the team to determine how it can be done. I will let you know as soon as I have some more information to provide.

If the need is urgent, you can use our Structured Module Output in the meantime to convert the pdfdoc object back into a docx file. Please view the following sample for more info:

Hi Steve,

I was able to get further information from our dev team. To save the file as an office file use the following method:
TemplateDocument::FillTemplateJsonToOffice(UString json, UString output_path)

Hi @kmirsalehi ,

Thats very promising. One follow-up question. What version is this function available and is it available in the Server node npm library? I am not seeing that function in intellisense unfortunately on version 10.9.0 of @pdftron/pdfnet-node

Thanks

Hi Steve,

It should be on the latest version, try using 10.9.1. Also try running getVersionString() to confirm what version you are running.

I’ve confirmed that it is defined in pdfnet.js, so you should be able to run it. Maybe also share a screenshot of your code just in case something else is the issue.

The latest I can get off of npm is 10.9.0-1

I don’t see that function in types.d.ts using import { PDFNet } from '@pdftron/pdfnet-node';

Hi Steve,

I double checked and I confirmed that it is defined in pdfnet.js and you should be seeing it. A new 10.10 version will be releasing later today (should be available through npm by the end of the week).

Can you try running that and let me know if you still run into the same issue?