You need to sign in to do that
Don't have an account?

print something with javascript
Hello everyone!!
I have a VF Page with this code:
<apex:column headervalue="IDS"><a href="/servlet/servlet.FileDownload?file={!item.Attachment_Id__c});" target="_blank">{!item.Attachment_Name__c}</a></apex:column>
With this I open a PDF attached. Now I want, by doing clic, print this PDF, I've tried this
<apex:column headervalue="IDS"><a href="javascript:window.print(/servlet/servlet.FileDownload?file={!item.Attachment_Id__c});" target="_blank">{!item.Attachment_Name__c}</a></apex:column>
but it doesn't work!
any idea?
Thanks in advance!!!
Render your PDF in an iFrame and print its content using javaScript
<script>
function iprint(ptarget)
{
ptarget.focus();
ptarget.print();
}
</script>
<body>
<apex:iframe id="Frame2Print" width="500" height="200" src="/apex/MyPDFPage"/>
<input type="button" value="Print PDF" onclick="iprint(Frame2Print);" />
</body>