Board2Pdf v1.1 released in PCM

Board2Pdf is a KiCad Action Plugin to create good looking pdf files from the board. The outputted pdf is vector based and searchable.

Version 1.1 now released! This version is now available in the Plugin and Content Manager.

In order to increase the speed (with about 10x) Board2Pdf now requires PyMuPDF as a dependency. It’s recommended to install pdfCropMargins which includes PyMuPDF as well as some other useful pdf tools. You can install it with this command:

python -m pip install --upgrade pdfCropMargins

The command must be run from the KiCad Command Prompt. Not from your default terminal or from the Scripting Console within the PCB Editor.

More details can be found in the Wiki - Install dependencies.

Major improvements since v0.7

  • Speed is now increased with about x10 (thanks EvilOfLife!)
  • KiCad v7.0 now supported
  • Possible to create SVG files as well (thanks EvilOfLife!)
  • Copy/Clone template function (thanks Markus K!)
  • Button icons for better visual navigation (thanks Markus K!)
  • Double-click to enable/disable templates and layers (thanks Markus K!)
  • Config (settings) stored as local project file (thanks Markus K!)
  • Checkbox to select if the single page files should be deleted
  • New template examples (thanks Markus K!)

More information can be found in the Gitlab repo:
https://gitlab.com/dennevi/Board2Pdf/

4 Likes

command prompt kicad 7 ?

Yes, it must be executed from the KiCad X.X Command Prompt.

More details can be found in the Wiki - Install dependencies.

1 Like

how you can do-it from ARM MacOS (KiCad V7.01)? I get this error… do I miss something?


Hi albin,

how it is under Linux? there is no KiCad cli implemented?
If i install Board2Pdf vis PCM an start KiCad PCB KiCad dissapears…

Tom

@AB007 You’re running the install command from the scripting console within Pcbnew. You must run the command from the KiCad 7.0 Command Prompt.

See: Install dependencies · Wiki · Albin Dennevi / Board2Pdf · GitLab

I don’t know how to open the KiCad 7.0 Command Prompt in ARM MacOS. On Windows there’s a shortcut to it in the Start Menu where the shortcuts to KiCad, PCB Editor, Schematic Editor and such are. I’m guessing there should be a similar collection of shortcuts somewhere on your system?

I have no idea unfortunately. What Linux distribution are you running? Is there a place somewhere where the installer placed shortcuts to KiCad, PCB Editor, Schematic Editor etc.? I was hoping that there would also be a shortcut to KiCad 7.0 Command Prompt in the same place.

On windows the KiCad 7.0 Command Prompt shortcut goes to “C:\Program Files\KiCad\7.0\bin\kicad-cmd.bat”. Maybe there’s a kicad-cmd.sh in your installation folder?

On linux there is no need for kicad command prompt because it uses system utils (unless you use flatpak install in which case it’s complicated). So just run the pip install command from your system terminal. Add --user to the end of it to avoid installing in system dirs and needing root.

On mac I think situation is the same, KiCad switched to using system python. Hopefully mac users can confirm.

1 Like

Thanks @qu1ck! That’s really good to know.

@tTom and @AB007 Please confirm if it works when you run the command from your system terminal.

Hi @albin, this is probably a KDE related problem (I use KUBUNTU 20.04). Actually pcbnew generates a “segmentation fault” when pugin Board2Pdf v1.1 is installed. While in XFCE (Linux Mint Xfce) this problem does not exist and the plugin works correctly.
In my opinion the problem is not related to the presence or absence of PyMuPDF.
I am using KiCad v7:

Application: KiCad x86_64 on x86_64

Version: 7.0.1-3b83917a11~171~ubuntu20.04.1, release build

Libraries:
wxWidgets 3.2.1
FreeType 2.10.1
HarfBuzz 6.0.0
FontConfig 2.13.1
libcurl/7.68.0 OpenSSL/1.1.1f zlib/1.2.11 brotli/1.0.7 libidn2/2.2.0 libpsl/0.21.0 (+libidn2/2.2.0) libssh/0.9.3/openssl/zlib nghttp2/1.40.0 librtmp/2.3

Platform: Ubuntu 20.04.5 LTS, 64 bit, Little endian, wxGTK, KDE, x11

Build Info:
Date: Mar 11 2023 17:00:22
wxWidgets: 3.2.1 (wchar_t,wx containers) GTK+ 3.24
Boost: 1.71.0
OCC: 7.5.2
Curl: 7.87.0
ngspice: 38
Compiler: GCC 9.4.0 with C++ ABI 1013

Build settings:
KICAD_SPICE=ON

Translated with DeepL Translate: The world's most accurate translator (free version)

Hi @ciondo61,
That’s not good… Do you know while row in Board2Pdf causes the segmentation fault?

@albin unfortunately, I was unable to trace the cause of the malfunction. I can only say that I have 2 PCs with Kubuntu and on both of them the problem exists, while in the third PC with Mint Xfce the problem does not exist. That is why I think the problem arises from KDE (Plasma), but I could very well be wrong.
The effect is that launching PCBNEW with the Board2Pdf v1.1 plugin installed KiCad suddenly closes due to a segmentation fault. I will do some more testing but I don’t think I can solve it.

Thanks for testing! Unfortunately I don’t have any machine with KDE so I’m not able to help here…

Is it only Board2Pdf that causes this, or does other plugins installed using PCM also cause a segmentation fault?

All other installed plugins do not generate this problem (I have several installed). I also tried to install Board2Pdf v1.1 manually without making use of PCM but the situation is the same, a “segmentation fault” is generated.
I think @tTom when he says “If i install Board2Pdf vis PCM an start KiCad PCB KiCad dissapears…” he has exactly the same problem I am experiencing.
@tTom are you using KDE plasma?

Launch kicad from terminal and see if any errors are printed when kicad crashes.
You can also run it under debugger by launching it from terminal with gdb kicad and then type in run. When it crashes it will print some useful stuff.

I’ve try to do-it from MAC terminal and get this:

Last login: Sun Mar 12 16:40:56 on ttys000

andreibucsa@Andreis-MacBook-Pro ~ % python -m pip3 install --upgrade pdfCropMargins

zsh: command not found: python

andreibucsa@Andreis-MacBook-Pro ~ % pip3 install --upgrade pdfCropMargins

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

andreibucsa@Andreis-MacBook-Pro ~ % pip install --upgrade pdfCropMargins

zsh: command not found: pip

andreibucsa@Andreis-MacBook-Pro ~ % pip3

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

andreibucsa@Andreis-MacBook-Pro ~ %

Do this first
xcode-select --install

I’ve install Xcode then install pdfCropMargins with pip3 install --upgrade pdfCropMargins (from MAC terminal) but get now the following error:

colorize_pdf failed

On input file Radar Base Board V2-F_Cu.pdf in /Users/andreibucsa/Documents/KiCAD V7 projects/Radar Base Board V2/plots/temp

Traceback (most recent call last):

File “/Users/andreibucsa/Documents/KiCad/7.0/3rdparty/plugins/com_gitlab_dennevi_Board2Pdf/plot.py”, line 40, in colorize_pdf

doc.save(os.path.join(folder, outputFile), clean=True)

File “/Users/andreibucsa/Library/Python/3.9/lib/python/site-packages/fitz/fitz.py”, line 4550, in save

return _fitz.Document_save(self, filename, garbage, clean, deflate, deflate_images, deflate_fonts, incremental, ascii, expand, linear, no_new_id, appearance, pretty, encryption, permissions, owner_pw, user_pw)

RuntimeError: invalid key in dict

Now you’ve got the same error as reported earlier today.

I don’t know why you’re getting “RuntimeError: invalid key in dict”. It works fine for me, but apparently something has changed in v7.0.1 which results in some people getting this error. In the issue linked above, René gets this error on Version: 7.0.1, release build on Windows 10. He also uses the latest version of Board2Pdf and the latest version of PyMuPDF (1.21.1).

I don’t understand why it works for me, but not for you…

I’ll test on some other machines as well to see if I manage to get this error.

i’m using `Linux Mint 21.1 Cinnamon and Kicad 7.0.1
Application: KiCad x86_64 on x86_64

Version: 7.0.1-3b83917a11~171~ubuntu22.04.1, release build

Libraries:
wxWidgets 3.2.1
FreeType 2.11.1
HarfBuzz 6.0.0
FontConfig 2.13.1
libcurl/7.81.0 OpenSSL/3.0.2 zlib/1.2.11 brotli/1.0.9 zstd/1.4.8 libidn2/2.3.2 libpsl/0.21.0 (+libidn2/2.3.2) libssh/0.9.6/openssl/zlib nghttp2/1.43.0 librtmp/2.3 OpenLDAP/2.5.13

Platform: Linux Mint 21.1, 64 bit, Little endian, wxGTK, cinnamon, x11

Build Info:
Date: Mar 11 2023 17:01:09
wxWidgets: 3.2.1 (wchar_t,wx containers) GTK+ 3.24
Boost: 1.74.0
OCC: 7.5.2
Curl: 7.87.0
ngspice: 38
Compiler: GCC 11.3.0 with C++ ABI 1016

Build settings:
KICAD_SPICE=ON

I tried several ways to install pdfCropMargins. On the system terminal it seems to work, it was not installed as python system but on the KiCad user path were all other Plugins are. Also on the User-Python path. Once this seems to be successful with:
pip install PyMuPDF
then Kicad completely disappeared after starting PCBNEW.

So i think it is a problem with Cinnamon, as ciondo61 wrote.

KiCad 6 i tested for the first time and used Board2Pdf manually installed, really awsome tool for documentation. Many thanks dear albin. It took time to switch from windows to linux, and there is still a lot to learn for me. This year i started using Kicad and made several little boards.
Hope there is a way to get your wonderful plugin to work.

If i start KiCad at the terminal with installed Board2Pdf and starting PCBNEW:
grafik