Convert the SVG files generated by PcbDraw to PDF files.
This tool addresses the challenge of exporting PDF files from PcbDraw, particularly related to the SVG mask property that Inkscape does not convert properly. It processes the SVG file generated by PcbDraw and produces another SVG file without the masks. The masks are exported as additional groups, allowing for their application in other software, such as Adobe Illustrator.
PcbDrawToPdf is a stand-alone CLI tool. PcbDrawToPdf is tested with Inkscape 1.3.2 and PcbDraw v1.1.2.
PcbDrawToPdf is distributed as a Python package. You just have to follow the installation instructions from PcbDraw and then install PcbDrawToPdf via Pip:
pip install PcbDrawToPdf # Use pip or pip3 based on your distribution
Now you can test that it works:
pcbdrawtopdf --help
You should get a help menu.
The input for PcbDrawToPdf is the SVG file generated by PcbDraw. This tool provides two main commands:
convert-masks
: This command generates a new SVG file by removing the mask effects and adding the masks as additional groups within theboardContainer
group. These masks must be applied in Adobe Illustrator from the lowest hierarchy level to the highest. The groups that need masking are renamed with_<mask-name>
, where<mask-name>
corresponds to the name of the group containing the mask.extract-masks
: This command generates the masks in separate files, which is useful for debugging purposes.
PcbDraw generates three masks: hole-mask
, pads-mask-silkscreen
, and pads-mask
. The masks should be applied in the following order:
pads-mask-silkscreen
pads-mask
hole-mask
This order is important because hole-mask
applies to a group at a higher hierarchy level in the SVG file.
For more information about applying opacity masks in Adobe Illustrator, please refer to this video.
pcbdrawtopdf convert-masks ArduinoLearningKitStarter.svg ArduinoLearningKitStarter_export.svg
pcbdrawtopdf extract-masks ArduinoLearningKitStarter.svg export_folder
I have experienced some problems when PcbDraw exports the back side of the PCB. One of the solutions I found is to load the SVG from PcbDraw in Inkspace, select all the text objects and convert them to glyphs. To do so, follow these steps in Inkscape:
- Select any text object in your drawing.
- Then
Edit > Select Same > Object Type
. - Afterwards
Text > Text to Glyphs
. - Finally save the file
File > Save
.
Use this new SVG file with PcbDrawToPdf.