Basic Examples (6)
Get the bounding rectangle coordinates of the contents of the current cell:
Get the bounding rectangle coordinates of a rectangle that fills out the whole internal area of the current cell:
Generate an output cell with some text:
Get the bounding box size of the text in printer's points:
Take some image object and adjust its size manually:
Get the current bounding box size of the object and specify it as ImageSize:
First, produce an output cell:
Get the current absolute wrapping width of the produced cell and specify it as ImageFormattingWidth for Rasterize in order to reproduce the current view:
Specify the current absolute wrapping width of the output cell as ImageSize for Pane, in order to reproduce the current wrapping independently of the WindowSize:
Applications (2)
Export a Wolfram Language expression exactly as it appears on the screen. First, generate some expression as an output cell:
Adjust the window width of the current notebook in order to obtain the wrapping you wish. Then obtain the current wrappingWidth of the output cell, and export the expression as Pane with ImageSize→wrappingWidth:
Properties and Relations (2)
Define a region using Annotation:
CellBoundingRectangle returns the bounding rectangle for the cell as it currently appears on the screen:
Rasterize[expr,"Regions"] also returns the bounding rectangle for the region defined by Annotation, taking fixed values for some Notebook and Cell options, including PageWidth and Magnification:
By setting these options explicitly, we can partially reproduce the result of Rasterize with CellBoundingRectangle:
AbsoluteCurrentValue[cellObj,CellSize] also returns the bounding rectangle information for the contents of the cell cellObj, but the width differs from that returned by CellBoundingRectangle[cellObj,CellContents,ImageSize] by a fixed amount with the given value of the Magnification option:
Possible Issues (1)
Cell heights returned by CellBoundingRectangle with different second arguments may differ: