Accurate size, and missing pads, of pcbnew PDF plot?

Essentially, I have these questions, exemplified later on in this post:

  • How do I get PDF plots (for UV photoresist PCB development) of front and back copper layers with accurate size?
  • How do I get PDF plots of front and back copper layers without missing pads?

I’ve seen the related question Print & Plot problems: pads missing & wrong size - Layout - KiCad.info Forums - but this also has a simplified test (and a hack fix), so I thought I’d post this separately.

Here is a little test I’ve done; the version I use is:

Application: pcbnew
Version: (2017-11-13 revision d98fc85)-master, release build
Libraries:
    wxWidgets 3.0.2
    libcurl/7.35.0 OpenSSL/1.0.1f zlib/1.2.8 libidn/1.28 librtmp/2.3
Platform: Linux 4.4.0-116-generic x86_64, 64 bit, Little endian, wxGTK
Build Info:
    wxWidgets: 3.0.2 (wchar_t,wx containers,compatible with 2.8) GTK+ 2.24
    Boost: 1.54.0
    Curl: 7.35.0
    Compiler: GCC 4.8.4 with C++ ABI 1002

Build settings:
    USE_WX_GRAPHICS_CONTEXT=OFF
    USE_WX_OVERLAY=OFF
    KICAD_SCRIPTING=ON
    KICAD_SCRIPTING_MODULES=ON
    KICAD_SCRIPTING_WXPYTHON=ON
    KICAD_SCRIPTING_ACTION_MENU=ON
    BUILD_GITHUB_PLUGIN=ON
    KICAD_USE_OCE=OFF
    KICAD_SPICE=OFF

Open pcbnew standalone. First “Place”/“Footprint”, and add a Pin_Headers:Pin_Header_Straight_1x03_Pitch2.54mm footprint.

Again “Place”/“Footprint”, and add a Resistors_SMD:R_0603_HandSoldering footprint:

Then have your track settings on default (for me, 0.250 mm (9.84 mils)) and grid settings too (for me 0.0254 mm (1.00 mils) and do “Route”/“Single Track”, and connect the outer pins of the header with the pads of the resistor:

Then, change to Grid: 5.000 mm (196.85 mils), select the Edge.Cuts layer, and draw an outline with “Place”/“Lines” - for me it turns out to be 35x20 mm in size:

Now, choose “File”/“Plot”, choose Plot Format: PDF; have only F.Cu and B.Cu layers selected; and uncheck “Exclude PCB edge layer from other layers” - and finally click on Plot:

Open the generated PDF file in a PDF viewer - here evince, set the view zoom to 100%:

Now I’ll use the screenruler application in Linux; note that:

on my Ubuntu 14.04, xdpyinfo reports 1366x768 pixels (361x203 millimeters), that turns out to be 96.1119 x 96.0945 ppi; screenruler by default is set to “System Settings” for the resolution, which reads 96 x 96 pi (no floats accepted). However, when I put an actual ruler next to screenruler, the screenruler has a smaller “cm”.

Then, if I use xrandr I get: “eDP1 connected 1366x768+0+0 (normal left inverted right x axis y axis) 293mm x 164mm”; which turns out to 118.418 x 118.946 ppi, and setting that for ppi for screenruler works (as in, the cm on screen is much closer to a cm of the physical ruler).

So, with this setting of screenruler, I get that the size of the box is something like 29 x 16 mm, where it should be 35x20 mm:

Rounding and imprecision errors notwithstanding, this is quite a ways off. Let’s try confirm that with PDF Xchange Viewer, where we can choose “Tools”/“Measuring Tools”/“Distance Tool”/“Show Comments Styles Palette”; there for the Default Style choose 1 cm for “Ratio Unit (from)” and 1 cm for “Ratio Unit (to)”; close the “Comments Styles Palette” window; and then “Tools”/“Measuring Tools”/“Distance Tool”/“Default Style”, then draw measuring lines - for me, this shows 3.49 x 1.99 cm, which is quite close to where it should be, 35x20 mm:

Anyways, let’s try to print this PDF on a printer - I’m printing using evince:

Notice two problems here:

  • 1 pad of the 1x3 pin header, and both pads of the SMD resistor, are MISSING from the printout!
  • The size of the physical paper printout, as measured by a physical ruler, is something like 31x18 mm, not quite the intended 35x20 mm (and just as far from the 29 x 16 mm estimate by screen ruler)…

This with the missing pads, can also be shown like this - first, open the PDF in inkscape (0.92):

inkscape ~/noname-F.Cu.pdf

On the resulting “PDF Import Settings” screen, choose the defaults “Internal import”, “Replace PDF fonts by closest-named installed fonts”, “Embed images”; then the file opens in Inkscape, it will still show the pads:

First, save this file as Inkscape SVG .svg, and then save as Portable Document Format .pdf file named noname-F.Cu-inkscape.pdf; in the “Portable Document Format” settings window choose the defaults (Restrict to PDF version: PDF 1.5; Convert text to paths; output page size: Use document’s page size; Bleed/margin 0.0 mm). Now, if you open ~/noname-F.Cu-inkscape.pdf in evince, you do get missing pads:

And I think I know why this happens: note that if you open ~/noname-F.Cu.svg in inkscape, you still see all pads; however, note that the stroke-widths used by this file are:

$ sed -n 's/.*\(stroke-width[^;]*\).*/\1/p' ~/noname-F.Cu.svg | sort | uniq
stroke-width:0.0003937
stroke-width:59.05509949
stroke-width:669.29101562
stroke-width:98.42520142

That is, there is one stroke-width setting that is extremely small (0.0003937), but not quite zero - and it turns out, only the “missing” pads have this stroke/line width. If you now open the .svg in a text editor; look up “stroke-width:0.0003937” and replace it with “stroke-width:0.0” everywhere (and save and close the text editor), then open this in inkscape and export PDF (say ~/noname-F.Cu-inkscape2.pdf) from this, then this PDF will show the missing pads in evince fine - and they will be printed on paper too.

So, to repeat my questions:

  • How do I get PDF plots (for UV photoresist PCB development) of front and back copper layers with accurate size?
  • How do I get PDF plots of front and back copper layers, without missing pads?

I would try the print dialog instead of plotting to pdf. The print dialog allows for fine tuning the scale in x and y direction separately.

If you want your printout to be very precise you might need to calibrate it. I would use the footprints found in the measurement_scale plus some calibers for this task. (Print it, adjust scale, repeat until you are happy.)

2 Likes

Many thanks @Rene_Poschl :

Just tried this - and the print dialog has no problems with missing pads, so that’s very good.

Many thanks for this too, here is a reference to this footprint library: https://github.com/kicad/Measurement_Scales.pretty

What I did was “File”/“Print”, there chose Accurate Scale 1, (and uncheck “Print frame ref” if you don’t want the frame with Sheet/File/Title/Size etc printed), then click on Print -> then Print to File from the Linux Print dialog, and I can save this as PDF (page size turns out to be A4, this is apparently not set by Pcbnew’s Print menu, maybe it is set by the Linux print driver ?!).

Then I open this PDF in evince and print it to my laser printer; the size of the 35x20 mm box is 31.8x18mm (same as previous printout in OP) - and the Gauge I placed from the Measurement_Scales library tells me that my printer (probably) prints what it thinks is 10 cm as 9 mm, in both dimensions; here the X and Y scale adjust in Pcbnew’s Print dialog would definitely help with the “Print it, adjust scale, repeat” process.

Many thanks again!

why not print directly instead of going through pdf introducing another point for errors to come in?

1 Like

Because in this case, I’d need to send the PDFs to someone else :slight_smile:

The problem is that his pdf program might scale things differently then yours. (And their printer might also require different scaling settings.)

I would suggest you send gerber files and the person who does the printing does use a gerber viewer to print them directly without introducing a program not intended for such a task.

1 Like

Thanks @Rene_Poschl:

I agree fully about the different scaling problem. In this particular case though, the recipient is a person also with just a laser printer hooked to a desktop computer, so they might not benefit from having the gerbers (not sure if they have software that can open and print gerbers, either; they for sure don’t have KiCad)

I saw, however, that there are programs like https://sourceforge.net/projects/gerber2pdf/ - not sure if they can be useful…

In any case, the experiment here shows me that Pcbnew, both with Print and Plot, exports sizes that are generally accurate internally (that is, as measured by PDF exchange viewer), and what I’ve experienced is likely a scaling issue with my printer. So I guess, the best I can do in this case, is just make sure the PDFs are internally accurate, - and then warn the recipient that the printer device itself might have its scaling settings off.

PDF scaling is always a concern, especially when you are dealing with A4 vs Letter paper size between the US and most of the rest of the world.

I am puzzled about missing pads though. KiCad printing has always tended to simplify the output, whereas plotting is usually accurate

1 Like

I don’t know if it is a related issue, but I’ve had an issue with oval pads with offset drills not showing on print to pdf. I haven’t had the energy to actually bug report it though. (And I haven’t verified it with the current 4.0.7 stable…) If it is of interest to this thread I can see if I can replicate the issue.

2 Likes

Thanks for the replies:

It seems that the missing pads are due to a stroke width which is very small, but not zero (at least, that’s how it looks like once converted to SVG) - not sure if this is some bug in the PDF libraries on Ubuntu 14.04 … since setting this strokewidth to proper zero (again in svg, then export to PDF) then makes the pads reappear?!

I personally have not yet had use for oval pads -> however, it seems to be a related issue to the issues described in this thread, so if you have time to replicate and document that, I think it will be great.

Well I did a quick check with the demo “custom_pads_test” on the Windows x64 5.0RC2 that I downloaded yesterday. I tried printing to two different PDF print drivers and at least some of the issues seem to be related to PrimoPDF instead of KiCad. But it also seems that the print engine in KiCad currently doesn’t support the new custom pad shapes.

Here is the print dialog settings that I’m using:

And here is the print preview:

As you can see the for shapes of standard pads are there, but none of the custom pad shapes.

The print to the Microsoft PDF print driver that is on my Win10 work laptop by default (not sure if it is a Win10 standard, or something added by my corporate IT to the Win10 image they use) looks just like the print preview (although some zoom levels you can see a checkerboard pattern in the fill). custom_pads_test-MicroSoftPDF.pdf (115.7 KB)

The PrimoPDF print seems to have the stroke width issue that you allude to. The fill is a grid, the oval pads (both orthoganal and rotated) are just little dashes, and all the lines appear to be the same width.custom_pads_test-PrimoPDF.pdf (73.3 KB)

For what it’s worth, I’m viewing the PDFs with Adobe Acrobat Reader DC (currently rev 2018.011.20038).

I’m really disappointed with PrimoPDF (and since it really is a free teaser product for a paid package, I doubt I would get support from them). I use it as my primary PDF print driver because it is the only free PDF print driver for Win10 that I’ve found that will append a new print to an existing pdf file, and allows to customize the PDF settings at a per-print level. Anyone else have suggestions for a better Win10 PDF print driver?

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.