displayBackgroundShape property

ViewOptions.displayBackgroundShape property

Controls display of the background shape in print layout view.

get displayBackgroundShape(): boolean

Examples

Shows how to hide/display document background images in view options.

// Use an HTML string to create a new document with a flat background color.
const html = 
`<html>
  <body style='background-color: blue'>
    <p>Hello world!</p>
  </body>
</html>`;

let doc = new aw.Document(Buffer.from(html));

// The source for the document has a flat color background,
// the presence of which will set the "DisplayBackgroundShape" flag to "true".
expect(doc.viewOptions.displayBackgroundShape).toEqual(true);

// Keep the "DisplayBackgroundShape" as "true" to get the document to display the background color.
// This may affect some text colors to improve visibility.
// Set the "DisplayBackgroundShape" to "false" to not display the background color.
doc.viewOptions.displayBackgroundShape = displayBackgroundShape;

doc.save(base.artifactsDir + "ViewOptions.displayBackgroundShape.docx");

See Also