LayoutOptions class

LayoutOptions class

Holds the options that allow controlling the document layout process. To learn more, visit the Converting to Fixed-page Format documentation article.

Remarks

You do not create instances of this class directly. Use the Document.layout_options property to access layout options for this document.

Note that after changing any of the options present in this class, Document.update_page_layout() method should be called in order for the changed options to be applied to the layout.

Constructors

NameDescription
LayoutOptions()The default constructor.

Properties

NameDescription
callbackGets or sets IPageLayoutCallback implementation used by page layout model.
comment_display_modeGets or sets the way comments are rendered. Default value is CommentDisplayMode.SHOW_IN_BALLOONS.
continuous_section_page_numbering_restartGets or sets the mode of behavior for computing page numbers when a continuous section restarts the page numbering.
ignore_printer_metricsGets or sets indication of whether the “Use printer metrics to lay out document” compatibility option is ignored. Default is True.
keep_original_font_metricsGets or sets an indication of whether the original font metrics should be used after font substitution. Default is True.
revision_optionsGets revision options.
show_hidden_textGets or sets indication of whether hidden text in the document is rendered. Default is False.
show_paragraph_marksGets or sets indication of whether paragraph marks are rendered. Default is False.
text_shaper_factoryGets or sets ITextShaperFactory implementation used for Advanced Typography rendering features.

Examples

Shows how to alter the appearance of revisions in a rendered output document.

doc = aw.Document()
builder = aw.DocumentBuilder(doc)

# Insert a revision, then change the color of all revisions to green.
builder.writeln("This is not a revision.")
doc.start_track_revisions("John Doe", datetime.now())
builder.writeln("This is a revision.")
doc.stop_track_revisions()
builder.writeln("This is not a revision.")

# Remove the bar that appears to the left of every revised line.
doc.layout_options.revision_options.inserted_text_color = aw.layout.RevisionColor.BRIGHT_GREEN
doc.layout_options.revision_options.show_revision_bars = False

doc.save(ARTIFACTS_DIR + "Document.layout_options_revisions.pdf")

Shows how to hide text in a rendered output document.

doc = aw.Document()
builder = aw.DocumentBuilder(doc)

# Insert hidden text, then specify whether we wish to omit it from a rendered document.
builder.writeln("This text is not hidden.")
builder.font.hidden = True
builder.writeln("This text is hidden.")

doc.layout_options.show_hidden_text = show_hidden_text

doc.save(ARTIFACTS_DIR + "Document.layout_options_hidden_text.pdf")

Shows how to show paragraph marks in a rendered output document.

doc = aw.Document()
builder = aw.DocumentBuilder(doc)

# Add some paragraphs, then enable paragraph marks to show the ends of paragraphs
# with a pilcrow (¶) symbol when we render the document.
builder.writeln("Hello world!")
builder.writeln("Hello again!")

doc.layout_options.show_paragraph_marks = show_paragraph_marks

doc.save(ARTIFACTS_DIR + "Document.layout_options_paragraph_marks.pdf")

See Also