# Question

I am trying to design a template for my Canon iP7250 printer. I would like to draw it using TikZ. I'd like to compile both pdf files and svg files. The middle should be transparent just like anything outside the outer rim of the disk.

## Attempt

My solution is probably to clip any extraneous shapes that extend beyond the DVD's printable area (the outer edge and the inner space)

I tried using information from the following:

but I can't seem to get it to work.

\documentclass{article}
\usepackage{fontspec}
\setmainfont[%
Extension = .otf ,
UprightFont = *-Regular ,
ItalicFont = *-RegularIt ,
BoldFont = *-Bold ,
BoldItalicFont = *-BoldIt ]{SourceSansPro}
\usepackage{xltxtra}% adds functionality to fontspec (superior glyphs with \textsuperscript)
\usepackage[%
paperheight=224mm,
paperwidth=130mm,
top=0cm,           % distance of the text block from the top of the page
bottom=0cm,
left=0cm,
right=0cm,
%    showframe,           % show the main blocks
%    verbose,             % show the values of the parameters in the log file
]{geometry}

%SET MARGINS (AND PAGE DIMENSIONS)
\usepackage{tikz}
\usetikzlibrary{calc,spy}

\begin{document}

\begin{tikzpicture}[overlay,remember picture]
\tikzstyle{reverseclip}=[insert path={(current page.north east) --
(current page.south east) --
(current page.south west) --
(current page.north west) --
(current page.north east)}
]
\node [yshift=-119.98mm,draw,shape=circle,minimum width=120mm,fill=red!10] (physicalDVD) at (current page.north) {};
\node [draw,color=green,fill=green!10,shape=circle,minimum width=119mm] (printableArea) at (physicalDVD) {};
\node [minimum width=28mm,shape=circle,draw,color=red,fill=yellow!50] (physicalDVDmiddlespace) at (physicalDVD) {};

\begin{pgfinterruptboundingbox} % To make sure our clipping path does not mess up the placement of the picture
\path [clip] (physicalDVDmiddlespace) [reverseclip];
\end{pgfinterruptboundingbox}

\end{tikzpicture}

\end{document}

• Some lines are missing on top of your code. Would you mind to include them? – Ignasi Jan 19 '15 at 8:55
• Maybe there are some requirements that I don't understand but why don't you just clip with the outer circle (physical DVD), paint the picture/text that you want, and overdraw the unprintable center hole with a white circle? – Harald Jan 19 '15 at 9:30
• I thought of that already. Clipping both outside the outer circle and inside the inner circle is a requirement. "Killing" the area, as you called it, seems more like a low-quality solution. I'd like to be able to produce both pdf and svg images of the label with a transparent/clipped middle. Thanks for the input though. Your solution does work in a pinch! – Jonathan Komar Jan 19 '15 at 10:28
• @macmadness86 The quality of a solution always depends on the problem that you want to solve :) It is often safer to print white (all zeros in CMYK) instead of printing transparent (??? in CMYK). If you want to superimpose the result with other graphics, OK. In any other case I would double check that requirement. – Harald Jan 19 '15 at 12:42
• The convenience of putting some clipping code at the top of the tikzpicture is robust in that it allows an arbitrary number of shapes to be subsequently drawn without concern for drawing anywhere outside the printable area (this includes white circles in the middle). Clipping both the inside and outside of the printable area makes the image web-friendly too (for svg output of actual printable area). What I meant by quality is not cutting corners, but doing it the right way. A little work now saves time later... – Jonathan Komar Jan 22 '15 at 8:07

The use of clipping the inner circle is not obvious to me. You can "kill" that area just by over-drawing a white circle at the end. This makes the outer clipping very straight forward. Here is an example.

\documentclass{article}
\usepackage[%
paperheight=224mm,
paperwidth=130mm,
top=0cm,           % distance of the text block from the top of the page
bottom=0cm,
left=0cm,
right=0cm,
]{geometry}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[overlay,remember picture]

\coordinate[yshift=-119.98mm] (center) at (current page.north) ;
% clip outer boundary
\draw [clip] (center) circle (60mm);
%% content to print
\foreach \i in {1,...,100}{
\pgfmathrandominteger{\x}{10}{120}
\pgfmathrandominteger{\y}{70}{180}
\pgfmathrandominteger{\c}{1}{100}
\fill[black!\c] (\x mm,- \y mm) rectangle +(-20mm,20mm);
}
%% cut out inner hole
\fill[white,draw=red] (center) circle (14mm);

\end{tikzpicture}
\end{document}


An the result looks like this:

• Thats great! But I've already got this far. I'd like to clip out the middle and the outside as said above in my comment :) – Jonathan Komar Jan 19 '15 at 10:41

The following is my solution to the problem with the help of the external sites listed in the question. I hope it helps somebody.

\documentclass[10pt]{article}
%% #### Standard Packages
\usepackage[quiet]{fontspec}
% !TEX TS-program = XeLaTeX
\setmainfont[%
Extension = .otf ,
UprightFont = *-Regular ,
ItalicFont = *-RegularIt ,
BoldFont = *-Bold ,
BoldItalicFont = *-BoldIt ]{SourceSansPro}
\usepackage{xltxtra}% adds functionality to fontspec (superior glyphs with \textsuperscript)
\usepackage[%
paperheight=224mm,
paperwidth=130mm,
top=0cm,           % distance of the text block from the top of the page
bottom=0cm,
left=0cm,
right=0cm,
showframe,           % show the main blocks
%    verbose,             % show the values of the parameters in the log file
]{geometry}

\usepackage{tikz}
\usetikzlibrary{calc,decorations.pathmorphing, decorations.text,positioning}
\begin{document}

\begin{tikzpicture}[remember picture, overlay]
% Page Anchors
\node [yshift=-119.98mm,inner sep=0,shape=circle,fill=red,draw] (origin) at (current page.north) {};
\node [inner sep=0] (east anchor) at (origin -| current page.north east) {};
% a random point of the circle

\begin{scope}[even odd rule, remember picture,overlay]
\clip
(origin) circle (14mm) % Inner circle
(origin) ++(0:60mm) arc (0:360:60mm);
\node [shape=circle,draw,color=red,minimum width=120mm] (physicalArea) at (origin) {Node Circle}; % Physical Disk Edge
\node [shape=circle,draw,color=green,minimum width=119mm] (printableArea) at (origin) {};
\draw [fill=blue!20] ($(origin) + (0,-5mm)$) rectangle ++(-46mm,-46mm);
\node [shape=circle,minimum width=28mm,color=red,draw,thick] (innerRing) at (origin) {};
%\draw [blue,thick] ($(origin) + ({\myradius*cos(0)}, {\myradius*sin(0)})$) arc (0:360:\myradius) ;
\path[draw,color=orange,postaction={decorate,decoration={text along path,text={|\tiny|text along path test},text align=center,reverse path}}]
($(origin) + ({\myradius*cos(0)}, {\myradius*sin(0)})$) arc (0:-180:\myradius);
\end{scope}

% Layout Scope
\begin{scope}[even odd rule, every node/.style={font=\scriptsize}]
\tikzset{layout lines/.style={->|,dashed,blue}}
\draw [layout lines] (origin) -- (current page.north) node [pos=.75,left] {Vertical Offset B: 119.98mm};
\draw [layout lines] (origin) -- (east anchor) node [pos=.5,above] {Horizontal Offset A: 65mm};

\node [align=center,anchor=north] at ($(physicalArea.south) + (0,-5mm)$) {%
{\Large\bfseries Calibration for Disk Tray J on Printer iP7250}\\
Ensure that the printer is not automatically scaling the output in the advanced tab of the initial print dialog.\\[5mm]
{\bfseries Physical Disk Tray Dimensions:}\\
Height = 224 mm\\
Width = 130 mm\\
Margins = 0 mm};
\clip
(origin) circle (14mm) % Inner circle
(origin) ++(0:60mm) arc (0:360:60mm);
\draw [layout lines] (innerRing.west) -- (printableArea.west) node [pos=.5,above] {Printable Area: 45mm};
\path [draw,red] (origin) ++(145:60mm) node [inner sep=0] (arbitrary145) {};
\draw [layout lines,pos=.5,above,postaction={decorate,decoration={text along path,reverse path,raise=4pt,text align=center,text={|\scriptsize\color{blue}|Physical Area: 46mm}}}] (origin) -- (arbitrary145) ;
\end{scope}

\end{tikzpicture}

\end{document}


## Help

I would like to know how to force a post action on the drawing of the outermost circles (the physicalArea and printableArea nodes).