打印菜单;如何使用文件 - &GT时打印OBJECT元素的内容? [英] How to print the content of an OBJECT element when using the FILE->PRINT menu?

查看:199
本文介绍了打印菜单;如何使用文件 - &GT时打印OBJECT元素的内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这显示一个对象元素内PDF的PHP脚本。 ADOBE READER插件处理这个罚款和使用Adobe工具栏用户可以打印嵌入的PDF。不过,有些用户的坚持的有关使用文件菜单(在Internet Explorer 8的用户的98%)来打印HTML文档。利用IE中的这个文件 - >打印菜单,HTML文档打印出来的没有OBJECT元素的内容(PDF)。 (打印preVIEW )使用这种方法来打印在Chrome或FF的结果文件中只目前在对象视口中显示的数据,要被打印。即,局部的对象,而不是实际的PDF文件。

<我一个href=\"http://stackoverflow.com/search?page=2&tab=relevance&q=html%20pdf%20won%27t%20print\">have搜索和阅读几个related 问题,在计算器上,但没有具体到这一情况或案件。其中一些解决方案的使用JavaScript方法或功能打印通过一个按钮或链接的内容。如果我不能让我的用户使用Adobe的工具栏在浏览器中打印PDF,我怀疑他们会改变自己的想法用一个按钮,上面写着打印。

为什么在IE造成的文件 - >打印方法在一个空白页?有没有一种方法,使使用文件 - >打印菜单时,浏览器打印对象元素的内容。没有JS黑客,按钮,链接,点击这里,内部框架,或建议内联显示它等。

有关参考,code这个查看PDF低于(其中,再次,做工精细,显示在对象元素的PDF内容,没有问题)。

 回声
&LT; HTML和GT;
 &LT; HEAD&GT;
  &LT;标题&gt;查看PDF&LT; /标题&GT;
 &LT; /头&GT;
 &LT;车身滚动='没有'&GT;
  &LT;'?getFile.php F = {$ file_hash}对象数据类型= ='应用程序/ PDFWIDTH =100%HEIGHT =100%&GT;
  &LT; H2&GT;错误:没有PDF插件&LT; / H&GT;
  &LT; P&gt;在浏览器没有安装PDF阅读器。为了查看在浏览器中的PDF,请&lt; A HREF =HTTP://get.adobe.com/reader'>下载Adobe Reader&LT; / a取代。 &所述; / P&GT;
  &LT; /对象&gt;
 &LT; /身体GT;
&LT; / HTML&gt;中;


解决方案

据我知道有此问题没有解决方案。我已经看到了一些开发商解决由<一个问题href=\"http://stackoverflow.com/questions/6167995/generate-a-pdf-that-automatically-prints\">generating PDF文件打开时自动显示打印对话框

另一个选项可以是,以显示在新窗口中,消除在工具栏和菜单,以避免视觉模糊的PDF文件。

  Window.open(URL,_blank,位置= 0,菜单= 0,工具栏= 0);

我不知道这一件作品,但你可以尝试检测浏览器打印事件,然后调用 pdfDoc.printAll(); 您的Acrobat Reader对象

I have a PHP script which displays a PDF inside an object element. Adobe Reader plugins handle this fine and using the Adobe toolbar users can print the embedded PDF. However, some users insist on using the File menu (98% of users on Internet explorer 8) to print the HTML document. Utilizing this File->Print menu in IE, the HTML document is printed out without the contents (PDF) of the OBJECT element. (Print Preview) Using this method to print the document in Chrome or FF results in only the data currently shown in the Object viewport, to be printed. That is, a partial object and not the actual PDF.

I have searched and read a few related questions on StackOverflow, but nothing specific to this situation or case. Some of these 'solutions' use a Javascript method or function to print the content via a button or link. If I can't get my users to use the Adobe toolbar in the browser to print a PDF, I doubt they'll change their minds to use a button that says 'PRINT'.

Why does the File->Print method in IE result in a blank page? Is there a way to make the browser print the contents of an Object element when using the File->Print menu. No JS hacks, buttons, links to 'click here', iframes, or suggestion to 'display it inline' etc.

For reference, the code for this 'View PDF' is below (which, again, works fine to display the PDF content in the object element; no issues).

echo "
<html>
 <head>
  <title>View PDF</title>
 </head>
 <body scroll='no'>
  <object data='getFile.php?f={$file_hash}' type='application/pdf' width='100%' height='100%' >
  <h2>Error: No PDF plugin</h2>
  <p>The browser does not have a PDF viewer installed.  In order to view the PDF in the browser, please <a href='http://get.adobe.com/reader'>download Adobe Reader</a>. </p>
  </object>
 </body>
</html>";

解决方案

As far as I know there is no solution for this issue. I have seen some developers "solving" the problem by generating a PDF file that automatically shows the print dialog when opened

Another option could be to show the PDF file in a new window that removes the toolbar and menus in order to avoid the visual ambiguity.

Window.open(url, "_blank", "location=0,menubar=0,toolbar=0");

I do not know if this one works, but you could try detecting the browser print event, then calling pdfDoc.printAll(); on your Acrobat Reader object.

这篇关于打印菜单;如何使用文件 - &GT时打印OBJECT元素的内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆