Telerik Forums
UI for ASP.NET Core Forum
1 answer
22 views
I would like to ensure that no trace of the PDF is saved to the local machine in any kind of cache etc.
Is this how the PDFViewer works?
Stoyan
Telerik team
 answered on 30 Jan 2024
1 answer
72 views

I have a HTML form that has a body with data already populated in it. I want to export that data on a button click to then download that html to pdf. The form already has a method of post. I am stuck on how to get the Telerik Document process to hook up with it once the button is click.

 

It looks like this

index.cshtml

<body>

<form id ="letterForm" method="post">

.... "Data and text here"

</form>

<button type="submit"> Download</button>

</body>

 

 

Currently I dont have a controller method to sync up with yet. Looking for example on how to get it to work

Mihaela
Telerik team
 answered on 08 Dec 2023
3 answers
1.0K+ views

How can you set the default Zoom Level on the PDF Viewer?  It defaults to "Automatic Width" but I want it to default to "Fit to Width".


    <kendo-pdfviewer name="pdfviewer">
        <pdfjs-processing file="@(Url.Action("GetReportDownload", "Downloader"))"/>
        <toolbar enabled="true">
        </toolbar>
    </kendo-pdfviewer>

 

Stefan
Top achievements
Rank 1
Iron
 answered on 14 Sep 2023
1 answer
228 views

Hello,

I am letting users to upload a pdf file on the browser. Once the user upload the file, I want to give them the option to view the uploaded file. In order to upload the file, I am using ASP.NET Core Upload Asynchronous Upload control and it works fine, but I am not sure how can I have the user view the pdf file as soon as it uploads. The files exists on server. Below is my entire code:

 


@using Kendo.Mvc.UI
<div style="margin-top:60px">
    <div>
        <span style="font-size:20px; font-weight:bold">Upload File</span>

    </div>
    <br />  <br />  
        <div class="block-section">
        @(Html.Kendo().Upload()
            .Name("files")
            .Async(a => a
                .Save("Async_Save", "Block")
                .Remove("Async_Remove", "Block")
                .AutoUpload(true)
            )
        )
    </div>


below is my controller code:


 public async Task<IActionResult> Async_Save(IEnumerable<IFormFile> files)
        {


            foreach (var file in files)
            {
                var fileContent = ContentDispositionHeaderValue.Parse(file.ContentDisposition);


                var fileName = Path.GetFileName(fileContent.FileName.ToString().Trim('"'));
                var physicalPath = Path.Combine(_webHostEnvironment.WebRootPath, "UploadedFiles", fileName);
                using (var fileStream = new FileStream(physicalPath, FileMode.Create))
                {
                    await file.CopyToAsync(fileStream);
                }

               
            }
            return Content("");
        }

The file that is uploaded by the user using the above control, I want the user to see that file. I know Telerik has pdfViewer, but I am not sure how the pdfViewer can show the file that exists on the server. The files is uploaded and saved on a folder in wwwRoot. i dont know the name of the file. Below is what I am trying to use:

 


 <div>
        @(Html.Kendo().PDFViewer().Name("pdfviewer")
            .PdfjsProcessing(pdf => pdf.File(Url.Content("~/wwwroot/UploadedFiles/2020-0598857.pdf")))
            .Height(1200)
            )

    </div>
but I  dont have the file name. User can name the file and upload it and I want the user to preview the file.
Mihaela
Telerik team
 answered on 21 Aug 2023
1 answer
113 views

I'm trying to use the pdf Viewer control to display pdfs which have fillable forms on them.  When I open the pdf with viewer control the fillable pdfs just show up as a flat pdf (meaning the form fields are not fillable).  Is there a way to get the PdfViewer control to display the pdf as a fillable pdf?  I feel like with tools like RadPdf, this has got to be possible in the browser and would be surprised if there wasn't a way to do this with our Kendo controls.

Ultimately, I want to submit that filled in pdf back to the server to be saved back to the database.

Stoyan
Telerik team
 answered on 17 Feb 2023
0 answers
45 views

Hello!

Is it possible to block java script execution in PDF documents in  PDFViewer?

Or maybe it is possible to find out if there is a script in the document?

I will be grateful for any answer.

Ilan
Top achievements
Rank 1
 asked on 02 Jan 2023
0 answers
60 views

Hello,

I have an existing project where I am trying to use the PDF Viewer control. But in this project I have a JS file callled vendors.bundle.js wich is causing some type of conflict with kendo.all.min.js, making an error of "kendoPDFViewer is not a function" appear at the console.

I have tried putting the scripts references at different points of the application other then the page itself, but that only caused more errors.

I removed the reference to the file vendors.bundle.js, but that made several parts of the project stop working.

So, my question is how do I find out what kind of conflict is this, and how to solve it.

Regards,

Alexandre

Alexandre
Top achievements
Rank 2
Iron
Iron
Iron
 asked on 01 May 2022
1 answer
597 views

Hey guys,

currently I'm using the pdf viewer with jquery initializing. In my case I have a custom configured toolbar setup with custom messages (because the german culture file doesn't translate the pdf viewer at all).

My viewer is looking like that (I have marked the lines which I've no idea how to implement these in tag helper syntax):

$('#pdfViewer').kendoPDFViewer({
	messages: {
		toolbar: {
			download: 'Herunterladen',
			pager: {
				first: 'Zur ersten Seite',
				last: 'Zur letzten Seite',
				next: 'Zur nächsten Seite',
				previous: 'Zur vorherigen Seite'
			},
			togglePan: 'Schwenkmodus',
			toggleSelection: 'Markierungsmodus',
			zoom: {
				zoomIn: 'Hineinzoomen',
				zoomOut: 'Herauszoomen'
			}
		}
	},
	pdfjsProcessing: {
		file: {
			data: @Model
		}
	},
	toolbar: {
		items: [
			{ type: 'pager', input: false, previousNext: true },
			{ type: 'zoom', zoomInOut: true },
			'toggleSelection',
			// 'search',
			'download',
			// 'print'
		]
	}
}).data('kendoPDFViewer');

Now I'm trying to implement the widget via tag helper syntax but I've no idea how to configure my custom toolbar setup. Any ideas or is it even possible with tag helper?

<kendo-pdfviewer name="pdfViewer">
	<messages>
		<toolbar download="Herunterladen">
			<pager first="Zur ersten Seite"
				   last="Zur letzten Seite"
				   next="Zur nächsten Seite"
				   previous="Zur vorherigen Seite"/>
		</toolbar>
	</messages>
	<pdfjs-processing file="@Model"/>
	<toolbar>
		<pdfviewer-toolbar-items>
			...
		</pdfviewer-toolbar-items>
	</toolbar>
</kendo-pdfviewer>

Regards,

Daniel

Aleksandar
Telerik team
 answered on 26 Apr 2022
1 answer
27 views

Hello,

PDF search is not working when PDF viewer is placed in modal. Is there any workaround for this?

Thanks.

Boris
Top achievements
Rank 1
Iron
Iron
 answered on 17 Feb 2022
1 answer
562 views

 

Hi I'm using PdfViewer on a a view and it works fine. The page contains a grid with more than one pdf file link and everithing works fine loading the viewer when grid select other lines.

I face a problem when the PDF file is occasionally corrupted, (rare case but can happen). In this case PdfViewer shows an error dialog "PDF file fails to process" and this is right. But after that error the PdfViewer object on the page become corrupted and show in console:


kendo.pdfviewer.js:1885 
        
       Uncaught TypeError: Cannot read properties of undefined (reading 'canvas')
    at r._calculateZoom (kendo.pdfviewer.js:1885)
    at r.exec (kendo.pdfviewer.js:1840)
    at init.execute (kendo.pdfviewer.js:2435)
    at init.zoom (kendo.pdfviewer.js:2425)
    at init.fromFile (kendo.pdfviewer.js:2502)
    at init.grid_row_select (VisDocForni?CodFor=000623:348)
    at init.trigger (kendo.all.js:164)
    at init.change (kendo.all.js:67990)
    at init.trigger (kendo.all.js:164)
    at init._notify (kendo.all.js:30078)

for any other valid PDF loading request, unless I refresh the page. I don't know how to reset PdfViewer in the "Error" event when it happens.

Thanks

Dome

 

Aleksandar
Telerik team
 answered on 14 Oct 2021
Narrow your results
Selected tags
Tags
+? more
Top users last month
Dominik
Top achievements
Rank 1
Giuliano
Top achievements
Rank 1
Dominic
Top achievements
Rank 1
Glendys
Top achievements
Rank 1
Iron
NoobMaster
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Dominik
Top achievements
Rank 1
Giuliano
Top achievements
Rank 1
Dominic
Top achievements
Rank 1
Glendys
Top achievements
Rank 1
Iron
NoobMaster
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?