Skip to content

A simple bash script to print an svg to pdf without extra margins using headless chrome.

License

Notifications You must be signed in to change notification settings

manulera/printSvg2Pdf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PrintSvg2Pdf

A simple bash script to print an svg to pdf without extra margins using headless chrome.

How to use

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 file template.html, included into the repository.

Then simply:

bash printSvg2Pdf.sh example_input.svg example_output.pdf

What it does

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.

Acknowledgements

This comes from this inkscape forum question, and from this answer on StackOverflow.

About

A simple bash script to print an svg to pdf without extra margins using headless chrome.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published