Can I convert an Office document to PDF, then view that PDF in WebViewer?

89 views
Skip to first unread message

Aaron

unread,
Sep 8, 2020, 9:33:45 PM9/8/20
to PDFTron WebViewer
Q: Can I load up an office document from a URL, convert it into a PDF, then load that converted PDF into WebViewer?

A:


(exports => {
  const PDFNet = exports.PDFNet;

  window.addEventListener('viewerLoaded', () => {
    (async function() {
      const inputDir = '../../samples/full-apis/TestFiles/';
      const inputFilename = 'myfile.pptx';
      const url = inputDir + inputFilename;

      await PDFNet.initialize();
      const buf = await CoreControls.office2PDFBuffer(url);
      readerControl.loadDocument(buf);
    })()

  });
})(window);
// eslint-disable-next-line spaced-comment
//# sourceURL=config.js

Reply all
Reply to author
Forward
0 new messages