Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #7537 > unrolled thread

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

Started bySzabolcs Horvát <szhorvat@gmail.com>
First post2012-01-02 07:52 +0000
Last post2012-01-02 07:52 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Re: How can I rasterize the selection in a notebook, preserving In/Out labels when appropriate? Szabolcs Horvát <szhorvat@gmail.com> - 2012-01-02 07:52 +0000

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

FromSzabolcs Horvát <szhorvat@gmail.com>
Date2012-01-02 07:52 +0000
SubjectRe: How can I rasterize the selection in a notebook, preserving In/Out labels when appropriate?
Message-ID<jdrnne$939$1@smc.vnet.net>
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@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

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web