Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: How can I rasterize the selection in a notebook, preserving In/Out labels when appropriate?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg123967] Re: How can I rasterize the selection in a notebook, preserving In/Out labels when appropriate?
  • From: Armand Tamzarian <mike.honeychurch at gmail.com>
  • Date: Tue, 3 Jan 2012 05:25:37 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com

On Jan 2, 6:52 pm, Szabolcs Horv=E1t <szhor... at gmail.com> wrote:
> I forgot to mention that there are some other things too that worry me
> when using the copy-to-another-notebook method (number 3. below):
>
>   Could this cause hidden problems when copying Dynamic things?
>
>   It doesn't take into account stylesheets.
>
> Method 2. doesn't suffer from these problems, but it's Windows only ...
>
> On 2012.01.01. 13:51, Szabolcs Horv==E1t wrote:
>
>
>
>
>
>
>
>
>
>
>
> > Dear MathGroup,
>
> > How can I rasterize the selection in a notebook, preserving In/Out
> > labels when appropriate?
>
> > I already asked about this here:
>
> >http://stackoverflow.com/questions/8353838/controlling-the-rasterize-...
>
> > , but the question is not completely solved.
>
> > A summary of what I have so far (you can skip to point 3 for the main
> > question).
>
> > 1. Applying Rasterize to the result of NotebookRead[] will reformat
> > everything using the width of the evaluation notebook. If it's
> > called from a palette, this is unusably narrow.
> > So Rasterize at NotebookRead[...] is not usable here.
>
> > 2. One method is using the the Edit -> Copy As -> Bitmap menu item.
> > This is callable from a program like this:
>
> > FrontEndToken[FrontEnd`SelectedNotebook[], "CopySpecial", "MGF"]]
>
> > This works nicely but is unfortunately Windows-only, and also
> > destroys the clipboard contents.
>
> > 3. The best method is copying everything to a new notebook
> > and Rasterizing the whole notebook expression, like so:
>
> > CreatePalette@Button["Preview",
> > Module[{target},
> > target ==
> > CreateDocument[{}, WindowSelected -> False, Visible -> False];
> > NotebookWrite[target, NotebookRead[SelectedNotebook[]]];
> > CreateDialog[{Rasterize[target], DefaultButton[]}];
> > NotebookClose[target]
> > ]
> > ]
>
> > The problem (sometimes advantage, sometimes problem :) with this
> > is that the In/Out labels are not included in the rasterization.
>
> > Test it by creating a palette using the above code, selecting a
> > few input/output cells, and pressing the palette button.
>
> > So the question could be rephrased as: is there a way to rasterize a
> > whole notebook so that In/Out labels are preserved?
>
> > I need this to work for any selection, not only when complete cells are
> > selected. When only part of the text or a graphic is selected, of cours=
e
> > there shouldn't be any In/Out labels. However, when one or more
> > input/output cells are selected using the cell brackets, the labels
> > should be preserved.
>
> --
> Szabolcs Horv==E1t
> Mma QA site proposal:http://area51.stackexchange.com/proposals/37304


The documentation is very Windows centric. Even though I use a Mac it
tells me about the Windows options for the "CopySpecial" token but
doesn't list the Mac specific ones. This sort of thing seems to occur
in other places in the documentation. If they don't want platform
specific documentation (fine) then at least list the platform specific
differences. Not everyone uses Windows.

On a Mac you can copy as PDF or Quicktime. So using SelectionMove and
then

FrontEndTokenExecute[FrontEnd`SelectedNotebook[], "CopySpecial",
"PDF"]

followed by

CreateDocument@NotebookGet@ClipboardNotebook[]

is the Mac version of solution #2.

Mike




  • Prev by Date: Re: Rule replacement doesn't work after NDSolve?
  • Next by Date: Re: Rule replacement doesn't work after NDSolve?
  • Previous by thread: Re: How can I rasterize the selection in a notebook, preserving In/Out labels when appropriate?
  • Next by thread: Mathematica on tablet computer