Board2Pdf - Export a customized pdf of the board

This is really cool!!!
I can’t wait to see this plugin developed further.
One thing that would be great to add is to scale the image to a specific paper format and center the image on the paper.
Thank you for you work!

1 Like

I love the enthusiasm!
I will play around with scaling when I find the time. But centring and changing the size of the “paper” (or cropping) is a hole other thing, that’s not that easy. In particular it’s hard if the user wants the frame+title block to be plotted (which I personally want).

Scaling has been requested by 3-4 people now. Personally I don’t see why though. I can understand why you want the pcb to be bigger on the pdf page, but why wouldn’t you want that on the page in pcbnew as well? Personally I want the pdf and the pcbnew view to be the same, and it’s easy to customize the view in pcbnew by selecting a different size under File -> Page Settings -> Paper -> Size. What downsides do you see with doing this? And I don’t mean just doing it before plotting the pdf file, but actually using a smaller page size in pcbnew when small pcb’s are designed.

I got a question elsewhere regarding adding more custom templates. This is how you add a new template:

  1. Press New and give it a name.
  2. Select the new template in the Enabled Templates list.
  3. Select a layer in the Disabled Layers list.
  4. Press the Enable button to the right of the Disabled Layers list.
  5. Select the layer in the Enabled Layers list.
  6. If you want, pick a new color of the layer using the Pick Color button. Repeat step 3-6 for as many layers as you want.
  7. Press the Save current settings button.

If you think that you’ve created a killer template that everyone wants, you can copy the changes of config.ini to default_config.ini, push default_config.ini to a fork of the repo and issue a merge request to the official repo.

default_config.ini is only used if config.ini doesn’t exist. It’s then copied to config.ini before config.ini is read. This means that one way to reset to default settings is by simply deleting the config.ini file.

The answer is more philosophical than practical, so we should start with “Why do we need assembly files?”
For me they serve several purposes:

  1. Use for hand assembly of 1–2 prototypes.
  2. Send to China when/if ordering PCBA for prototyping.
  3. Send to final PCBA house for reference during PnP programming.
  4. Documentation for HW testing and for SW guys.

For 1. I actually print out 1 or 2 sheets of A4 or A3 to have on the table. I did try having a monitor, an iPad and it’s great, it’s just way more efficient with paper.
2, 3 and 4 are getting into a PDF with the rest of the things and having a unified sheet size is just nice. I was taught that technical documentation should follow standards(I suppose that’s why you like having title block for the assembly drawing). Most of the technical documentation has been historically printed on A4 size paper, unless special cases :slight_smile: I do have schematic sheets that are A3 and they go into the pdf in a3. Sure, it’s ok to have like A5 sized assembly sheet, it’s just strange.
Also, some PCBs are really small and printing them in 1:1 on paper is really inconvenient and hard to read. Even in pdf.
Imagine reading this if it was in original size(full PCB is 30x25 mm).

I see! Or at least I think so. So its not that you want the pcbnew page to be in a different size than the assembly pdf, but rather that you want the pdf to be in A4 regardless of the size of the pcb. I can relate to that. I’m only using A4 and A3 sizes myself.

The difference is that I’m only using the pdf assembly file for 3 and 4. For 1 I’m using the Interactive Html Bom which I think is awesome! And for 2 I haven’t really had the need for either one. In case of 2 I’m using JLCPCB and gerber + pos file + bom has been sufficient so far.

Printing the pdf to paper rarly crosses my mind. Although printing an A5 pdf to an A4 paper is probably fine and should give a decent result. Personally a pdf with high resolution (vector based) so that I can zoom in closely is all that I need.

Thanks for sharing your thoughts! I’ll give the option for scaling some more thought.

Version v0.5 (latest version) is now available in the KiCad PCM for easier installation. I strongly encourage everyone using the plugin to update to this version. It includes bugfixes and much improved error handling.

what’s the syntax rules has used in config? would u like 2 prompt me the link?

how can i divide the string “setting” in config file? (i had tryout the LF+ CR,but it make the file not operational )

i had supposed , that it’s would be excessive, because the pdf option in a main PCBNEW program has a scaling feature itself?
so may be need not overload ur program and waste the time .

The config.ini file is parsed by a Python library called ConfigParser. The content of the settings string in the config is pure JSON.

I just tested standard Windows newline (in Notepad) and that works fine. Although, you must have at least one blank space on each new row.

Here’s a config.ini file for you, with newlines in the JSON code:
config.ini (1.4 KB)

Why do you need this? What are you trying to achieve?

Yes, my plan is to play with the pcbnew.PCB_PLOT_PARAMS.SetScale() function when I have some time. Although as discussed above I don’t have any need for scaling myself, and most people could probably work around the inability to scale by changing the size of the paper. See post 22.

1 Like

thanx, is operational now, the error was i didn’t added space at the start of line. but after your sample i can divide it by the notepad++ manually now.

the problem is that i didn’t find, how to add old template copy for the slightly changing the layer set, in gui panel and i can do it by myself direct across manually config file editing.

just i had added the

because i had saw it in your link above as comments and see that it gives me the error. does it possible insert comment to config and which is the prefix for such a case?

i mean, that it’s time wasting, because everybody can themselves to scale pdf when printing w/o special features. your plugin is fair enough.

Adding a “Duplicate” button next to the “New” button is probably a good idea, so that the user can create a copy of a current template instead of starting from scratch. I’ll keep this in mind.

It’s not possible to add comments in the JSON code. That’s not supported by JSON.
You should be able to add comments in the ini file outside of the JSON code though. See “Supported INI File Structure” https://docs.python.org/3/library/configparser.html

no need gui improving, all actions probably can made in config editing.

just i find, that editing not influenced to the new template settings. After the duplication, the text existed, but the new template name becomes concluded in parenthesis, and the enabled layers set is becomes empty, while in prototype it’s not empty.

Sounds like you made some mistake when editing the file. Upload it here i lf you want me to take a look.

and one more thing - while i had un installed the previous version then installed the new one, the program shows that version is 0.4.
2021-12-22 16_14_47-Board2Pdf v0.4
while plugin manager shows that it’s 0.5

does it mean, that plugin manager don’t know about the new version (v.05)?

and while installing , it says, that had installing the version 0.52021-12-22 16_20_26-Applying Package Changes

config.ini (1.4 KB)

and i find, that all formatting i had made manually, was improved while closing the fille, and additional spaces, LF+CR manually added, was remowed and after opened the next time it becomes the same whole string, as before.

and also, after new version installing, the old config was removed, so if it has your own edited config, it need previously keep in security place.

v0.4 has never been uploaded to KiCad Plugin and Content Manager. If KiCad finds that version, you must have it installed manually somewhere. Remove all versions and install v0.5 from KiCad PCM.

Yes, if you press the “Save current settings” in the plugin, the config.ini file will be written by the plugin and your manual formatting will disappear.

I don’t understand the problem. I see nothing wrong with the config.ini file. If you create a new template it will have no enabled layers until you enable them. Just enable some layers and select colors for them. See “This is how you add a new template” in the Wiki. https://gitlab.com/dennevi/Board2Pdf/-/wikis/home

I added this wiki today and just pasted information from this thread so that it’s easier to find.

1 Like

if i duplicate text of old templates and insert it into config, the enable layers section has include few layers, but the plugin doesn’t show, that this layers are enabled. so, may be it has keep some old information in other place?

yes, and the section enabled layers in template blackandwhitetop2 concluded few layers (same as in prototype layer) but in screenshot these layers not enabled

I think it’s better if you use the gui instead of editing the config file manually.

No, there is no old information elsewhere. All settings are read from config.ini. But it’s not made for manual editing so it’s easy to make a mistake and not that intuitive to understand.

1 Like

the problem is while editing config while KIKAD has opened. So, it dont’ sucks any changes on the fly.
but if u make changes while it’s closed, then u can open it with the new duplicates templates and appropriate layers are enabled.
So, if you make manual changes, need keep the copy of the formatted version in a security place, for next time use, or don’t press save changes if you suppose to edit manually next time. this point may be useful for creating new templates by the duplication method, if u need some few templates slightly difference sets.


this time manual editing was successful

I have issue when generating the pdf.
issue

I don’t have a gitlab account. Therefor I post the issue in this forum.

Application: KiCad PCB Editor (64-bit)

Version: (6.0.1), release build

Libraries:
wxWidgets 3.1.5
libcurl/7.78.0-DEV Schannel zlib/1.2.11

Platform: Windows 10 (build 19044), 64-bit edition, 64 bit, Little endian, wxMSW

Build Info:
Date: Jan 15 2022 13:36:27
wxWidgets: 3.1.5 (wchar_t,wx containers)
Boost: 1.76.0
OCC: 7.5.0
Curl: 7.78.0-DEV
ngspice: 35
Compiler: Visual C++ 1929 without C++ ABI

Build settings:
KICAD_USE_OCC=ON
KICAD_SPICE=ON

Unless it’s very likely to be a bug in Board2Pdf it’s better to post here than to report an issue.

Are you using v0.5 of Board2Pdf?

Are you getting any more error messages, apart from the one in your screen dump?

Since the path and filename is blurred, it’s hard to tell if the problem could be caused by this. Is there any special characters in the path or filename? I’m not sure if I’ve even tested with spaces in the path or filename.

Please try copying your .kicad_brd file to C:, open it from there and try running the plugin again.

Are you using the default settings of Board2Pdf? If not, could you please upload your config.ini file.