我一直在尝试使用来自AbramAdams的wkhtmltopdf的CFC包装器而没有运气让它做任何事情。我认为这可能是一个路径问题,但不确定。我正在尝试给出的例子。
1, ken, 1
2, ken, 2
3, adam, 1
4, ken, 3
5, adam, 2
6, dan, 1
我在Windows上安装了wkhtmltopdf,我已将其添加到系统路径<cfscript>
wkhtmltopdf = new menueditortestsite.menueditor.com.wkhtml.pdf();
results = wkhtmltopdf.create(
url = 'https://wikidocs.adobe.com/wiki/display/coldfusionen/Home', // uncomment to test with url
options = {
"viewport-size":"1200x1080" // default
,"image-quality":100
,"margin-bottom": 25
,"margin-left": "5mm"
,"margin-right": "5mm"
,"margin-top": 45
,"orientation": "portrait" //default
,"encoding": "utf-8"
,"header-html": "http://www.sydneytripslipfallcompensation.com/images/header.jpg"
,"footer-html": "<footer style='text-align:center;'>This, my friend, is a cool footer.</footer>"
},
writeToFile = false, // true will write the file and return a struct containing the path (and other info)
destination = "#expandPath('.')#\pdf\test.pdf"
);
// if you set writeToFile to true, uncomment the below and comment out the cfheader/cfcontent block below
/*
writeDump(results);
text = wkhtmltopdf.getText( results.file );
pagedText = wkhtmltopdf.getText( results.file );
writeDump({
"text":text,
"pagedText":pagedText
});*/
</cfscript>
<cfheader name="Content-Disposition" value="inline; filename=test.pdf">
<cfcontent type="application/pdf" file="#expandPath('.')#test.pdf">
。
我测试了wkhtmltopdf以确保它正在成功但使用CFC包装器没有任何反应。
我试过以下但没有成功。有人可以帮我弄清楚它是否是我的路径代码或开发人员代码的其他错误?
C:\Program Files\wkhtmltopdf\bin\
这是我运行的代码,没有报告任何错误。
wkhtmltopdf = new menueditortestsite.menueditor.com.wkhtml.pdf();
wkhtmltopdf = new menueditortestsite.menueditor.com.wkhtml.pdf('C:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe');
wkhtmltopdf = new menueditortestsite.menueditor.com.wkhtml.pdf('/usr/local/bin/wkhtmltopdf');
wkhtmltopdf = new menueditortestsite.menueditor.com.wkhtml.pdf(expandPath('../com/wkhtml/bin/wkhtmltopdf.exe'));