A simple bash script to print an svg to pdf without extra margins using headless chrome.
In the file printSvg2Pdf.sh
set the following variables:
chrome_executable
to point to the path of your chrome executable.template_file
to point to the path of the filetemplate.html
, included into the repository.
Then simply:
bash printSvg2Pdf.sh example_input.svg example_output.pdf
template.html
with an object tag where your image will be referenced in an object
tag. It has some css to remove all margins, and with javascript it sets the style attribute @page
to fit exactly the size of the image.
This comes from this inkscape forum question, and from this answer on StackOverflow.