- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在通过浏览器查看 FPDF/PHP 生成的 PDF 时运行 JavaScript 时遇到一些问题。该脚本应该显示打印对话框或消息框。此功能已运行多年,但似乎因 Edge/Windows 的重新更新而被破坏。经过调查,似乎行为因浏览器/查看器而异。
关于完全更新的 Windows 10 的调查结果:
与消息框调用相同的故事。
我正在按照 FPDF JavaScript support 中指定的方式扩展 FPDF示例。
<?
require('fpdf.php');
class PDF_JavaScript extends FPDF {
// My code start
function OpenPrintDialog()
{
$this->IncludeJS("print(true);");
}
function ShowMessageMessage($text)
{
$this->IncludeJS("app.alert('$text', 3);");
}
// My code end
protected $javascript;
protected $n_js;
function IncludeJS($script, $isUTF8=false) {
if(!$isUTF8)
$script=utf8_encode($script);
$this->javascript=$script;
}
function _putjavascript() {
$this->_newobj();
$this->n_js=$this->n;
$this->_put('<<');
$this->_put('/Names [(EmbeddedJS) '.($this->n+1).' 0 R]');
$this->_put('>>');
$this->_put('endobj');
$this->_newobj();
$this->_put('<<');
$this->_put('/S /JavaScript');
$this->_put('/JS '.$this->_textstring($this->javascript));
$this->_put('>>');
$this->_put('endobj');
}
function _putresources() {
parent::_putresources();
if (!empty($this->javascript)) {
$this->_putjavascript();
}
}
function _putcatalog() {
parent::_putcatalog();
if (!empty($this->javascript)) {
$this->_put('/Names <</JavaScript '.($this->n_js).' 0 R>>');
}
}
}
$pdf = new PDF_JavaScript();
$pdf->AddPage();
$pdf->SetFont('Arial', '', 20);
$pdf->Text(90, 50, 'Print me!');
$pdf->OpenPrintDialog();
// or
//$pdf->ShowMessageMessage('Message box me!');
$pdf->Output();
?>
是否根本不可能指望 PDF JavaScript 功能在不同的浏览器/查看器中被允许?
最佳答案
Is it simply not possible to count on PDF JavaScript functionality being allowed in different browsers/viewers?
这是不可能的。您尝试运行的 JavaScript 仅适用于 Adobe Acrobat 和 Reader 以及我所知道的其他一些桌面 PDF 查看器和一种移动 PDF 查看器。该代码在 Edge 中不起作用,因为 Edge 有自己的内置 PDF 查看器,Explorer 将使用 Adobe Reader 或 Acrobat、Foxit、Nuance、Nitro 或其他操作系统级别的 Reader 来显示 PDF,这就是您收到该对话框的原因.
简而言之,您不能指望正确的查看器/浏览器/操作系统组合来运行 PDF 中的任何 JavaScript。
关于javascript - PDF JavaScript 不再在 Edge 中运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45600826/
我想通过注册表更改 Edge 浏览器中的主页,但它是加密的,我在注册表中看到( protected - 修改违反 Windows 策略。请参阅 aka.ms/browserpolicy)。请帮助我在注
如果我开发一个网站,它是否会以相同的方式在 IE11、Chrome、Firefox 和 edge 上运行,还是我们需要专门为 IE11 编写代码?我没有 Windows 8,因此无法在边缘浏览器上测试
如果我开发一个网站,它是否会以相同的方式在 IE11、Chrome、Firefox 和 edge 上运行,还是我们需要专门为 IE11 编写代码?我没有 Windows 8,因此无法在边缘浏览器上测试
如果 Edge 在某些机器上发生崩溃,我们需要检查日志以了解发生了什么情况。 最佳答案 Microsoft Edge 实际上是一个 Windows 进程,因此您应该能够在事件查看器中查看日志。此外,您
我们公司已将 Chrome 扩展程序移植到 Edge。扩展工作正常,但弹出窗口本身有很多重要内容。如果您在扩展设置中切换“地址栏旁边的显示按钮”,边缘扩展似乎只显示弹出按钮。这通常是一种糟糕的用户体验
我正在尝试在 Microsoft Edge 中调试崩溃的应用程序,但它提供了友好的错误页面: This page is having a problem loading We tried to loa
经过长时间的研究,我创建了我的最佳电子书 (Epub) 阅读器。作为主要设备,我基本上使用 Windows 10 平板电脑和 Microsoft Edge 作为 (Epub) 阅读器。 这是伟大的和惊
如何使用注册表或命令行获取 Microsoft Edge 浏览器版本? 我不想从 UI 中获取它。 最佳答案 对于 Microsoft Edge Legacy ,您可以使用 Get-AppxPacka
是否有可靠的编程方式来确定 Microsoft Edge 是默认浏览器? 我知道一种选择是使用 IApplicationAssociationRegistration::QueryCurrentDef
当人们在 Edge 中浏览网站时,很高兴看到“阅读 View ”按钮已启用。想要了解一个页面如何适合阅读模式。这将有助于开发人员在开发网站时牢记阅读模式。 最佳答案 答案来自 Microsoft Ed
我们在三周前向申请表提交了 Microsoft Edge 扩展:https://aka.ms/extension-request . 我们还没有收到任何反馈,在开发者仪表板中提交扩展包时,我们收到以下
我可以运行 code 从 WSL2 内部启动 VSCode。 我将如何启动 Edge(当前基于 Chromium 的 Edge)? 我试过了: ~/Code/company/workshops-web
最新版本的 Microsoft Edge 浏览器 (41.162...) 在单击后退和前进按钮时请求新页面。我在多个平台上测试了多个浏览器,只有 Edge 表现出这种行为。 这是一个 test pag
我在 Windows 1803 版本 17134.376 中使用 Microsoft Edge。 我有一个在 IIS 中本地运行的 ASP.NET Core 网站。该网站在 Edge 中可以正常打开,
Edge on Desktop 未加载谷歌字体。事实上,它甚至没有使用被定义为回退的“sans-serif”。 此行为不会在 Mobile Edge 中复制。 How it should look l
iotedge logs 暴露的日志在哪里?命令存储? 通常在 Linux 上会在哪里? 最佳答案 只需执行 docker inspect 及以下 LogPath您将获得容器的当前位置。例如。对于
我正在尝试将 Polymer 2 组件集成到现有的 SPA([ab] 使用 JSF 构建)。只要我的 POC 在 Chrome 中运行,我的基础知识就可以正常工作,我真的不在乎它是在 Shadow 还
我们的大型单页 JavaScript 应用程序在 Edge 浏览器中根本无法运行。 (我们在 Chrome 和 Firefox 中正式支持它,我们不允许在 IE 中使用它,因为它只能在那里工作一半,我
Microsoft Edge 16 中存在错误(已多次报告并在此处确认:https://developer.microsoft.com/en-us/microsoft-edge/platform/is
Microsoft Edge 16 中存在错误(已多次报告并在此处确认:https://developer.microsoft.com/en-us/microsoft-edge/platform/is
我是一名优秀的程序员,十分优秀!