save method

save(output_stream)

Saves the current fallback settings to stream.

def save(self, output_stream: io.BytesIO):
    ...
ParameterTypeDescription
output_streamio.BytesIOOutput stream.

save(file_name)

Saves the current fallback settings to file.

def save(self, file_name: str):
    ...
ParameterTypeDescription
file_namestrOutput file name.

Examples

Shows how to load and save font fallback settings to/from a stream.

doc = aw.Document(MY_DIR + 'Rendering.docx')
# Load an XML document that defines a set of font fallback settings.
with open(MY_DIR + 'Font fallback rules.xml', 'rb') as font_fallback_stream:
    font_settings = aw.fonts.FontSettings()
    font_settings.fallback_settings.load(font_fallback_stream)
    doc.font_settings = font_settings
doc.save(ARTIFACTS_DIR + 'FontSettings.load_font_fallback_settings_from_stream.pdf')
# Use a stream to save our document's current font fallback settings as an XML document.
with open(ARTIFACTS_DIR + 'FallbackSettings.xml', 'wb') as font_fallback_stream:
    doc.font_settings.fallback_settings.save(font_fallback_stream)

Shows how to load and save font fallback settings to/from an XML document in the local file system.

doc = aw.Document(file_name=MY_DIR + 'Rendering.docx')
# Load an XML document that defines a set of font fallback settings.
font_settings = aw.fonts.FontSettings()
font_settings.fallback_settings.load(file_name=MY_DIR + 'Font fallback rules.xml')
doc.font_settings = font_settings
doc.save(file_name=ARTIFACTS_DIR + 'FontSettings.LoadFontFallbackSettingsFromFile.pdf')
# Save our document's current font fallback settings as an XML document.
doc.font_settings.fallback_settings.save(file_name=ARTIFACTS_DIR + 'FallbackSettings.xml')

See Also