Figures

The support for figures offered by SmartPaginator is RADICALLY DIFFERENT than the support offered by Microsoft. Please read the information below.

Figures as defined by Microsoft, are anchored elements that can be positioned outside of the containing paragraph, often using the page or the column as their anchor point. This creates some very interesting challenges when trying to render and paginate content. Consider the following example:

Figure1.jpg

In this example, the blue paragraph has no figures defined, while the green paragraph defines a figure that is anchored to the top of the page. Assuming we use a top-to-bottom rendering algorithm, our steps would be something like:
  1. Render the blue paragraph as if nothing was there
  2. Determine that the green paragraph is on the same page and render the figure
  3. Re-render the blue paragraph around the image
  4. Check if the new height of the blue paragraph forces the green paragraph into the next page.
    1. If so, move the figure and the green paragraph into the next page and re-render the blue paragraph again, this timw with no image in place

We honestly have no clue whether Microsoft's DocumentPaginator uses an algorithm like that or not, but we think the example above is good enough to demonstrate the complexities created by the introduction of anchored elements.

So, not only is coding for anchored elements extremely complicated, it is actually impossible to do so in the way that the current version of SmartPaginator works. In essence, SmartPaginator goes through a 2 step process:
  1. It renders the entire content as if the content was to fit a single column of infinite height
  2. It "harvests" that content, page by page, duplicating elements like table headers if necessary

Thus, we have made the decision to offer LIMITED support for Figures in the current version of SmartPaginator.

Note: we may, at some point in the future, decide to re-work the basic algorithm used by SmartPaginator. When that happens, we will look at offering full support for Figures again. However, since the main goal of this project is to offer a component that can be used to paginate dynamically generated reports, we believe that limited support for Figures is more than enough.

Figures in SmartPaginator

SmartPaginator will render Figures as part of the Paragraph block. This means that the Figure is treated as part of the paragraph content (and thus affects the paragraph height). Because the Figure is rendered inside the paragraph, the paragraph that owns the Figure is the only element that needs to worry about rendering text around the Figure.

The figure can be Left or Right aligned, in relation to the paragraph. It is always aligned to the Top of the paragraph. The following table describes how each Figure property affects its positioning in SmartPaginator:

Figure2.jpg

The following images compare the rendering of Figures by the Microsoft DocumentPaginator and SmartPaginator:

Figures as rendered by Microsoft's DocumentPaginator:
Figure3.jpg
Figure4.jpg
Figures as rendered by SmartPaginator:
Figure5.jpg
Figure6.jpg

Last edited Jan 6, 2012 at 5:16 AM by fallinor, version 6

Comments

No comments yet.