小编Jor*_*gal的帖子

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

我正在 Windows 中使用命令行,使用 Google Chrome 和无头选项“打印到 PDF”来打印 PDF。我想知道如何使用其他可用选项作为边距和页面大小甚至方向。我注意到https://chromedevtools.github.io/devtools-protocol/tot/Page#method-printToPDF中提供了这些选项

但基于这个问题,它似乎不起作用https://superuser.com/questions/1281309/how-can-i-print-a-webpage-in-landscape-mode-using-headless-chromium-on-the-逗号

有人使用任何可用的选项吗?正确的sintaxis是什么,因为下面的代码生成pdf但忽略页面大小?

chrome.exe --headless --disable-gpu --print-to-pdf=C:\\Spotfire_Export\\'+filename+'.pdf --paperWidth=15 '+tempFolder+filename+'.html
Run Code Online (Sandbox Code Playgroud)

command-line command google-chrome

3
推荐指数
1
解决办法
5005
查看次数

标签 统计

command ×1

command-line ×1

google-chrome ×1