Telerik Forums
Kendo UI for jQuery Forum
10 answers
234 views
I am trying to use the PDFViewer for the first time. I am using PDFJS processing. In the examples it is easy to understand including the pdf.mjs and worker.mjs as type='module' along with kendo as type='module'. However, if I understand this correctly type='module' delays loading until after the cshtml page has completed. We use a common layout page that loads required script libraries (including kendo) as part of the page. Other parts of the layout and pages require kendo to be loaded and accessible, so it cannot be changed to type='module' without breaking stuff. Is it possible to load the PDFJS libraries as regular javascript includes rather than modules ?
Jim
Top achievements
Rank 2
Iron
Iron
 answered on 31 Mar 2025
1 answer
201 views

Hello,

I am using KENDOUI jQuery PDFViewer. PDFViewer essentially uses Mozilla's pdf.js library, and I was using version 2.5.207 of pdf.js. However, there are security vulnerabilities in this version (https://github.com/mozilla/pdf.js/security/advisories/GHSA-wgrm-67xf-hhpq). Mozilla has started using pdf.mjs and pdf.worker.mjs with version 4.x. How can I use these versions with PDFViewer?

How can I set the window.pdfjsLib.GlobalWorkerOptions.workerSrc assignment?

Martin
Telerik team
 answered on 01 Aug 2024
2 answers
157 views

Hi,

I am doing default PDF export functionality of Kendo Grid. But exported PDF file has extra characters in meta data. That results weird title of the PDF in Chrome browser. I have attached screen shot of the exported pdf and also a meta data of the file.  

I found few solutions (https://www.telerik.com/forums/saving-grids-or-charts-as-pdf-and-getting-strange-characters-in-the-metadata) that mentioned that I need to have <meta Charset='UTF-8'> in my code, where grid has been initialized. But I have set UTF-8 charset only in my entire code, still facing same issue.

I have few questions:

1) Which charset value is getting used to export the grid in PDF? (i) <meta Charset='UTF-8'> written in my code or (ii) default export functionality has its own charset value

2)  I am using Telerik.UI.for.AspNet.Core 2020.3.1021 version for kendo UI. Which specific library is being used for PDF generation in Telerik.UI.for.AspNet.Core  2020.3.1021 ? 

3) Is there anything else to try to resolve this issue?

Angel Petrov
Telerik team
 answered on 17 Apr 2024
1 answer
267 views

I am having an issue getting my controller code to get called from the UI.  Here is what I have tried. 

<script type="text/javascript">

    $(document).ready(function () {
        $("#pdfViewer").kendoPDFViewer({
            fromFile: {
                url: "@Url.Action("DetailsReport", "ReportViewer")"
            }
        });
    });


</script>

 

--RAZOR PAGE

 @(Html.Kendo().PDFViewer()
                              .Name("pdfViewer")

                        )

 

Controller ActionMethod (never gets called).  

returns File(bytes, mimeType).  

                              
Peter Milchev
Telerik team
 answered on 25 Dec 2023
1 answer
463 views

Hello,

I'm using PDF Viewer with PDF.js processing and want to limit the number of pages displayed when receiving a large PDF file because its rendering makes the page load very slow.

For example, I receive a file with 100 pages from the server and I want to render and display only the first 10, and if the user wants to view the rest, he can download the entire file.

I found some solution on github, but it requires changes to the source code of the kendo.js library. Can I do something similar with just the PDF Viewer API?

const MAX_PAGES = 3; PDFJS.getDocument(params).then((doc) => { Object.defineProperty(doc, 'numPages', { value: Math.min(doc.numPages, MAX_PAGES) }); this.pdfViewer.setDocument(doc); // Other stuff }

Neli
Telerik team
 answered on 07 Dec 2023
1 answer
205 views

Hello, 

I got a custom button on my toolbar , which opens a modal, but , when i tried to open in mobile mode , it stops working

see the code below

 

    $('#pdfViewer').css('width', '100%');
    var request = new XMLHttpRequest();
    request.responseType = 'blob';
    request.onload = function () {
        var reader = new FileReader();
        reader.readAsDataURL(request.response);
        reader.onload = function (e) {
            $("#pdfViewer").kendoPDFViewer({
                pdfjsProcessing: {
                    file: {
                        data: e.target.result.split(",")[1]
                    }
                },
                toolbar: {
                    items: [ 
                        "zoomInOut",
                        {
                            type: "button",
                            name: 'Description',
                            template: '<button type="button" onclick="openModal()" title="Description" class="k-button k-button-md k-button-flat" id="btn-Description"><span class="k-icon k-i-toc-section-level"></span></button>',
                        }
                    ]
                },
                width: "100%",
                height: 760
            }).getKendoPDFViewer();
        };
    };

 

on browser desktop modal it works normally

Martin
Telerik team
 answered on 10 Oct 2023
1 answer
205 views

Hi,

I'm doing a quite simple implementation of saveAsPdf() for a grid. The actual PDF is fine, but the MetaData is a problem.

The PDF MetaData attributes for title, subject, keywords, author, creator and producer all contain strange/escape characters. 

Here is an example of what I get every time.

Title:          þÿ�M�o�d�e�l� �2�0�2�3
Subject:        þÿ
Keywords:       Ã¾Ã¿
Author:         Ã¾Ã¿
Creator:        þÿ�K�e�n�d�o� �U�I� �P�D�F� �G�e�n�e�r�a�t�o�r
Producer:       Ã¾Ã¿�K�e�n�d�o� �U�I� �P�D�F� �G�e�n�e�r�a�t�o�r

The only one of these attributes I'm actually setting is the Title. The rest are just whatever is deemed a default value (I assume).

This happens when I produce the PDF from Chrome, Firefox or Edge.

Here's an example of the PDF Options I am using.

{
    "title": "Model 2023",
    "fileName": "Model2023.pdf",
    "allPages": false,
    "avoidLinks": true,
    "paperSize": "A4",
    "margin": {
        "left": "1cm",
        "top": "1cm",
        "right": "1cm",
        "bottom": "1cm"
    },
    "scale": 0.4,
    "landscape": true,
    "multiPage": true,
    "repeatHeaders": true
}

I have tried multiPage as true and false, which made no difference. I have included pako_deflate. I thought it might be a font issue, but it's MetaData. Not what's actually output on the PDF.

To make it even more confusing for me, your demo works perfectly.  :)

FYI: Using version: 2022.3.913

If you can offer any ideas, I'd be grateful.

Thanks
John

Martin
Telerik team
 answered on 24 Aug 2023
1 answer
376 views

Hi. I'm using this plugin for jQuery to download a PDF via AJAX. Here's the code that fetches the PDF from ASP.NET Web API:

fetchFile: function (id) {
	return new Promise(function (resolve, reject) {
		$.ajax({
			async: true,
			dataType: "native",			// Uses the jquery-ajax-native plugin for blobs.
			type: "POST",
			url: `https://someapp.org/api/files/file/fetch/${id}`,
			xhrFields: {				// Uses the jquery-ajax-native plugin for blobs.
				responseType: "blob"
			},
			cache: false
		}).done(function (data) {
			return resolve(data);
		}).fail(function (xhr, status, error) {
			const errorObj = new Error(xhr.responseText || error);
			return reject(errorObj);
		});
	});
}

I would like to feed the BLOB data returned by the fetchPdf function to set the PDFViewer's data. Is this possible? Maybe PDFViewer can fetch via AJAX directly. Any examples?

Thank you.

Neli
Telerik team
 answered on 28 Jun 2023
1 answer
99 views
Dear Kendo team,

I'm having an issue with Rich Text Format, I have a blank page at the beginning and end of the report,
also, the grid of content is not showing in a proper way,

I have tried almost everything in report style but came up with no result, any idea of what can cause this and how I can solve it? 
Todor
Telerik team
 answered on 27 Feb 2023
1 answer
178 views

Hi - we have hundreds of thousands of users that access PDF documents using our products, which use the KendoPdfViewer for jQuery to display PDF documents in a web Application.  We are receiving reports that some users are seeing pixelation, or dropped pixels, in many PDF documents.  If they download the document and open it in a viewer of their choice, it is fine.  Incidentally, I see the same pixelation on your demo page for KendoPdfViewer (https://demos.telerik.com/kendo-ui/pdfviewer/index).  I have one machine in my possession (Windows 10) that seems to have the problem.  I have tried several different browsers and the result is the same.  I have a Windows 11 machine that works fine.  I tried upgrading pdf.js to the latest version, and updated Kendo to 2022.3.1109 - only slight improvement.  I uploaded screenshots highlighting the issue both on Telerik's page and ours.

Has anyone else encountered this?  Did you find a solution?  

We love Telerik but will need to find an alternative soon if we cannot resolve this problem.

Thanks!

 

Martin
Telerik team
 answered on 09 Dec 2022
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?