我想将网页https://www.javatpoint.com/steps-to-create-first-hibernate-application打印到pdf文件中。
我正在使用带有各种参数的wkhtmltopdf
--javascript-delay
选项,有或没有
--no-stop-slow-script
。例如
wkhtmltopdf --javascript-delay 3000 https://www.javatpoint.com/steps-to-create-first-hibernate-application app.pdf
但似乎需要永远完成运行。我加
--debug-javascript
,输出信息为
Warning: :1 Unsafe JavaScript attempt to access frame with URL about:blank from frame with URL https://googleads.g.doubleclick.net/pagead/ads?client=ca-pub-4699858549023382&output=html&h=280&slotname=5592503653&adk=1365123429&adf=1932081468&w=336&lmt=1515359967&loeid=38893312&format=336x280&url=https%3A%2F%2Fwww.javatpoint.com%2Fsteps-to-create-first-hibernate-application&ea=0&flash=0&wgl=0&adsid=NT&dt=1515341967388&bpp=3&fdt=253&idt=262&shv=r20180102&cbv=r20170110&saldr=aa&prev_fmts=160x600%2C320x100%2C320x100&correlator=6433104240641&frm=20&ga_vid=1641940297.1515341967&ga_sid=1515341967&ga_hid=50326500&ga_fc=1&pv=1&icsg=2&nhd=1&dssz=2&mdo=0&mso=0&u_tz=-300&u_his=1&u_java=0&u_h=768&u_w=1366&u_ah=768&u_aw=1366&u_cd=32&u_nplug=0&u_nmime=0&adx=10&ady=4761&biw=0&bih=0&abxe=1&eid=38893302%2C21061122%2C191880502%2C41667001&oid=3&nmo=1&rx=0&eae=4&fc=16&brdim=0%2C0%2C0%2C0%2C1366%2C0%2C0%2C0%2C0%2C0&vis=0&rsz=%7C%7CeEbr%7C&abl=CS&ppjl=u&pfx=0&fu=1040&bc=1&ifi=4&dtd=283. Domains, protocols and ports must match.
Warning: :1 Unsafe JavaScript attempt to access frame with URL about:blank from frame with URL https://googleads.g.doubleclick.net/pagead/ads?client=ca-pub-4699858549023382&output=html&h=280&slotname=5592503653&adk=1365123429&adf=1932081468&w=336&lmt=1515359967&loeid=38893312&format=336x280&url=https%3A%2F%2Fwww.javatpoint.com%2Fsteps-to-create-first-hibernate-application&ea=0&flash=0&wgl=0&adsid=NT&dt=1515341967388&bpp=3&fdt=253&idt=262&shv=r20180102&cbv=r20170110&saldr=aa&prev_fmts=160x600%2C320x100%2C320x100&correlator=6433104240641&frm=20&ga_vid=1641940297.1515341967&ga_sid=1515341967&ga_hid=50326500&ga_fc=1&pv=1&icsg=2&nhd=1&dssz=2&mdo=0&mso=0&u_tz=-300&u_his=1&u_java=0&u_h=768&u_w=1366&u_ah=768&u_aw=1366&u_cd=32&u_nplug=0&u_nmime=0&adx=10&ady=4761&biw=0&bih=0&abxe=1&eid=38893302%2C21061122%2C191880502%2C41667001&oid=3&nmo=1&rx=0&eae=4&fc=16&brdim=0%2C0%2C0%2C0%2C1366%2C0%2C0%2C0%2C0%2C0&vis=0&rsz=%7C%7CeEbr%7C&abl=CS&ppjl=u&pfx=0&fu=1040&bc=1&ifi=4&dtd=283. Domains, protocols and ports must match.
Warning: :1 Unsafe JavaScript attempt to access frame with URL https://www.javatpoint.com/steps-to-create-first-hibernate-application from frame with URL https://googleads.g.doubleclick.net/pagead/ads?client=ca-pub-4699858549023382&output=html&h=280&slotname=5592503653&adk=1365123429&adf=1932081468&w=336&lmt=1515359967&loeid=38893312&format=336x280&url=https%3A%2F%2Fwww.javatpoint.com%2Fsteps-to-create-first-hibernate-application&ea=0&flash=0&wgl=0&adsid=NT&dt=1515341967388&bpp=3&fdt=253&idt=262&shv=r20180102&cbv=r20170110&saldr=aa&prev_fmts=160x600%2C320x100%2C320x100&correlator=6433104240641&frm=20&ga_vid=1641940297.1515341967&ga_sid=1515341967&ga_hid=50326500&ga_fc=1&pv=1&icsg=2&nhd=1&dssz=2&mdo=0&mso=0&u_tz=-300&u_his=1&u_java=0&u_h=768&u_w=1366&u_ah=768&u_aw=1366&u_cd=32&u_nplug=0&u_nmime=0&adx=10&ady=4761&biw=0&bih=0&abxe=1&eid=38893302%2C21061122%2C191880502%2C41667001&oid=3&nmo=1&rx=0&eae=4&fc=16&brdim=0%2C0%2C0%2C0%2C1366%2C0%2C0%2C0%2C0%2C0&vis=0&rsz=%7C%7CeEbr%7C&abl=CS&ppjl=u&pfx=0&fu=1040&bc=1&ifi=4&dtd=283. Domains, protocols and ports must match.
如果我没有任何延迟地跑,即
wkhtmltopdf https://www.javatpoint.com/steps-to-create-first-hibernate-application app.pdf
创建的pdf文件仅包含部分代码段。事件如果我在谷歌浏览器网页浏览器中下载完整的网页,然后使用wkhtmltopdf将其转换为pdf文件,我仍然遇到同样的问题。
我想知道是否有某种方法可以在没有上述问题的情况下将网页打印到pdf?
我使用Ubuntu 16.04作为我的操作系统。
感谢。