This is a migrated thread and some comments may be shown as answers.

How to close pdf file?

8 Answers 777 Views
PdfViewer and PdfViewerNavigator
This is a migrated thread and some comments may be shown as answers.
Thomas
Top achievements
Rank 1
Thomas asked on 25 Feb 2013, 10:32 AM
Hi,

I'm using PdfViewer and it works file, but how to unload opened document programmatically?

8 Answers, 1 is accepted

Sort by
0
Accepted
Stefan
Telerik team
answered on 28 Feb 2013, 07:24 AM
Hi Thomas,

Thank you for writing.

Currently, RadPdfViewer does not have a feature for unloading documents. I will add this as a feature request in our
Public Issue Tracking System. Feel free to add your vote for it here: http://www.telerik.com/support/pits.aspx#/public/winforms/14400.

Your Telerik Points have been updated for this report.

For the time being, you can add a new menu item in the context menu for example ("Close") and when it is clicked, you can load an empty pdf file like the one attached.
    RadMenuItem close = new RadMenuItem("Close");
    close.Click += close_Click;
    radPdfViewer1.RadContextMenu.Items.Add(close);
 //....
void close_Click(object sender, EventArgs e)
{
    radPdfViewer1.LoadDocument(@"C:\BLANK.pdf");
}

I hope that you find this information useful

Regards,
Stefan
the Telerik team
WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Join us for a FREE webinar to see all the new stuff in action.

Interested, but can’t attend? Register anyway and we’ll send you the recording.
0
RAG
Top achievements
Rank 1
answered on 01 Mar 2013, 12:18 PM
Hi,

you can also set the visible-Property of the Viewer-Control to false until you load a new document - that's the way I do it.
0
Marco
Top achievements
Rank 2
Veteran
answered on 05 Jul 2013, 07:41 AM

Just for a quick update.

This feature has been added to the RadPdfViewer.

You could now use the UnloadDocument() Sub of a RadPdfViewer.

If someone in Telerik staff could add a line in the online documentation about that. Will save some time to all developper which where traumatize by Adobe's PDF viewer control.

 

 

 

 

 

0
Stefan
Telerik team
answered on 08 Jul 2013, 10:17 AM
Thank you for your suggestion Marco. I will make sure this gets into the documentation with the next upload.
 
Regards,
Stefan
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
John Littleton
Top achievements
Rank 1
answered on 09 Jan 2014, 02:50 PM
Hello. I am using the RadPDFViewer control, and have found that when the UnloadDocument method is called it does clear the document from view, but does not actually release the file until another document is loaded. Is there a way to force it to release a file without having to load another file? Thanks.
0
Stefan
Telerik team
answered on 10 Jan 2014, 08:45 AM
Hello John,

Thank you for writing. 

I have tested the UnloadDocument and it seems that on my end the pdf file is released appropriately. Can you please provide me with details about the scenario you are testing, so I can reproduce the same case on my end and help you with it?

I am looking forward to your reply. 

Regards,
Stefan
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Mimi
Top achievements
Rank 1
answered on 19 Dec 2018, 11:15 PM

Hi,

I am finding that even after using .UnloadDocument() and loading the pdfViewer with another document, the pdfViewer still holds onto the original document and disables my ability to delete the original document programmatically. I am trying to overwrite the original file in my scenario so I am deleting and creating a new file with the same name.

Any suggestions?

Thank you!

0
Hristo
Telerik team
answered on 21 Dec 2018, 11:47 AM
Hi Mimi,

We are not aware of a similar issue in the RadPdfViewer. Once the document has been loaded the file stream should be released. Can you please provide us with more details about your actual project and details how it can be reproduced?

Regards,
Hristo
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
PdfViewer and PdfViewerNavigator
Asked by
Thomas
Top achievements
Rank 1
Answers by
Stefan
Telerik team
RAG
Top achievements
Rank 1
Marco
Top achievements
Rank 2
Veteran
John Littleton
Top achievements
Rank 1
Mimi
Top achievements
Rank 1
Hristo
Telerik team
Share this question
or