PDA

View Full Version : Printing another page


Érico
09-20-2005, 10:10 PM
I need to make the browser print a page. The page that needs to be printed is just a image and I can't put code there. Is there a way I can open the printer dialog on this page by calling it in the form submit of the parent page?

This is the submit of the parent page:
<input type="submit" name="submit" value="Print" onClick="document.theform.action='http://url:9090/boleto';">

Need to fit this somehow:
<script language="JavaScript">window.print();</script>

_Aerospace_Eng_
09-20-2005, 10:32 PM
If you don't have control over the page you need to print then there isn't really anything you can do. You will get an access denied error.

Jon Hanlon
09-21-2005, 11:19 PM
There is no way to automatically instigate a print.
You can try a <link> tag in the <head>:
<link rel="alternate" media="print" href="greatBigPicture.gif" >
This causes the browser to print an alternate version of the current page.

http://www.dynamicdrive.com/dynamicindex9/printstyle.htm

maskd
09-22-2005, 12:50 AM
Did you mean something like this?


<html>

<head>

<title>Print external page</title>

<script language="Javascript">

function printOther()
{
frames['iframe'].print();
}

</script>
</head>
<body>
<input type="submit" value="Print" onClick="printOther();">
<hr>
<iframe src="{URL_TO_BE_PRINTED}" name="iframe">

</body>

</html>


Change {URL_TO_BE_PRINTED} with what page you want to be printed. I'm sure this could be edited to make it better with maybe a text box to input what url you want or something