Export pdf to new window

Posted by: arthur on 11 February 2021, 12:27 pm EST

  • Posted 11 February 2021, 12:27 pm EST

    Hi,

    I’m using FlexGridPdfConverter to export a grid which then downloads a pdf.

    Is it possible to not download but send to new browser window and use browser build in pdf viewer?

    Regards,

    Arthur

  • Posted 12 February 2021, 4:19 am EST

    Hi Arthur,

    You may use the URL.createObjectURL() method to convert the pdf blob to a URL and open it in a new tab. Please refer to the following code snippet and the sample demonstrating the same:

    let doc = new pdf.PdfDocument({
        ended: (sender, args) => {
          let url = window.URL.createObjectURL(args.blob);
          window.open(url);
        }
      });
      gridPdf.FlexGridPdfConverter.draw(grid, doc);
      doc.end();
    

    https://codesandbox.io/s/wijmo-starter-forked-pdvgq?file=/src/index.js

    Regards

    Sharad

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels