Link gets converted into a text when converted from word to pdf

Product: pdftron/webviewer

Product Version: 7.1.2

Link gets converted into a text when converted from word to pdf

Link gets converted into a text when converted from word to pdf. How to keep link enabled when document is converted from word to pdf. When the document is converted into pdf the link gets converted to text format

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

import React, { useEffect, useRef, useState } from “react”;
import WebViewer from “@pdftron/webviewer”;
import “./App.css”;
import { connect, useDispatch, useSelector } from “react-redux”;
import { setInboxPassData } from “app/camunda_redux/redux/ducks/passDataInbox”;
import { URLHide } from “…/…/…/…/camunda_redux/redux/action”;

const SplitViewPdfViewer = (props) => {
const dispatch = useDispatch();
const viewer = useRef(null);
const { flag } = props;
let annotatId = props.anottId;
const [instance, setInstance] = useState(null);
let [loading, setLoading] = useState(true);
const messageToPassInboxUrl = props.fileUrl;
const { extension } = props;

async function loadPDF() {
try {
if (instance != null) {
const { docViewer } = instance;

    docViewer.setWatermark({
      // Draw diagonal watermark in middle of the document
      diagonal: {
        fontSize: 35, // or even smaller size
        fontFamily: "sans-serif",
        color: "#5a5ad6",
        opacity: 40, // from 0 to 100
        text: `${sessionStorage.getItem("pklDirectrate")}`,
      },

      // Draw header watermark
      header: {
        fontSize: 10,
        fontFamily: "sans-serif",
        color: "red",
        opacity: 70,
      },
    });

    const URL =
      messageToPassInboxUrl === ""
        ? process.env.REACT_APP_PDF_SAMPLE_URL
        : messageToPassInboxUrl;
    console.log(URL)
    props.URLHide(URL).then(async (response) => {
      // console.log(response);
      let data = await response.blob();

      let file = new File([data], "test.docx");
      instance.loadDocument(file, {extension: extension ? extension : "docx"});
    });
   
  } else {
    await Promise.all([
      WebViewer(
        {
          path: `${process.env.PUBLIC_URL + "/webviewer/lib"}`,
          initialDoc: `${process.env.PUBLIC_URL + "/assets/sample.pdf"}`,
          fullAPI: true,
          enableRedaction: true,
          backendType: "ems",
        },
        viewer.current
      ).then((instance) => {
        setInstance(instance);
        // instance.UI.textPopup.add({
        //   type: "actionButton",
        //   label: "some-label",
        //   onClick: () => alert("clicked"),
        // });

        // instance.setZoomLevel('150%')
        var FitMode = instance.FitMode;
        instance.setFitMode(FitMode.FitWidth);
        const { annotManager, docViewer, Tools } = instance;

        // docViewer.on("documentLoaded", function () {
        //   instance.setZoomLevel("100%");
        // });

       

        docViewer.setWatermark({
          // Draw diagonal watermark in middle of the document
          diagonal: {
            fontSize: 35, // or even smaller size
            fontFamily: "sans-serif",
            color: "#5a5ad6",
            opacity: 40, // from 0 to 100
            text: `${sessionStorage.getItem("pklDirectrate")}`,
          },

          // Draw header watermark
          header: {
            fontSize: 10,
            fontFamily: "sans-serif",
            color: "red",
            opacity: 70,
          },
        });

        let data = sessionStorage.getItem("username");
        console.log(data);
        annotManager.setCurrentUser(data);
        annotManager.setIsAdminUser(true);



        const fullScreen = {
          type: "actionButton",
          img: '<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M4 8v-2a2 2 0 0 1 2 -2h2" /><path d="M4 16v2a2 2 0 0 0 2 2h2" /><path d="M16 4h2a2 2 0 0 1 2 2v2" /><path d="M16 20h2a2 2 0 0 0 2 -2v-2" /></svg>',
          title: "FullScreen",
          onClick: () => {
            instance.toggleFullScreen(true);
          },
          dataElement: "fullscreen",
        };
        props.pdfLoads(true);
      }),
    ]);
  }
} catch (e) {
  console.log(e.message);
}

}

useEffect(() => {
loadPDF();
}, [messageToPassInboxUrl, instance]);

// Make a GET request to get XFDF string
var loadxfdfStrings = function (documentId) {
return props.getAnnotation(documentId);
};

return (


<div
id=“pdfV”
className=“webviewer”
ref={viewer}
style={{ height: “calc(111vh - 120px)” }}
>


);
};

function mapStateToProps(state) {
return {
props: state.props,
theme: state.theme,
};
}

export default connect(mapStateToProps, {URLHide})(SplitViewPdfViewer);

Hi Mohit,

Thank you for contact WebViewer support.

Unfortunately, I’m not able to run this code as there are some missing parts.
Could you please try to update the WebViewer version to 8.10 and see if the issue remains?

Best Regards,

Dandara Navarro
Web Software Developer
PDFTron Systems, Inc.