Duplicated
Last Updated: 14 Feb 2025 12:05 by ADMIN
Sebastian
Created on: 31 Jan 2025 08:10
Category: UI for Blazor
Type: Bug Report
0
TelerikPdfViewer manipulates underlying PDF byte-Array on download

Hello together,

we are running into a problem with TelerikPdfViewer. When clicking the download button, download starts and performs properly.

BUT: the downloaded PDF file does not match the PDF that was provided via Data="@PdfData". On download something internally prepends some text to the PDF:

–€À³JS.ReceiveByteArray’Æ ‘¢%PDF-1.7
%úûüý
3 0 obj
<</ca 1.00000 /AIS false >>
endobj
5 0 obj

The original PDF file starts at "%PDF-1.7" (end of first line). That part before (including that "JS.ReceiveByteArray") was somehow added during the download workflow by Telerik. We ensured that the PDF data we provided to the viewer (via Data="@PdfData") ist valid. We did so by inspecting the byte[]-Array manually in the debugger as well as downloading it via a JS function to the client.

This is how we are using the TelerikPdfViewer. But the error occurs no matter if we are handling the OnDownload-Event (setting the filename) or not handlign that event at all (i.e. eliminating the OnDownload="@OnPdfDownload" completely)

        <TelerikPdfViewer Data="@PdfData" Width="100%" Height="100%" Zoom="1m" OnDownload="@OnPdfDownload">
            <PdfViewerToolBar>
                <PdfViewerToolBarPagerTool />

                <PdfViewerToolBarSpacer />

                <PdfViewerToolBarZoomTool />
                <PdfViewerToolBarSelectionTool />
                <PdfViewerToolBarSearchTool />

                <PdfViewerToolBarSpacer />

                <PdfViewerToolBarDownloadTool />
                <PdfViewerToolBarPrintTool />
            </PdfViewerToolBar>
        </TelerikPdfViewer>

We use Telerik.UI.for.Blazor (6.2.0).

Thanks for your feedback on this issue and best regards!

Sebastian

Duplicated
This item is a duplicate of an already existing item. You can find the original item here:
4 comments
ADMIN
Nadezhda Tacheva
Posted on: 14 Feb 2025 12:05

Hi Sebastian,

Thank you for confirming and providing more details on the behavior! I will then mark the current item as a duplicate.

Regards,
Nadezhda Tacheva
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.

Sebastian
Posted on: 10 Feb 2025 06:58

@Nadezhda Tacheva

Hi Nadezhda,

I justed wanted to be sure - I downloaded the PDF file directly from your Demo page (https://demos.telerik.com/blazor-ui/pdfviewer/overview) and I can confirm: it contains that peprent chunk of bytes as well. Those bytes might not affect viewing a PDF file, but it causes more sophisticated applications to crash (e.g. the mentioned digital signing, or alteration checks etc.)

Best regards

Sebastian

Sebastian
Posted on: 10 Feb 2025 06:52

@Nadezhda Tacheva

 

Hi Nadezhda,

 

yes, I can confirm that this looks like the bug I am expirencing. I opened the PDF document linked in that other bug report in a text editor (Notepad++) and was able to verify that the same chunk of bytes is prepended to the PDF's actual content:

 

The PDF can be opened in browsers and in Adobe Acrobat without any issue. But other programs fail (such as applications to digitally sign that PDF - e.g. DigiSeal). Furthermore other actions / checks cannot be performed anymore (e.g. checking that a PDF file was not altered), as the file is already changed when downloading it for the first time.

Best regards

Sebastian

ADMIN
Nadezhda Tacheva
Posted on: 06 Feb 2025 17:04

Hi Sebastian,

We currently have this bug report that seems similar - The hexadecimal representation of the downloaded PDF is incorrect.

Can you please check it and let me know if the problem you are facing is the same? If not, please share an isolated runnable sample that shows how you are testing and hitting the problem, so we can investigate further.

Can you please also share how this affects the downloaded document, is it somehow breaking it?

Regards,
Nadezhda Tacheva
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.