Hi,
I am having a .PDF file which has 2 pages.
I want to display it directly in webpage.Is there any possible way to do this with telerik.pdf namespace.
Like reading pdf file using streambytes and display it in webpage.
please advise me to get this done.
Thanks in advance.
Regards,
AGM Raja
I am having a .PDF file which has 2 pages.
I want to display it directly in webpage.Is there any possible way to do this with telerik.pdf namespace.
Like reading pdf file using streambytes and display it in webpage.
please advise me to get this done.
Thanks in advance.
Regards,
AGM Raja
6 Answers, 1 is accepted
0
Shinu
Top achievements
Rank 2
answered on 25 Oct 2013, 09:37 AM
Hi Agm,
Telerik.PDF namespace is used internally for generating PDF files. Telerik does not provide any control with RadControls for ASP.NET AJAX suit dedicated for viewing PDF files. One suggestion is, If you want to display a PDF file, then you can use a RadWindow as shown below.
ASPX:
JavaScript:
Thanks,
Shinu.
Telerik.PDF namespace is used internally for generating PDF files. Telerik does not provide any control with RadControls for ASP.NET AJAX suit dedicated for viewing PDF files. One suggestion is, If you want to display a PDF file, then you can use a RadWindow as shown below.
ASPX:
<
telerik:RadWindowManager
ID
=
"RadWindowManager1"
runat
=
"server"
>
<
Windows
>
<
telerik:RadWindow
ID
=
"RadWindow1"
runat
=
"server"
ShowContentDuringLoad="true"
Width
=
"600px"
Height
=
"600px"
>
</
telerik:RadWindow
>
</
Windows
>
</
telerik:RadWindowManager
>
<
telerik:RadButton
ID
=
"RadButton1"
runat
=
"server"
Text
=
"Open PDF"
AutoPostBack
=
"false"
OnClientClicked
=
"openPdf"
>
JavaScript:
<script type=
"text/javascript"
>
function
openPdf(sender, args) {
window.radopen(
"FileName.pdf"
,
"RadWindow1"
);
}
</script>
Thanks,
Shinu.
0
Lisa
Top achievements
Rank 1
answered on 25 Oct 2013, 08:26 PM
Hi,
I am also looking for a way to display a pdf file on my web page (along with some other controls). I tried the code you provided but it did not work for me. It opened the window, but the window was blank. In the function I wrote "C:\Development\MyFile.pdf" in place of "FileName.pdf" because that is the path to a real pdf file on my computer. As I said, a window opens but it does not display the file. At the bottom of the window, it says C:DevelopmentMyFile.pdf - it stripped out the "\"s.
I am also looking for a way to display a pdf file on my web page (along with some other controls). I tried the code you provided but it did not work for me. It opened the window, but the window was blank. In the function I wrote "C:\Development\MyFile.pdf" in place of "FileName.pdf" because that is the path to a real pdf file on my computer. As I said, a window opens but it does not display the file. At the bottom of the window, it says C:DevelopmentMyFile.pdf - it stripped out the "\"s.
0
Shinu
Top achievements
Rank 2
answered on 28 Oct 2013, 07:58 AM
Hi Lisa,
RadWindow is based on an IFRAME and it behaves just like that. That is why you cannot open a file by its physical path (actually a physical path has \ as a path separator). RadWindow works with URLs and so you need to use an absolute or relative URL to that file on your server. Also make sure to set ShowContentDuringLoad to true - this is needed when opening non-web page files like pdf or doc in RadWindow.
Hence I suggest you place all the required PDF files inside your project folder and open the files as shown in the following sample.
JavaScript:
Thanks,
Shinu.
RadWindow is based on an IFRAME and it behaves just like that. That is why you cannot open a file by its physical path (actually a physical path has \ as a path separator). RadWindow works with URLs and so you need to use an absolute or relative URL to that file on your server. Also make sure to set ShowContentDuringLoad to true - this is needed when opening non-web page files like pdf or doc in RadWindow.
Hence I suggest you place all the required PDF files inside your project folder and open the files as shown in the following sample.
JavaScript:
<script type=
"text/javascript"
>
function
openPdf(sender, args) {
var
filelocation =
"/Project_Root_Folder/PDF_Files/ORM.pdf"
;
window.radopen(filelocation,
"RadWindow1"
);
}
</script>
Thanks,
Shinu.
0
Agm
Top achievements
Rank 1
answered on 29 Oct 2013, 03:31 PM
Hi Shinu,
I want to open the pdf file in the same browser window not in popup.
but thanks for the information Telerik does not provide any control for viewing PDF files.
Thanks again.
Regards,
AGM Raja
I want to open the pdf file in the same browser window not in popup.
but thanks for the information Telerik does not provide any control for viewing PDF files.
Thanks again.
Regards,
AGM Raja
0
Hi Raja,
Could you please vote in the following Public Feedback item: PDF viewer for ASP.NET?
Best regards,
Rumen
Telerik
Could you please vote in the following Public Feedback item: PDF viewer for ASP.NET?
Best regards,
Rumen
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Majda
Top achievements
Rank 1
answered on 21 May 2018, 10:22 AM
hi Shinu
<script type="text/javascript">
function openPdf(sender, args) {
var filelocation = "/Project_Root_Folder/PDF_Files/ORM.pdf";
window.radopen(filelocation, "RadWindow1");
}
</script>
I just want to know location of all my PDF is Physical Path --->C:\email_Download\
In this case var filelocation = "C:/email_Download//XXX.pdf";
It does not work Can u suggest ? i am confuse in physical path and relative path