UI for Blazor: Preview RadFixedDocument or PDF / alternative export to and view Image

1 Answer 600 Views
PdfProcessing
Rudi
Top achievements
Rank 1
Rudi asked on 09 May 2021, 07:40 PM

I'm using Telerik UI for Blazor and have to create some PDFs (via RadFixedDocument and PdfFormatProvider). This works fine so far.

But I also have to display a preview of the Document on my blazor-generated website (server side, not WebAssembly). It doesn't matter if this is a preview of the FixedDocument or of the generated PDF.

Does a control for "Telerik UI for Blazor" exist which can display the RadFixedDocument or the PDF? Or is there a possibility to export the RadFixedDocument or the PDF to an image and I can display this image? Or is there another way for making the created Document visible for preview?

TIA

Rudi

1 Answer, 1 is accepted

Sort by
0
Accepted
Marin Bratanov
Telerik team
answered on 11 May 2021, 12:05 PM

Hello Rudi,

You can Follow the implementation of a PDF Viewer component for Blazor here: https://feedback.telerik.com/blazor/1453075-pdf-viewer-component. I've added your Vote to it to raise its priority, and you can find a couple of workaround ideas there that you can consider in the meantime.

Once you have the desired PDF generated, you can point a widget (be that a blazor component, kendo widget or an iframe) to a handler that will return that file so it can be shown in the browser.

As for generating images out of a PDF, you can also Follow that here: https://feedback.telerik.com/document-processing/1356210-pdfprocessing-export-document-pages-to-images.

Once you have the images you need, you can use a foreach loop in your blazor component to render the desired <img> tags with an appropriate src attribute (e.g., pointing to a handler that will return the images themselves).

As a completely different approach, you may also find this sample interesting on using Kendo and PDF.js to generate thumbnails of a PDF that you can download in the browser and have the browser do the image generation work: https://dojo.telerik.com/iDeNUFab/27.

Regards,
Marin Bratanov
Progress Telerik

Тhe web is about to get a bit better! 

The Progress Hack-For-Good Challenge has started. Learn how to enter and make the web a worthier place: https://progress-worthyweb.devpost.com.

Rudi
Top achievements
Rank 1
commented on 11 May 2021, 12:54 PM

Thanks for your answer. As far as I understand it, there
a) is NO PDF Viewer component in Telerik UI for Blazor and I would have to use a third-party-product for this (like this from Kendo, which in some way is selled via telerik). Am I correct?
b) you referred to the pdfprocessing-export-page, but this article is for Telerik UI for WPF, but I'm using Blazor? Would this work anyway?
Marin Bratanov
Telerik team
commented on 11 May 2021, 05:20 PM

You are correct, Rudi. You could use the Kendo PDF Viewer widget - that's a jQuery widget. Kendo is a brand of UI components that is also developed by Telerik and comes with the DevCraft Complete and DevCraft Ultimate licenses (and as a separate license too, but getting a bundle is more cost-effective). Generally, the Kendo suites target platforms and frameworks that are not .NET.

On the feature request for the pdf processing and images - the request came from someone using WPF, but our Document Processing libraries are platform and UI agnostic - you can use them with a Blazor app, with a WPF app, in WebForms, and so on - basically, any .NET technology stack. This particular case has a feature in our UI for WPF component suite that does something that it makes sense that our Document Processing tools will do, and that's where the WPF mention comes from. So, at the moment you would not be able to use that WPF control in the Blazor app, but you can click the Follow button on the page to get status update emails (e.g., when we know which release will have this feature in the platform-agnostic Document Processing Libraries, we will add it to that page and you would get an email).

I hope this explains things, let me know if you have any questions.

Rudi
Top achievements
Rank 1
commented on 11 May 2021, 05:24 PM

Yep, that really answered my question. Thank you very much! :-))
Tags
PdfProcessing
Asked by
Rudi
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or