Skip to content

Quick and dirty script to pull vector graphics from a PDF and export to DXF drawing files.

Notifications You must be signed in to change notification settings

mjecke/pyPDFtoDXF

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 

Repository files navigation

pyPDFtoDXF

Quick and dirty script to pull vector graphics from a PDF and export to DXF drawing files.

System Requirements:

inkscape pdf2svg

!!!! Requires 'inkscape' and 'pdf2svg' to be in system path !!!!

Python Requirements:

pip install PyPDF2

Script is just gluing together pdf2svg to make a svg, and then inkscape processes the svg to a dxf. Saves the svg in output folder along with dxf. Note that this can be slow if your PDF has many, many pages to go thru as the inscape process has to be called once-per-page. Better to extract just a single page or range of pages instead if that is all you need (see input args).

Also this method has trouble with converting certain types of text in PDFs into DXF.
It works mainly for polys and other vectors, e.g. drawings that were originally CAD or SVG and saved into PDF.

Example Usage:

python pdftodxf.py input.pdf output

%% takes all pages of file named input.pdf and saves svgs and dxfs into folder named output

python PDFtoDXF.py input.pdf output -p 3,4

%% takes just pages 3 and 4 of input.pdf and saves svgs and dxfs into folder named output

About

Quick and dirty script to pull vector graphics from a PDF and export to DXF drawing files.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages