2012-10-01 119 views
2

我可是從PHP調用wkhtmltopdf這樣的: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文件的加載失敗......我可以以某種方式解決這個問題?

+0

你能呼應出完整的解析的命令字符串?這是一個有點難以破譯:) – Nenotlep

+0

我不知道該怎麼做,輸出看起來總是一樣的...但我格式化了我原來的問題,所以現在更容易閱讀:) –

+0

謝謝。我測試了這個命令,它在Windows上使用wkhtmltopdf 0.11 rc2對我來說工作得很好,所以如果你使用的是相同的版本(我沒有在linux上測試過,但我會認爲它是這樣的)在那裏工作)。所以最可能的問題是輸入HTML,輸入CSS或輸出權限,例如,如果您無法寫入目標文件夾。對不起,我不能幫助更多,別人可能會幫助! – Nenotlep

回答

4

基於評論,我建議圍繞給定的--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 
+0

謝謝!它的工作原理...這麼簡單的事情:)但我無法親眼看到它:) –

+0

發生了很多!我第一次沒有看到它,我有時甚至開始向朋友或任何其他人解釋問題,因爲我試圖解釋我發現問題> :)很高興你把它解決了! – Nenotlep