Datasheet Field in Symbols: Relative Path to PDF?

is there a way to link to the datasheet (local PDF file) using a relative path? I’m talking about the datasheet field in the schematic symbol of a component.

I have made a custom “KIDATASHEET” environment variable in KiCad Project Manager / Preferences / Configure Paths


And I use that in links to my personal datasheets.

If I were to make such a link now, I would call it “KICAD_DATASHEET” because that name is more in line with the convention KiCad uses itself these day’s.

1 Like

This is a nice idea but unfortunately still requires an absolute path. I would like to link the PDFs using a relative path like /../Datasheets/randomIC.pdf

The project is copied on several computers and might not end up in the same place.

Then set the environment variable on those computers accordingly.
Relative paths will likely not work because for each project it will be relative to project root and not symbol file location which is not what you want. At least I think that’s how it works, can’t test right now.

Relative paths are a nuisance to manage, especially longer term.

If you have your own libraries, with schematic symbols and datasheet links, you do not want to mess with all those parts separately. So you use ${KIDATASHEET}/randomIC.pdf for all the schematic symbols in your personal libraries, and you modify the KIDATASHEET variable once for each computer that you work on.

They are nuisance to manage, even short term!
Just because something can be done, does not mean that it should be done. But, if one really wants to do this, this is how it is done:


I don’t know that I recommend doing this. It is an aweful lot of work and duplication, for a design with only 2 parts.

On the plus side, this is a FULLY DEFINED project; it requires ZERO dependancies.

Oops, indeed.
I forgot to mention that ${KIPRJMOD} always points to the root of the current project.

I have not checked though what happens if you open a schematic in “standalone” mode. Does that mean the datasheet links will be (temporarily) broken because there is no active project? (1.1 MB)

^^^Is the complete project will all items Relative to the Project Path. I am curious to know if it works for others as I expect it should.

I’ll bite.

It’s got a simple schematic (looks OK) and PCB (Looks plausible) of a relay :slight_smile:

The schematic has two relays, while there are three on the PCB. K2 is outside of Edge.Cuts ???

J1 also has a Relay Footprint on the PCB ???

The library references in the schematic point to the "[Project]-rescue library. That works, but is not optimal, I do not like that whole “rescue” stuff much. (KiCad V6 won’t have that anymore).

Opening the documentation from within the schematic works. It finds the datasheet in the “downloads” directory where I placed the project.

Notice the use of the ${KIPRJMOD} in the schematic Symbol Properties window, and the corresponding link in the PDF reader (Firefox).

Then I closed KiCad, and opened the schematic directly from a file browser in “Standalone mode”.

KiCad can still find the .pdf of the relay, even when there is no active project. So it apparently just uses a relative path from where the schematic is.

The project has a “3dmodels” directory, however, there is no relay in the 3D-viewer:


Opening the Footprint Properties of one of the relays in Pcbnew shows a link to: “${KISYS_3DMODELS}/01_Qualified_3D Models.3dshapes/Relay_SPDT_Omron-G5LE-1.step” Which is outside of the project tree.

If you notice the path discrepancy…
I have a symbolic link “/home/paul/downloads” that points to: “/home/3TB_WD_Blue” So those names are the same. I do this because “/home/paul” is on a small SSD partition (40GB) while most of my data is on a big spin-a-ma-thing.

For some clarification, I used an incorrect Symbol for the physical part. Pins 2 and 5 are for the coil, and Pins 1 and 3 are for the contacts. The symbol that I used had pins 1 and 2 swapped. This small board is meant to translate this swap on already fabricated boards.

J1 “plugs” into the existing board and makes the connection swap between the board and the relay.

I don’t know why the 3D Models are not showing up on your end. At first I did have an error that K2 was not assigned 3D Settings to the ${KIPRJMOD}/3dmodels path. However, J1 and K1 were correct; and I sent an earlier version of the project to a friend and the 3D Models were visible on their end.

K2 was included because there is actually quite a lot going on to try to set this up to work and also NOT break existing local designs.

This image shows some experimentation:

^^^Probably NOT the recommended way to do this, but at the moment it does seem to work. Value has been changed to include the Project Environment Variable. (1.1 MB)

AFAIKATPIT … As Far As I Know At This Point In Time, this method should work and not break other existing local projects.

This is exactly the behavior I am trying to achieve. I only care about the datasheets for components used in my project. This is not intended to define paths to datasheets for the symbols in the library. I forgot to mention that I am on Version 5.99.
As for now, I cannot access a datasheet using a relative path, even it is in the root project folder.

Pressing hotkey [D] will result in


Fully defining the path allows me to open the PDF with my viewer.

I assume the problem is the syntax to define the relative path. Any ideas?

Full version information:
Application: KiCad (64-bit)
Version: (5.99.0-11550-g369d813a32), release build
wxWidgets 3.1.5
libcurl/7.74.0-DEV Schannel zlib/1.2.11
Platform: Windows 10 (build 19042), 64-bit edition, 64 bit, Little endian, wxMSW
Build Info:
Date: Jul 27 2021 21:01:30
wxWidgets: 3.1.5 (wchar_t,STL containers)
Boost: 1.75.0
OCC: 7.5.0
Curl: 7.74.0-DEV
ngspice: 34
Compiler: Visual C++ 1928 without C++ ABI
Build settings:

Did you read carefully what was written above? ${KIPRJMOD} works.


I initially tried ${KIPRJMOD} and wasn’t successful. I tried it again just now and indeed it works as described above. Not sure what I did differently, most likely a typo. Thanks everyone!

Edit: The subtle difference between ( and { was the problem :wink:


I apologize for setting you off on the wrong foot.

I edited all my posts in this thread and replaced the parenthesis with those curly things, so others reading this won’t make the same mistake.


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