Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/google-chrome/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google chrome 使用chrome无头选项打印到pdf的其他选项_Google Chrome_Command Line_Command - Fatal编程技术网

Google chrome 使用chrome无头选项打印到pdf的其他选项

Google chrome 使用chrome无头选项打印到pdf的其他选项,google-chrome,command-line,command,Google Chrome,Command Line,Command,我正在使用Windows中的命令行,使用Google Chrome和无头选项打印PDF。我想知道如何使用其他可用选项,如页边距和页面大小,甚至方向。我注意到这些选项在 但基于这个问题,它似乎不起作用 当下面的代码生成pdf但忽略页面大小时,是否有人使用了可用的选项,正确的选择是什么 chrome.exe --headless --disable-gpu --print-to-pdf=C:\\Spotfire_Export\\'+filename+'.pdf --paperWidth=15 '+t

我正在使用Windows中的命令行,使用Google Chrome和无头选项打印PDF。我想知道如何使用其他可用选项,如页边距和页面大小,甚至方向。我注意到这些选项在

但基于这个问题,它似乎不起作用

当下面的代码生成pdf但忽略页面大小时,是否有人使用了可用的选项,正确的选择是什么

chrome.exe --headless --disable-gpu --print-to-pdf=C:\\Spotfire_Export\\'+filename+'.pdf --paperWidth=15 '+tempFolder+filename+'.html

我也有同样的问题,并发现相同的链接之前提到

我正在使用PHP生成页面,并通过
exec
运行google chrome

然后我找到并试了我的案子,效果很好

下面是我在CSS中添加的代码

@page {
    size: A4 landscape;
    margin: 0;
}

我希望这对某人有所帮助。

我目前遇到了同样的问题。Chrome headless似乎只支持在纵向模式下对网页进行PDF转换,并且没有任何命令行选项来指定纸张大小、格式或方向。