Scott, Thanks again for the help.
I have tracked the issue down to the ps2eps script that LyX runs to convert from pdf to LyX (or Qt) display format. Basically ps2eps recalculates the bounding box based on the actual elements in the image, so it throws away any whitespace surrounding the image. The result is that LyX onscreen is using the recalculated (smaller) bounding box, while pdflatex is using the larger media box. Would you mind telling me what version of ps2eps you have installed? I have 1.68. Version 1.68 has been around since 2010, so I think there may have been some change in how LyX calls ps2eps? Thanks again Steve On Nov 15, 2012, at 7:18 AM, Scott Kostyshak wrote: > On Wed, Nov 14, 2012 at 10:25 PM, Stephen Buonopane > <sbuon...@bucknell.edu> wrote: >> I am trying to debug a problem with the use of the "clip to bounding box" >> feature on pdf files. >> LyX seems to extract a different value of the bounding box then the media >> box that is defined in the pdf file. >> >> For example… >> Media Box = 0 0 612 792 >> LyX gets 0 0 481 628 >> >> If you then try to clip to some smaller value, the on screen lyx preview and >> the pdf output do not match (they show different parts of the image) making >> it impossible to crop correctly with just the lyx screen alone. >> >> My understanding is that on screen preview uses png files? >> What code does LyX use to do the file conversion? >> >> I checked the debug graphics output and I see a series of strings like >> "/var/folders/t7/5jlv9y4m8xlf0r0059bn09v80000gn/T/lyx_tmpdir.L59595/gconvert0.M59595.pdf" >> which goes from pdf -> ps -> eps ->png >> >> I wanted to take a look at the actual png file that lyx is using for on >> screen display, but the above file does not seem to exist on my computer…I >> have things like >> "…t7/5jlv9y4m8xlf0r0059bn09v80000gn/T/lyx_tmpdir.L59595/lyx_tmpbuf1" >> >> My instinct is it might have something to do with an assumption of 72dpi vs >> 92dpi, since the ratio of the media boxes 481/612 is about the same as >> 72/92. And some googling suggested that png files make some assumption about >> dpi. >> >> I am using Mac OSX 10.7.5 and LyX 2.0.4. This is a new problem that has >> cropped up since I switched to 10.7 and LyX2.0.4. (But I did both at the >> same time, so not sure what the root cause is) >> >> If anyone wants to give it a try, attached is the file. Try changing from >> y=0 to y=300 for example. >> It was generated with Print to PDF from excel, but I get the same problem >> from other sources as well (but it seems not from all pdf files). > > This works fine for me on Ubuntu (meaning my pdf output is the same as > my LyX output). Attached is the .lyx file. > > If you want more output to analyze, use '-dbg graphics'. From what I > understand, converted graphics are usually stored in your > user-dir/cache folder, but I'm not sure if LyX uses a converter in > this situation. I think Qt handles the pdf directly. > > Scott > >> >> I would be happy to help provide more details, but I don't have the >> programming skill to actually fix the code. >> >> LyX is amazing and I have been using it for 15 years now! > > Wow! > >> >> Steve >> > <BoundingBox.lyx>