PDF viewer and document processing library.

1 Answer 18 Views
PDFViewer
Nick
Top achievements
Rank 1
Nick asked on 10 Jun 2024, 04:15 PM

Hi,

Were looking into using the PDF viewer and wonder whether it's possible to render a PDF server-side? I understand that using pdf.js is obviously rendering client-side, but can you tell me if I use the document processing library whether it does indeed render server side?

If it does can you tell me if this scenario is supported in .Net 8.0?

I'm a bit confused because in the PDF viewer documentation here: https://docs.telerik.com/aspnet-core/html-helpers/pdf/pdfviewer/dpl-processing it says "To use DPL Processing in a project, it must target 4.6.2 .NET Framework", but in the DPL documentation here: https://docs.telerik.com/devtools/document-processing/introduction it says "The Telerik Document Processing libraries are available in .NET Framework and .NET Standard (.NET Core) compatible versions"

So is the .Net 4.6.2 limitation just for PDF viewer or is the documentation just out of date?

Thanks!

 

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 13 Jun 2024, 02:14 PM

Hello Nick,

 

Thank you for writing to us.

The PdfViewer is a component based on the pdf.js library:
https://mozilla.github.io/pdf.js/

PdfViewer + DPL Processing was a bold experimental idea but it never reached full completion and didn't manage to go beyond beta version.

Therefore, I am afraid PdfViewer and DPL Processing are not supported together.

Telerik DPL processing individually on the other hand is a separate Product and it can be used in both MVC (.Net 4.6.2 and above) projects as well as in Core MVC and Core Razor Pages projects.

It can be used to generate PDF files from scratch:
https://demos.telerik.com/aspnet-core/pdfprocessing

As well as modifying existing PDF files:
https://demos.telerik.com/aspnet-core/pdfprocessing/merge-split-add-content

But I am afraid it is not designed to display PDF content to the user. This is where the pdf.js capability comes into play.

The following Web Forms demo demonstrates a very cool scenario:
https://demos.telerik.com/aspnet-ajax/pdfviewer/applicationscenarios/dplintegration/defaultcs.aspx

The user can load a PDF file to the server, then this file content is converted to byte array which can then be passed to the PdfViewer and displayed to the user:

RadPdfViewer1.PdfjsProcessingSettings.FileSettings.Data = Convert.ToBase64String(renderedBytes);
But again, 100% conversion cannot be guaranteed.

I hope you will find this information clear and helpful.

 

Regards,
Eyup
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages. If you're new to the Telerik family, be sure to check out our getting started resources, as well as the only REPL playground for creating, saving, running, and sharing server-side code.
Nick
Top achievements
Rank 1
commented on 13 Jun 2024, 02:19 PM

Hi Eyup,

Thanks for that, I guess I'll avoid the 'bold experiment'! 😁

We were trying to avoid passing the PDF back to the client for security reasons (although we know that it wouldn't be truly secure).

One last question, do you know what versions of pdf.js the PdfViewer supports? The examples seem to be using a very old version and I know there's been some security patches in later version...

Thanks again,

Nick.

Ivan Danchev
Telerik team
commented on 18 Jun 2024, 12:44 PM

Hi Nick,

Version 3.4.120 is currently the latest version of PDF.js supported by the PDFViewer.

Regards,
Ivan
Progress Telerik

Tags
PDFViewer
Asked by
Nick
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or