Copy/paste selection of a pdf on Mac

4405 views
Skip to first unread message

A. B.

unread,
Apr 26, 2009, 1:36:47 AM4/26/09
to
I think this has more to do with Apple than Mathematica:

- Select a portion of a pdf file in Preview.app and copy to the clipboard,
- Paste in Mathematica.

This results in the whole pdf page being pasted in Mathematica. Researching
on the web showed that this same behaviour was observed with Keynote at some
point but it has since been fixed.
It has to do with a new so-called "non-destructive" way that Preview now
uses for cropping. The application where the pasting is done needs to be
made aware of this change on the part of Apple. Thus, on my 10.5.6 system,
pasting works well with Pages and Keynote (iWork 9).
A workaround is to paste in one of these applications, copy the pdf image
and paste it in Mathematica. This works as expected.

Regards,
A.B.


A. B.

unread,
Apr 26, 2009, 1:37:08 AM4/26/09
to
In Apple Preview.app, Leopard (10.5), the menu View:PDf Display: has two
options, 'Media Box' and 'Crop Box'. If one selects and copies a portion of
a pdf and creates in Preview a new pdf from the clipboard, then View Crop
Box shows the selected part only while View Media Box shows the whole page.
It means that applications such as Apple Pages and Keynote (and also
TexShop) show the pasted portion of the pdf in Crop view, while Mathematica
shows the whole pasted pdf page, ie the 'Media view'.

A.B.

Jens

unread,
Apr 27, 2009, 5:24:26 AM4/27/09
to

Hi,
the problem is that the CropBox is being ignored by Mathematica.
Perhaps the easiest workaround for this issue is to replace Preview
with the free PDF reader and annotation application Skim (http://skim-
app.sourceforge.net/). Copying from Skim to Mathematica works fine
because it puts the crop information into the MediaBox dimensions.

Another possibility, if you want to keep using Preview (e.g., because
it's more versatile with non-PDF formats), would be based on a script
I wrote last year, precisely for this purpose in conjunction with the
earlier versions of Keynote. I now slightly modified my script to
change the MediaBox as required by Mathematica, and I've posted it as
an AppleScript bundle in the file clipPDF-noGS-1.2.zip which can be
downloaded at
http://www.uoregon.edu/~noeckel/PreviewLeopard.html#nogsMediaBox
You would then copy a selection in Preview as usual, but before
pasting into Mathematica invoke this script from the script menu bar.
It directly modifies the current PDF clipboard contents, so that only
cropped part of the PDF appears when you subsequently paste into
Mathematica.
To install this script, just follow the instructions in the
accompanying README file (there's no need for any additional
downloads).

Regards,
Jens


ragfield

unread,
Apr 29, 2009, 6:41:55 AM4/29/09
to
On Apr 26, 12:36 am, "A. B." <functionalcoati...@gmail.com> wrote:
> I think this has more to do with Apple than Mathematica:
>
> - Select a portion of a pdf file in Preview.app and copy to the clipboard=

,
> - Paste in Mathematica.
>
> This results in the whole pdf page being pasted in Mathematica. Researchi=
ng
> on the web showed that this same behaviour was observed with Keynote at s=

ome
> point but it has since been fixed.
> It has to do with a new so-called "non-destructive" way that Preview now
> uses for cropping. The application where the pasting is done needs to be
> made aware of this change on the part of Apple. Thus, on my 10.5.6 system=

,
> pasting works well with Pages and Keynote (iWork 9).
> A workaround is to paste in one of these applications, copy the pdf image
> and paste it in Mathematica. This works as expected.


This is a previously unreported bug in Mathematica that has since been
fixed for a future release.

In the future I encourage you to report any suspected bugs in
Mathematica to Wolfram Tech Support: http://support.wolfram.com/submitabug.=
cgi

-Rob, Wolfram Research

Jens

unread,
Apr 30, 2009, 6:20:32 AM4/30/09
to

I've added a bug report for a related problem, not knowing if it has
been fixed for versions > 7.0.0:

When pasting a PDF page into Mathematica's notebook, the resolution of
the pasted cell does not adjust itself to the View magnification of
the notebook.
Example:
(a)
set Window>Magnification > 200%
(b)
paste a PDF containing resolution-independent vector graphics (fonts)
into this notebook

The display appears coarse and pixelated. It is possible to resize the
pasted image, but the result looks smooth only when the notebook
magnification is set to 100%.

Jens

Reply all
Reply to author
Forward
0 new messages