margins property
PageSetup.margins property
Returns or sets preset Margins of the page.
@property
def margins(self) -> aspose.words.Margins:
...
@margins.setter
def margins(self, value: aspose.words.Margins):
...
Examples
Shows when to recalculate the page layout of the document.
doc = aw.Document(file_name=MY_DIR + 'Rendering.docx')
# Saving a document to PDF, to an image, or printing for the first time will automatically
# cache the layout of the document within its pages.
doc.save(file_name=ARTIFACTS_DIR + 'Document.UpdatePageLayout.1.pdf')
# Modify the document in some way.
doc.styles.get_by_name('Normal').font.size = 6
doc.sections[0].page_setup.orientation = aw.Orientation.LANDSCAPE
doc.sections[0].page_setup.margins = aw.Margins.MIRRORED
# In the current version of Aspose.Words, modifying the document does not automatically rebuild
# the cached page layout. If we wish for the cached layout
# to stay up to date, we will need to update it manually.
doc.update_page_layout()
doc.save(file_name=ARTIFACTS_DIR + 'Document.UpdatePageLayout.2.pdf')
See Also
- module aspose.words
- class PageSetup