WKHTMLTOPDF和Coldfusion [英] WKHTMLTOPDF and Coldfusion

查看:74
本文介绍了WKHTMLTOPDF和Coldfusion的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在WKHTMLTOPDF插件中使用Coldfusion URL变量?我尝试如下,但只收到空白的PDF。我假设它由于URL变量而失败。

Is it possible to use coldfusion URL variables with WKHTMLTOPDF plugin? I am trying it as follows but only receiving a blank PDF. I'm assuming it's failing because of the URL variables.

 <cfexecute name="C:\Program Files (x86)\wkhtmltopdf\bin\wkhtmltopdf.exe" 
    arguments="c:\inetpub\wwwroot\serviceticket\reports\dropoff_receipt.cfm?ticket_id=#url.ticketID#&signature_id=#check_signature.id# C:\google.pdf"
    timeout="10" /> 

更新1:

将源更改为URL,但同样发生错误。

Changed the source to a URL, same error though.

    <cfexecute name="C:\Program Files (x86)\wkhtmltopdf\bin\wkhtmltopdf.exe" 
    arguments="'../../serviceticket/reports/dropoff_receipt.cfm?ticket_id=#url.ticketID#&signature_id=#check_signature.id# C:\google.pdf"
    timeout="10" /> 

更新2:

添加完整URL后,这是现在制作的PDF的屏幕截图。显然不是空白,但错误消息中URL的路径与我指定的URL有所不同。??

After adding the full URL, here is a screenshot of the PDF that is now made. It's obviously not blank but the path of the URL in the error message is way different than the URL I am specifying.??


-Brian

-Brian

推荐答案

我为WKHTMLTOPDF编写了CF9 +包装器。它会生成命令行参数,并以正确的顺序放置它们。您还可以提供单独的标题,正文&页脚URL。

I wrote a CF9+ wrapper for WKHTMLTOPDF. It generates the command line arguments and puts them in the correct order. You can also provide separate header, body & footer URLs.

http://gamesover2600.tumblr.com/post/125851537339/generating-pdfs-using-coldfusion-wkhtmltopdf

我建议保存ColdFusion-生成的HTML作为实际Web服务器的临时静态文件。这样一来,WKHTMLTOPDF不必处理任何与CF相关的会话/安全障碍,并且可以正确确定所有相关的MIME类型(如果使用 file:// 参数。)您可以在生成PDF后删除临时文件,也可以将其保存以供以后查看/重新生成。

I recommend saving ColdFusion-generated HTML as a temporary static file to an actual webserver. This is so that WKHTMLTOPDF doesn't have to deal w/any CF-related session/security obstacles and can correctly determine all related MIME types (something you can't do if you use file:// parameters.) You can delete the temp files after PDF generation or save them for later review/regeneration.

对于分页符,请使用CSS page-break-inside page-break-after page-break-before

For page breaks, use CSS page-break-inside, page-break-after and page-break-before.

<CF_WKHTMLTOPDF
  AddDefaultHeader = "0"
  PageURL = "http://#CGI.Server_Name#/test_page.htm"
  filename = "c:\test_page.pdf"
  orientation = "portrait"
  DisableSmartShrinking="yes"
  dpi="96"
  PageSize="letter"
  margintop = "0"
  marginleft = "0"
  marginright = "0"
  marginbottom = "0">

<CFDUMP VAR="#WKHMLTOPDF_Result#">

这篇关于WKHTMLTOPDF和Coldfusion的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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