Click here to Skip to main content
14,971,029 members
Please Sign up or sign in to vote.
4.33/5 (2 votes)
See more:
Dear All,

I want to open PDF file in my webpage without save and print option.
But not able to do that.
Save and Print option comes by default.

I am using VS 2005.

Is there any third party control (free) which i can use?

Even browser toolbar come to save or print PDF.

Please help me out.
Posted
Comments
Gaurav Bari 3-Feb-15 5:10am
   
same here ...i want to give only reading priority

The one that opens the PDF file is the client machine, using or the browsers build in capabilities (Chrome) or installed application - like Adobe Reader - that identified by mime type (IE).
If you want to disable save and print you have to modify the security settings on the PDF file itself.
You may use one of these libraries for that:
http://pdfsharp.codeplex.com/[^]
http://sourceforge.net/projects/itextsharp/[^]
   
Comments
[no name] 21-Jan-14 6:17am
   
Thank you for reply. There are many PDF files, and those are provided by client.
I tried to use ITextSharp yesterday but it creates pdf file with save and print option.
I just want to open in my webpage just to display it to user.
Browser settings we cant change na?
Kornfeld Eliyahu Peter 21-Jan-14 6:40am
   
For iTextSharp use PdfEncryptor...
[no name] 21-Jan-14 6:58am
   
Ya i tried the same. it creates PDF file with password protection.
But client don't want to download file on user machine.
Kornfeld Eliyahu Peter 21-Jan-14 7:20am
   
You mean you want to show the file without download it?
[no name] 21-Jan-14 7:25am
   
yes. it should open in my webpage.
Kornfeld Eliyahu Peter 21-Jan-14 7:32am
   
At the moment you show something on the web page it's downloaded to the client's computer! Even it seems not...
You can hie this fact from user using a web page to stream the content of the PDF file.
Go here: http://channel9.msdn.com/Forums/TechOff/250657-ASPX-page-to-stream-a-PDF
   
Comments
Kornfeld Eliyahu Peter 21-Jan-14 6:35am
   
But after opening that PDF it will be printable...
In PDF the options like ave and print are kind of security settings - so that what he have to address..
JoCodes 21-Jan-14 6:54am
   
Yes , you are right. Should use PDF viewers which has the option to restrict it.
Kornfeld Eliyahu Peter 21-Jan-14 7:19am
   
This security settings are part of the PDF declaration and should not depend on viewer...
[no name] 21-Jan-14 6:49am
   
yes and it allows user to download that PDF file which i dont want
Why not an iframe pointing to the pdf inside your website or virtual directory.

You could also use:

http://viewerjs.org/[^]

or

https://mozillalabs.com/en-US/pdfjs/[^]
   
Comments
[no name] 21-Jan-14 6:59am
   
Iframe is good option but still save and print option is available in browser.
Do you have any example related to above links ?
db7uk 21-Jan-14 7:07am
   
ahhh I see sorry, did not read "without open save".

hmmmm, your best bet then is to using something like http://www.pdfsharp.com/PDFsharp/ and parse each page of the pdf and then create an image from those pages. These images could then be fixed into the site. However, the problem here is that someone could download the image?
[no name] 21-Jan-14 7:27am
   
hmm i gave this solution before
but they want user can view it in webpage and can search in that PDF which is not possible in Images
vinomay 19-Feb-14 6:09am
   
Hi,

I have a dought, How to display pdf in webpage using asp.net, and user can only view the pdf, they shouldnt do download and print and save, how to restrict download,print,save option
YogitaMS 14-Feb-19 23:45pm
   
have you found the solution?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900