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: [mg123960] Re: How can I rasterize the selection in a notebook, preserving In/Out labels when appropriate?
  • From: Szabolcs Horvát <szhorvat at gmail.com>
  • Date: Mon, 2 Jan 2012 02:47:38 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com

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-width-for-notebook-related-expressions
>
>
> , 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 course
> 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



  • Prev by Date: Re: beginner question regarding units in equations
  • Next by Date: Re: drawing polygon diagonals
  • Previous by thread: How can I rasterize the selection in a notebook, preserving In/Out labels when appropriate?
  • Next by thread: Re: How can I rasterize the selection in a notebook, preserving In/Out labels when appropriate?