Another solution: drawing your own dashed lines
It seems that Tikz doesn't always do what we expect it to do. Especially in combination with things such as edge[transform canvas={xshift=4}]
or custom functions like rounded arrows as can be found in this post. In those cases, the printer sometimes just doesn't print normal dashed lines. That's why we need to use a workaround.
The other answer with printersafe didn't work for me. Also, I want to send the pdf to other people so I can't update their printers. I needed a solution that would always work.
I found a workaround that imitates a dashed line using a foreach
loop with normal lines:
\documentclass[a4paper]{article}
\usepackage[english]{babel}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\begin{figure}[h!]
\begin{tikzpicture}[every path/.style={>=latex}]
% Normal dashed line
\draw[->,thick,black,dashed] (0,1) -- (4,1) node[anchor=west] {Normal dashed line};
% Specify dashed line starting coordinate and length
\def\x{0}; \def\y{0}; \def\length{4} \def\N{19};
% Draw dashed line using normal lines
\pgfmathsetmacro{\step}{(0.5+1/(4*\N))*\length/\N}; \pgfmathparse{\N-1};
\foreach \i in {0,...,\pgfmathresult} {\draw[thick,black] (\x+2*\i*\step,\y) -- (\x+2*\i*\step+\step,\y);};
\draw[->,thick,black] (\x+\length,\y) -- (\x+\length+0.01,\y) node[anchor=west] {Custom dashed line};
\end{tikzpicture}
\end{figure}
\end{document}
This simply mimicks a normal dashed line by drawing multiple lines after each other. Parameters are \x
for the starting x-coordinate, \y
for the y-level of the line, \length
for the length in coordinates of the line and \N
for the amount of stripes.
The example provided only draws horizontal lines from left to right, but the code can easily be adjusted to draw other dashed lines (such as vertical lines, right-to-left, etc.)
This solution will still allow you to print dashed lines if your printer does print the normal lines but the dashed lines do not show up (for some reason).
Output on pdf:

ultra thin
.