Unplanned
Last Updated: 04 Jan 2022 10:49 by ADMIN
Thomas
Created on: 26 Dec 2021 03:27
Category: KendoReact
Type: Feature Request
0
PDFExport save() to blob not file

Hi,

I require the ability to use generate a PDF of React content using the PDFExport component, but instead of calling the `save()` function to download a file to the client's disk, return the blob/URI back to the JS which can be processed further.

I tried using the `drawDOM` method, however it doesn't support many of the features I require for `PDFExport`, such as 'Author', 'Title' and most importantly 'pageTemplate'. 

Is there a way I can use the drawDOM method to achieve the same functionality as the core PDF export? If not, could another method be exposed of `saveURI` which returns a promise similar to drawDOM?

In addition, is there any temporary workaround you can think of that would facilitate what I'm trying to achieve? I couldn't spot any event I could intercept to solve this problem.

 

Kind regards,

Thomas

4 comments
ADMIN
Stefan
Posted on: 04 Jan 2022 10:49

Hello, Thomas,

Thank you for the confirmation.

I have transferred this to an official public feature request.

We will monitor its popularity and plan it accordingly.

Regards,
Stefan
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Thomas
Posted on: 04 Jan 2022 10:11

Hi Stefan,

Yes, please transfer this to a public feature request.

As we need to display the PDF on the client's browser in React, the forceProxy method isn't an ideal fit.

 

Regards,

Thomas

ADMIN
Stefan
Posted on: 27 Dec 2021 14:25

Hello, 

Thank you for the feedback and for sharing the current workaround it is highly appreciated.

If you wish I can transfer this to an official public feature request to add these options:

https://feedback.telerik.com/kendo-react-ui

That is how we prioritize the next features.

Also, if the string will be sent to the server, we can directly use the forceProxy method that will automatically generate the string and send it to the server:

https://www.telerik.com/kendo-react-ui/components/pdfprocessing/api/PDFExportProps/#toc-forceproxy

Regards,
Stefan
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Thomas
Posted on: 26 Dec 2021 03:49

As an update - Able to extend the class with the following functions that just terminate the existing `save` function early. Would be great to see this officially supported so that extending the built-in classes is not necessary


KendoDrawingAdapter.prototype.returnURI = function () {
    var _this = this;
    return this.drawDOM(this.domElement, this.getDrawOptions())
        .then(function (group) { return _this.exportPDF(group, _this.getPDFOptions()); });
};

PDFExport.prototype.generateUri = function () {
    return new KendoDrawingAdapter(drawDOM, exportPDF, null, this.rootElForPDF, this.getOptions()).returnURI();
};