Text styles are disappeared after merge annotations

Before merge

After merge

Colors, strikes, underline…etc disappeared after merge

Hello, I’m Ron, an automated tech support bot :robot:

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:

Guides:APIs:Forums:

Hi Iakshan,

How are you merging the annotations, are you using the REST API? If so, can you provide the code snippet?
Here is a quick guide:

If not, this is another way by using export/import annotation commands:

Best Regards,

Kevin Kim
Web Development Support Engineer
PDFTron Systems, Inc.
www.pdftron.com

Server side code (NodeJS):

exports.mergeAnnotations = async function (req, res) {
const utils = new Utils({
serverKey: process.env.serverKey,
});
utils.setFile(req.body.file).setXFDF(req.body.xfdf);
const response = await utils.merge(); // merge XFDF
// const response = await utils.set(); // or set XFDF
const mergedFile = await response.getBlob();
//await response.deleteFile(); // remove file from the server
res.send({ url: response.url, key: response.key, blob: mergedFile });
};

Client side code:

        const xfdf = await annotManager.exportAnnotations({ links: false, widgets: false });
        const fileData = await docViewer.getDocument().getFileData({});
        const blob = new Blob([fileData], { type: "application/pdf" });
        pdfExpressData.append("file", blob);
        pdfExpressData.append("xfdf", xfdf);
        // Process the file
        const response = await fetch("/merge-annotations", {
          method: "post",
          body: pdfExpressData,
        }).then((resp) => resp.json());
        const { url, key, mergedBlob } = response;
        // Download the file
        const mergedFileBlob = await fetch(url, {
          headers: {
            Authorization: key,
          },
        }).then((resp) => resp.blob());
        var pdfblob = new Blob([mergedFileBlob], { type: "application/pdf" });

Hi Iakshan,

It looks like you are not including the licence key in the request body, and without a license key, the output actions in localhost will be watermarked/mangled.

If this is a production environment, are you using the right server key and client key in the respective back and front end environments?

Best Regards,

Kevin Kim
Web Development Support Engineer
PDFTron Systems, Inc.

Added both server side and client side keys. But issue is still there

Server side code:
image

Client side code:

Hi Iakshan,

Are you testing the merge on localhost?

Also, if you have the paid key for the server, are you being domain locked? If not are you seeing the same results?

Best Regards,

Kevin Kim
Web Development Support Engineer
PDFTron Systems, Inc.

  1. Yes we have the paid license both server and client keys set properly.
  2. What do you mean by domain locked?..We purchased the key for our company domain.
  3. Not even in local. we tested it in UAT environment (uat.domainname.com)
    Text styles are not getting applied. Not even text alignment

Hi Iakshan,

Upon further investigation, it looks like PDFJS Express does not support custom appearance. If you look at the console, there should be a warning indicating ‘Custom appearances are unavailable in PDFJS Express’

Apologies for the confusion.

Best Regards,

Kevin Kim
Web Development Support Engineer
PDFTron Systems, Inc.