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.
Related
I am developing a desktop application in Windows Forms-C#. This has a report which is shown using WebBrowser control.
I have generated a Report in HTML format. The report has 2 pages, Page 1-TnC and Page 2-Annexure. I have used "page-break-after" to add page-break forcefully.
<style>
.forcedbreak {page-break-before: always;}
</style>
</head>
<body>
<div>
<div class="forcedbreak">
</div
><div id="pg2">
When output of report is displayed in Web browser, the page-break is not shown. If I use the as same HTML string and store as a HTML page and open in IE the page-break is displayed as expected. If I render the same HTML string as PDF, the PDF is also showing page-break as expected.
The same HTML is not rendered properly in WebBrowser control of Winform.
Can anyone help me about WebBrowser Control?
I have referred to this post also.
Can I force a page break in HTML printing?
I want a quick and easy (plugin dependent) PDF embedded view, not just a download link for File items.
My custom File schema looks like:
class IBulletin(form.Schema):
...
form.primary('file')
file = NamedBlobFile(
title=_(u"File"),
required=False,
)
class Bulletin(Item):
grok.implements(IBulletin, IFile)
I follow instruction at http://www.kcsts.co.uk/blog/embedded-pdf-in-file-view-with-plone and it works for Archetypes File view, but seems not working for Dexterity File view.
I guess the critical part is within <object ...> and <embed ...>. My trial to the template looks as follows:
<metal:content-core define-macro="content-core"
tal:define="content_type context/file/contentType|nothing;
location string:${context/absolute_url}/##download/file/${context/file/filename};
v python:context.restrictedTraverse('contenttype_utils');">
<object class="viewembededfile" type="application/pdf" data=""
tal:condition="python:content_type.endswith('pdf')"
tal:attributes="data location; width string:100%; height string:900">
Please click here to download the PDF.
<embed src="" class="viewembededfile" type="application/pdf"
tal:attributes="src location">
</embed>
</object>
...
I also tried <object ... attributes="data context/absoulte_url;" and <embed ... attributes="src context/absolute_url" but does not work. It shows only a block with gray background. See the image for reference.
Any advice?
I faced the same problem and after some trial and error, I found out that if I don't include the file name at the end of the location of the pdf file then at least Firefox starts to show the embedded pdf.
<object type="application/pdf"
tal:attributes="data string:${context/absolute_url}/##download/file">
</object>
Same applies for links to the pdf file, with file name a download dialog is shown, and without the pdf file is rendered inside Firefox.
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.
<iframe id="myFrame" runat="server" name="main" width="100%" src="http://www.somewebpage.com/" />
This is simple iFrame I put on my webpage. After I click on couple of buttons on that website, iframe source remains the same. But I want to be able to retrieve the changed source every time I click on buttons, links etc...
How can I achieve this?
Edit: This is the screenshot of my work. When I click on "Git" button, webpage loads on the iFrame. However, when I surf on the website, I want textbox to be updated to the source of the iFrame.
Ok, here is an idea that I test it now and its work. You change the input box after the iframe loads using the onload event of the iframe
<script>
function HasChange(me)
{
document.getElementById("WhereIamId").value =
document.getElementById("WhatIShowID").src;
return false;
}
</script>
and the html
<input type="text" id="WhereIamId" value="" />
<iframe src="page1.aspx" onload="return HasChange(this);" id="WhatIShowID" ></iframe>
You can use also the document.getElementById("<%=myFrame.ClientID>") to get the rendered id. After your iframe loads you update the text box with the current url.
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