Printing Iframe content

N

nightstar

I am creating a web page that will contain multiple Iframes. One of
the Iframes will contain a bill of sale that is generated by a script
on x.mydomain.com/somefile.php?someparameters. One of the Iframes will
contain a PDF of a multiple page scanned document (this iframe can be
printed via the acrobat reader print button). The other iframes will
contain a jpeg of a scanned document which comes from
y.mydomain.com/somelocation/file.jpg.

The first iframe containing the bill of sale and each iframe containing
a jpeg could need to be printed. I will need to add a button on the
parent page (not within the iframe) to the bill of sale and each jpeg
iframe there after. This way the user can choose which documents to
print.

I have a function on the order of:

function (framename)
{
framename.focus();
framename.print();
}

then i make a button for each iframe, each iframe has a different name.

On my local development client I can get the bill of sale to print
(which is on the same x.domain.com as this multiple iframe script is
on) When I goto print the jpegs (on y.mydomain.com) I get an access
denied.


Is there an easy way of doing this. Any help appreciated.
 
R

RobG

I am creating a web page that will contain multiple Iframes. One of
the Iframes will contain a bill of sale that is generated by a script
on x.mydomain.com/somefile.php?someparameters. One of the Iframes will
contain a PDF of a multiple page scanned document (this iframe can be
printed via the acrobat reader print button). The other iframes will
contain a jpeg of a scanned document which comes from
y.mydomain.com/somelocation/file.jpg.

The first iframe containing the bill of sale and each iframe containing
a jpeg could need to be printed. I will need to add a button on the
parent page (not within the iframe) to the bill of sale and each jpeg
iframe there after. This way the user can choose which documents to
print.

I have a function on the order of:

function (framename)
{
framename.focus();
framename.print();
}

then i make a button for each iframe, each iframe has a different name.

On my local development client I can get the bill of sale to print
(which is on the same x.domain.com as this multiple iframe script is
on) When I goto print the jpegs (on y.mydomain.com) I get an access
denied.


Is there an easy way of doing this. Any help appreciated.

The advice provided by FAQ #19 seems appropriate. Browser security
stops you from accessing anything in a window from another domain, not
even the src attribute of the iframe that it's displayed in.

Best to collate the pages on your server and serve them from there.

You could put an object in your page that has frameName:url pairs so you
can get the URL from there then open a new window loaded with the 'other
domain' URL. But you can't remotely print it[1], the user would have to
print it (say press ctrl+p) for the same cross-domain reason noted above.

From the FAQ:

<URL:http://msdn.microsoft.com/workshop/author/om/xframe_scripting_security.asp>


[1] Calling window.print() on a child window with a page loaded from
another domain seems problematic in the browsers I tested - it works
sometimes on some browsers but not most of the time for others. Its
unreliability makes it unsuitable for a corporate Intranet or general
web environment.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top