[英]Print Portion of the Browser Window to PDF and Send To Server to be Faxed
Like the title says, I have a requirement to print a part of the browser window to PDF and then send it to the server so that it can be faxed. 就像标题中所说的,我需要将浏览器窗口的一部分打印为PDF,然后将其发送到服务器,以便可以进行传真。 I have already found a faxing service so the real problem is in figuring out how to generate the pdf to begin with. 我已经找到了传真服务,所以真正的问题在于弄清楚如何生成pdf文件。 I have come up with several options to do this, however all of them come with significant downsides. 我想出了几种方法可以做到这一点,但是所有这些方法都有很大的缺点。 They are: 他们是:
window.print()
on a button click along with print media queries and have the user download the resulting PDF and re-upload it to be faxed. 在单击按钮时使用window.print()
以及打印介质查询,并让用户下载生成的PDF并重新上传以进行传真。 The problem with this is that it is a multi-step process and my users would prefer to just click a single button 问题是这是一个多步骤的过程,我的用户希望只单击一个按钮 I would appreciate any suggestions not listed above as well as any advice on how to eliminate the cons posed by these options. 我会很感激上面未列出的任何建议,以及关于如何消除这些选项带来的弊端的任何建议。 Thanks in advance! 提前致谢!
Looks like using jspdf
to render the PDF along with a library such as html2canvas
to convert the printable region into an image to preserve styles will get the job done. 看起来像使用jspdf
渲染PDF以及html2canvas
的库将可打印区域转换为图像以保留样式一样,可以完成工作。 It has taken some work to configure everything properly (and I'm not through yet) but I am confident this solution will be effective. 正确配置所有内容已花费了一些工作(并且我还没有完成),但是我相信该解决方案将是有效的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.