[Tex/LaTex] Transcribing pdf into tikz code

tikz-pgf

How do I convert this PDF from a WASD keyboard layout into tikz code. Is there an automated way to at least extract the key outlines?

Best Answer

You don't need to convert to SVG because you can use pdf and draw on it. Next code was taken from Caramdir's and Jake's answers to Drawing on an image with TikZ. (I use a pdfcroped WASD file because the original has a lot of white space around).

\documentclass[tikz]{standalone}

\begin{document}
\begin{tikzpicture}[font=\sffamily\Large]
    \node[anchor=south west,inner sep=0] (image) at (0,0) {\includegraphics{wasd_104_classic-crop}};
\begin{scope}[x={(image.south east)},y={(image.north west)}]
\draw[help lines,xstep=.05,ystep=.05] (0,0) grid (1,1);
\foreach \x in {0,1,...,9} { \node [anchor=north] at (\x/10,0) {0.\x}; }
\foreach \y in {0,1,...,9} { \node [anchor=east] at (0,\y/10) {0.\y}; }
\node[fill=red!15,draw=red] at (0.112,0.38) {H};
\node[fill=white,draw=red] at (0.157,0.38) {H};
\node[fill=white,draw=red] at (0.205,0.38) {H};
\end{scope}
\end{tikzpicture}
\end{document}

enter image description here

You can also use some of the fonts from Keyboard Font for LaTeX to draw your keys.