為了改善您的使用體驗,本網站正在進行維護,部分功能暫時無法使用。若本站的文件無法解決您的問題,想要向社群發問的話,請到 Twitter 上的 @FirefoxSupport 或 Reddit 上的 /r/firefox 發問,我們的社群成員將很快會回覆您的疑問。

搜尋 Mozilla 技術支援網站

防止技術支援詐騙。我們絕對不會要求您撥打電話或發送簡訊,或是提供個人資訊。請用「回報濫用」功能回報可疑的行為。

了解更多

Printing an IFrame with PDF content is no longer working using window.frames['frameId'].print();

  • 5 回覆
  • 70 有這個問題
  • 16 次檢視
  • 最近回覆由 mann_inv

more options

I have a parent HTML page that contains an IFrame whose source is a PDF document. In the parent page, I use JavaScript to print the contents of the IFrame (the PDF document) and it no longer works. This worked fine previous to version 4.

I have a parent HTML page that contains an IFrame whose source is a PDF document. In the parent page, I use JavaScript to print the contents of the IFrame (the PDF document) and it no longer works. This worked fine previous to version 4.

所有回覆 (5)

more options

Does anyone have a work around to this?

more options

This is still an issue in Firefox 4.0.1.

Anyone found a work around yet? Where can I officially report this to Mozilla?

由 dwaddell 於 修改

more options

Do you have test case set up or a live web page where we can check that out?

more options

Here is an example of what I am trying to do which worked in earlier versions of Firefox and still works in Chrome. Any ideas on getting the print to work?



<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PDFPrintTest.aspx.cs" Inherits="MozillaTestApp.PDFPrintTest" %>

<title></title>

<form id="form1" runat="server">
<iframe runat="server" id="pdf" name="pdf" style="width:100px; height:100px;" src="PDF/ThePDF.pdf"></iframe> <asp:Button ID="printButton" runat="server" Text="Print" OnClientClick="PrintOnload();return false;" />
</form> <script language="javascript" type="text/javascript"> function PrintOnload() { if (navigator.appName == "Microsoft Internet Explorer") { } else { PrintPDF_FF(); } } function PrintPDF_FF() { window.frames['pdf'].focus(); window.frames['pdf'].print(); } </script>

more options

I have same issue for printing embedded PDF files in iFrames via JavaScript in Firefox 5.0.

In previous versions it was working fine. But not in Firefox 4.0/5.0.

Is there any solution for this problem?