我正在尝试设置嵌入 PDF 的视图。我希望这样当用户单击并在浏览器中打开 PDF 时,查看模式已设置为页面宽度而不是默认的自动缩放。
我看过这个pdf:http://www.heinelt.info/pdf/PDFOpenParameters.pdf寻求帮助。
添加
#view=FitH
url 的末尾是 pdf 所说的操作,但这不起作用,尽管诸如页面跳转 ( #page=3 ) 之类的操作可以。
这是我链接 pdf 的方式
<a href="javascript:loadPDF('http://www.pdfpdf.com/samples/Sample3.PDF#view=FitH');"
链接前的“ javascript:loadPDF ”用于嵌入 PDF,以便 pdf 在同一页面内打开。 (因此 PDF 不会离开页面或在新的 pdf 中打开。)
帮忙?我使用#view=FitH 是否错误?
href 不能以这种方式包含 JavaScript 指令。所以它只是将 pdf 和动作放入嵌入的框架对象中
<a href="https://www.pdfpdf.com/samples/Sample3.PDF">download</a>
类似于
cURL -O -A "browser" "https://www.pdfpdf.com/samples/Sample3.PDF"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 931k 100 931k 0 0 926k 0 0:00:01 0:00:01 --:--:-- 930k
链接到外部 HTML 相关 SRC= 的备用内联页面框架是:
<embed type="application/pdf" src="https://www.pdfpdf.com/samples/Sample3.PDF#view=FitH" >
<iframe type="application/pdf" src="https://www.pdfpdf.com/samples/Sample3.PDF#view=FitH" ><iframe>
如果没有有效的
filename.pdf#view=FitH
,他们不太可能工作
因此,即使您的 pdf 查看器运行此代码片段,我也希望
#view=FitV
不起作用:
<iframe width="400" height="400" src="data:application/pdf;base64,JVBERi0xLjQKJcOIw4HDhMOXDQo4IDAgb2JqCjw8Ci9GaWx0ZXIgL0ZsYXRlRGVjb2RlIAovTGVuZ3RoIDEyMSAKPj4gc3RyZWFtCnicVYuxCsIwFEX3fsUZ06HxvdrktasgiJuQTdxMdYgUM+jvWxdBLtx77nB4In6M9tf1hn1JsXUnCwxh64NGOhPxqgM1M3Nq2CU2h1xeaE+aUWSN/vQo3mQiPc7unktZWrreRty7RcUtdf0aXLm2F9KxgX1qPvc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kb2JqCjMgMCBvYmoKPDwKPj4gZW5kb2JqCjkgMCBvYmoKPDwKL0Jhc2VGb250IC9IZWx2ZXRpY2EgCi9FbmNvZGluZyAvV2luQW5zaUVuY29kaW5nIAovU3VidHlwZSAvVHlwZTEgCi9UeXBlIC9Gb250IAovTmFtZSAvSGVsdiAKPj4gZW5kb2JqCjEwIDAgb2JqCjw8Ci9DcmVhdGlvbkRhdGUgKEQ6MjAwODA2MTExNjU2MDMpIAovTW9kRGF0ZSAoRDoyMDA4MDYxMTE2NTYwMykgCi9Qcm9kdWNlciAoSWJleCBQREYgQ3JlYXRvciA0LjMuNi40LzUwMjUgWy5ORVQgMi4wXSkgCj4+IGVuZG9iagp4cmVmCjAgMTEKMDAwMDAwMDAwMCA2NTUzNSBmIAowMDAwMDAwNjE2IDAwMDAwIG4gCjAwMDAwMDA1NTYgMDAwMDAgbiAKMDAwMDAwMzQyNCAwMDAwMCBuIAowMDAwMDAwNzA2IDAwMDAwIG4gCjAwMDAwMDA3NDEgMDAwMDAgbiAKMDAwMDAwMDIxNSAwMDAwMCBuIAowMDAwMDAwNDgwIDAwMDAwIG4gCjAwMDAwMDAwMjAgMDAwMDAgbiAKMDAwMDAwMzQ0NSAwMDAwMCBuIAowMDAwMDAzNTU5IDAwMDAwIG4gCnRyYWlsZXIKPDwKL1NpemUgMTEgCi9JbmZvIDEwIDAgUiAgCi9Sb290IDEgMCBSIAo+PgpzdGFydHhyZWYKMzY5OAolJUVPRgo="#view=FitV></iframe>
历史/已弃用(旨在嵌入 Adobe PDF/SWF 和相关数据浏览器插件。):
<object type="application/pdf" data="https://www.pdfpdf.com/samples/Sample3.PDF#view=FitH">PDF viewer failed<object>