Print pdf in webpage - asp.net

I have an ASP.net web page embeded a pdf file using the object tag as below:
<object data="<%=this.FilePath %>" type="application/pdf" style="width:600px; height:820px; border:solid 1px #888;">
<embed src="<%=this.FilePath %>" type="application/pdf" />
</object>
The viewer run good and I assume all client PCs have Adobe Reader installed.
I want to make a button to simply:
remove the button panel of adobe reader
create a button to print the pdf document(using the reader's API or any other method)

That type of customization isn't possible in the Acrobat Reader Plugin AFAIK.
You can hide the default button panel by adding #toolbar=0 to the url, but the user can just 'unhide' it if he wants.

Related

asp.net AjaxFileUpload not working

I have implemented bootstrap design in my asp.net application with ajaxcontrol toolkit v17.0.
I need to implement AjaxFileUpload, but it not showing properly on my page and even when I click on it, it not responding anything, file selection popup not open, and even no browser console error is there.
<div class="col-md-4">
<ajaxToolkit:AjaxFileUpload ID="fuSpecialReportFiles" runat="server" AllowedFileTypes="png, jpg, jpeg, bmp" OnUploadComplete="fuSpecialReportFile_UploadComplete" />

Print server side text file at client printer in asp.net web application

I do have an asp.net web application, from which I need to display some coupon details in the screen, with the print option on the page. On clicking the print button, server side formatted text file should be generated and it should be printed in the client local machine.
How to implement this?
Use javascript
window.print()
print
You can print asp.net by java script. from blow code.
<asp:Button ID="printButton" runat="server" Text="Print" OnClientClick="javascript:window.print();" />
You can find more ways on following link.
http://www.codeproject.com/Questions/351577/How-to-print-in-asp-net
http://www.codeproject.com/Articles/13795/Creating-print-preview-page-dynamically-in-ASP-NET
I hope it will help you.

Embed Image to aspx page from code behind

I'm programmatically (server-side) creating an Image object after my user chooses some value from a combonox.
I want to embed this image back into the aspx page at runtime, without saving it to disk or database.
So how can I do this? I tried to use memory stream, and send the image with response object, but than I only saw the image - it had overwritten the entire page.
Thanks...
Create the Handler and request it via:
<img src="Image.ashx?ID=myImageId" alt="text here"/>
<asp:Image runat="server" ImageUrl="~/Image.ashx?ID=myImageId" />
You could base64 encode the data and write it to the image data.
Like this:
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA
AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
9TXL0Y4OHwAAAABJRU5ErkJggg==" alt="Red dot">
For this you will have to render the img tag yourself.
This way you don't have to write your image to a file on the server. It is sent from memory directly to the client browser.
Refer: Data URI schemes
Note this does not work with IE6.
Do something like this
<img src="yourimagegeneratingpage.aspx?query=value" />
When this image will be loaded it will generate a request to your page (yourimagegeneratingpage.aspx) and that page would respond with the image which will be shown by this img control.

Directly Print PDF in client side without viewing it

I have PDF file in server, when user clicks print button on my asp.net page I need to show print dialogue directly without showing the PDF. How can I achieve this? Please guide me.
This only works in IE, but you can embed the Adobe ActiveX control into an HTML page as follows:
<object classid="clsid:CA8A9780-280D-11CF-A24D-444553540000" style="height:75%; width: 100%; display: none;" id="viewer" name="viewer" VIEWASTEXT>
<param name="src" value="document.pdf">
</object>
Then in the onclick of the print button you can do this:
viewer.printWithDialog();
Might be able to tweak this for other browsers.

how to show pdf inside the aspx page?

net mvc 3. I want to display the pdf file as a part of aspx page for preview purpose.
i don't want to use IFrame control. can we do this ?
I know you said no frames, but Google PDF viewer seems to be the most popular:
<iframe src="http://docs.google.com/gview?url=http://example.com/mypdf.pdf&embedded=true"
style="width:718px; height:700px;" frameborder="0"></iframe>
And you can try:
<embed src="http://yoursite.com/the.pdf" width="500" height="375">
Best Way to Embed PDF in HTML

Resources