<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Folks,</div><div><br></div><div>I wrote this last night, but then sent the message only to myself. Now I'm sending it to the</div><div>list, and adding a paragraph to explain Herb's discovery this morning.</div><div><br></div><div>a) Ross Moore rightly suggested that it would be useful to look at the code and see what each program</div><div>is actually doing with a pdf file. In the case of TeXShop, here is the essential code:</div><div><br></div><div><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-style-span" style="color: rgb(113, 50, 169); font-family: Menlo; font-size: 11px; "><span style="color: rgb(0, 0, 0); "><span class="Apple-tab-span" style="white-space: pre; "> </span></span>PDFDocument<span style="color: rgb(0, 0, 0); "><span class="Apple-tab-span" style="white-space: pre; "> </span>*pdfDoc;</span></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><span class="Apple-style-span" style="color: rgb(53, 89, 93); "><span style="color: rgb(0, 0, 0); "><span class="Apple-tab-span" style="white-space: pre; "> </span></span><span style="color: rgb(183, 16, 162); ">if</span><span style="color: rgb(0, 0, 0); "> ([</span><span style="color: rgb(183, 16, 162); ">self</span><span style="color: rgb(0, 0, 0); "> </span>doReleaseDocument<span style="color: rgb(0, 0, 0); ">]) {</span></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; color: rgb(64, 13, 129); "><span style="color: rgb(0, 0, 0); "><span class="Apple-tab-span" style="white-space: pre; "> </span>pdfDoc = [[[</span><span style="color: rgb(113, 50, 169); ">PDFDocument</span><span style="color: rgb(0, 0, 0); "> </span>alloc<span style="color: rgb(0, 0, 0); ">] </span>initWithURL<span style="color: rgb(0, 0, 0); ">: [</span><span style="color: rgb(113, 50, 169); ">NSURL</span><span style="color: rgb(0, 0, 0); "> </span>fileURLWithPath<span style="color: rgb(0, 0, 0); ">: imagePath]] </span>autorelease<span style="color: rgb(0, 0, 0); ">]; </span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><span class="Apple-tab-span" style="white-space: pre; "> </span>[<span style="color: rgb(183, 16, 162); ">self</span> <span style="color: rgb(64, 13, 129); ">setDocument</span>: pdfDoc];</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; color: rgb(12, 135, 3); "><span class="Apple-style-span" style="color: rgb(0, 0, 0); "><span class="Apple-tab-span" style="white-space: pre; "> </span>} <span style="color: rgb(183, 16, 162); ">else</span> {</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; color: rgb(64, 13, 129); "><span style="color: rgb(0, 0, 0); "><span class="Apple-tab-span" style="white-space: pre; "> </span>...</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><span class="Apple-tab-span" style="white-space: pre; "> </span>}</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; min-height: 13px; "><span class="Apple-tab-span" style="white-space: pre; "> </span><br class="webkit-block-placeholder"></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><span class="Apple-style-span" style="color: rgb(64, 13, 129); "><span style="color: rgb(0, 0, 0); "><span class="Apple-tab-span" style="white-space: pre; "> </span>[</span><span style="color: rgb(84, 129, 135); ">myPDFWindow</span><span style="color: rgb(0, 0, 0); "> </span>makeKeyAndOrderFront<span style="color: rgb(0, 0, 0); ">: </span><span style="color: rgb(183, 16, 162); ">self</span><span style="color: rgb(0, 0, 0); ">];</span></span></div><div><font class="Apple-style-span" face="Menlo" size="3"><span class="Apple-style-span" style="font-size: 11px; "><br></span></font></div><div><font class="Apple-style-span" face="Menlo" size="3"><span class="Apple-style-span" style="font-size: 11px; "><span class="Apple-style-span" style="font-family: Helvetica; font-size: medium; ">I left out some lines which deal with displaying the total number of pages in the document in the</span></span></font></div><div>GUI, but the essential story is here.</div><div><br></div><div>Let me translate. PDFDocument is a class in PDFKit which obtains and organizes data from a pdf file;</div><div>the code displayed above belongs to a PDFView class --- a PDFKit class which displays PDF data. The lines</div><div><br></div><div><span class="Apple-tab-span" style="white-space: pre; "> </span>if ( [self doReleaseDocument]) {</div><div><span class="Apple-tab-span" style="white-space: pre; "> </span>...</div><div><span class="Apple-tab-span" style="white-space: pre; "> </span>else</div><div><span class="Apple-tab-span" style="white-space: pre; "> </span>...</div><div><br></div><div>say "if we are running on Leopard, everything will work fine, but otherwise we have to do some</div><div>fancy footwork to avoid PDFKit bugs"; this explains why the TeXShop web page says</div><div>"System 10.5 or Higher Strongly Recommended".</div><div><br></div><div>So essentially the above code says</div><div><br></div><div><span class="Apple-tab-span" style="white-space: pre; "> </span>tell PDFKit to create a PDFDocument class from the pdf file</div><div><span class="Apple-tab-span" style="white-space: pre; "> </span>give that PDFDocument to the PDFView</div><div><span class="Apple-tab-span" style="white-space: pre; "> </span>tell the window to display itself</div><div><br></div><div>There is no code to determine page size, bounding boxes, media boxes, or anything else. All of</div><div>that is handled by PDFKit. TeXShop does all sorts of things, but it doesn't dig into the pdf file</div><div>in any way.</div><div><br></div><div>If somebody is cutting off the top of that circle, it isn't me.</div><div><br></div><div><br></div><div>Addition: This morning, Herb discovered that the top of the circle is not cut off in TeXShop if viewed </div><div>with the magnifying glass. The TeXShop code for the magnifying glass occurs in an entirely different</div><div>place, and is done by manipulating the PDFView's documentView bounds and redrawing. So one</div><div>of the bounding rectangles which PDFKit picked up from the pdf file has been resized, allowing the</div><div>underlying pdf to show through. </div><div><br></div><div><br></div><div>b) Usually I run TeXShop with magnification set to "Fit To Window." In the key example below, this gives a large</div><div>circle, cut off at the top. But if you set magnification to "Actual Size", you'll see that the circle is</div><div>very small. it is fun to magnify the circle by changing all numbers below to numbers ten times as large.</div><div>Switching back to "Fit To Window", you'll immediately see that TeXShop --- er, PDFKit --- does the right thing.</div><div><br></div><div>So whatever is going on is an incorrect clip box, or some box, off by a few pixels. I suspect one of</div><div>tikz, the geometry package, and pdftex is bounding the dimensions of one of the boxes.This rounding is</div><div>visible to us because the image is subsequently magnified a lot.</div><div><br></div><div><br></div><div><br></div><div><br></div><div>c) Direct inspection of the pdf file shows lots of compressed information. It would be nice to have that file</div><div>in uncompressed form. Google suggests that a free program named pdftk can do that, but the version of</div><div>the program I found for OS X couldn't handle PDF-1.5 files. Can anyone uncompress that pdf file? Even</div><div>better, remove the line which inserts text, typeset, and then uncompress, hoping for a pdf file as short</div><div>and simple as possible.</div><div><br></div><div><br></div><div>Dick Koch</div><div><br></div><div><br></div><div><br></div><div><br></div><div><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">The following example was posted in MacOSX TeX mailing list<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">\documentclass{article}<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">\usepackage{tikz}<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">\usepackage[papersize={51pt,51pt},margin=.5pt,centering]{geometry}<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">\begin{document}<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">\parindent 0pt<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">\begin{tikzpicture}<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">\draw[line width=.5pt] (0,0) circle (24.75pt);<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">\draw (0,0) node{24.75pt};<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">\end{tikzpicture}<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">\end{document}<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"></blockquote></blockquote></div><div><br></div><div><br></div><div><br></div><div><br></div></body></html>