Parameters WKHTMLTOPDF-不允许使用多个参数?

Parameters WKHTMLTOPDF-不允许使用多个参数?,parameters,wkhtmltopdf,Parameters,Wkhtmltopdf,我从PHP调用wkhtmltopdf的方式如下: `$commandString = ' "../wkhtmltopdf/wkhtmltopdf-amd64" --header-html '. $_SESSION['ER_HlavniLink'] .'/export_pdf/header31.php?IDstavba='.$IDstavba.' --header-spacing 0 --footer-line --footer-spacing 5 --footer-left

我从PHP调用wkhtmltopdf的方式如下:

`$commandString = '

"../wkhtmltopdf/wkhtmltopdf-amd64" 

--header-html '. $_SESSION['ER_HlavniLink'] .'/export_pdf/header31.php?IDstavba='.$IDstavba.' 

--header-spacing 0 

--footer-line 

--footer-spacing 5 

--footer-left "Vygenerováno pomocí webové aplikace www.estiroad.cz" 

--footer-center "[page] / [toPage]" 

--orientation Landscape 

--user-style-sheet "../css/export.css" 

--print-media-type 

--page-size A4 

--encoding utf-8

--margin-top 50mm

--margin-bottom 15mm

--margin-left 10mm 

--margin-right 10mm 

'.$_SESSION['ER_HlavniLink'].'/'.$export.' '.$nazev_sestavy;`

如果我想在头文件调用中添加参数,浏览器会显示错误:加载PDF文档失败。。。我能解决这个问题吗?

根据评论,我建议在给定的--header html值周围添加双引号。我在第一轮测试中没有注意到这一点,所以多亏了你的问题,这可能会有所帮助:

此命令可用于:

wkhtmltopdf.exe --header-html "https://www.google.fi/search?hl=fi&site=&source=hp&q=test&oq=test&gs_l=hp.12..0l10.2413.2773.0.4395.4.4.0.0.0.0.80.232.4.4.0...0.0...1c.1.k_PQAqelc9w" --header-spacing 0 --footer-line --footer-spacing 5 --footer-left "Vygenerováno pomocí webové aplikace www.estiroad.cz" --footer-center "[page] / [toPage]" --orientation Landscape --user-style-sheet test.css --print-media-type --page-size A4 --encoding utf-8 --margin-top 50mm --margin-bottom 15mm --margin-left 10mm --margin-right 10mm http://www.google.com/ g2.pdf && g2.pdf
这不会(注意,在给--header html的地址周围没有引号)

wkhtmltopdf.exe --header-html https://www.google.fi/search?hl=fi&site=&source=hp&q=test&oq=test&gs_l=hp.12..0l10.2413.2773.0.4395.4.4.0.0.0.0.80.232.4.4.0...0.0...1c.1.k_PQAqelc9w --header-spacing 0 --footer-line --footer-spacing 5 --footer-left "Vygenerováno pomocí webové aplikace www.estiroad.cz" --footer-center "[page] / [toPage]" --orientation Landscape --user-style-sheet test.css --print-media-type --page-size A4 --encoding utf-8 --margin-top 50mm --margin-bottom 15mm --margin-left 10mm --margin-right 10mm http://www.google.com/ g2.pdf && g2.pdf

你能回显完整的解析命令字符串吗?这有点难破译:)我不知道怎么做,输出看起来总是一样的……但是我把我原来的问题格式化了,所以现在更容易阅读:)谢谢。我测试了该命令,它在Windows上使用wkhtmltopdf 0.11 rc2运行良好,因此如果您使用的是同一版本,我认为问题不在于参数(我没有在linux上测试它,但我认为它也可以在那里运行)。因此,最可能的问题是输入HTML、输入CSS或输出权限,例如,如果无法写入目标文件夹。对不起,我帮不上更多的忙,也许有人能帮上忙!您是否尝试在IDstavba后面添加一些参数?因为该命令在当前状态下也适用于我。谢谢!它是有效的。。。这么简单的事情:)但我自己却看不见:)这经常发生!第一次看的时候我没注意到,有时我甚至开始向朋友或其他人解释一个问题,当我试图解释时,我发现这个问题>:)很高兴你把它修好了!