for_rendering_by_width method

for_rendering_by_width

Initializes an instance of the CadOptions class for rendering by width.

def for_rendering_by_width(cls, width):
    ...
Parameter Type Description
width int The width of the output result (in pixels).

Returns: CadOptions: New instance of the CadOptions class for rendering by width.

Raises Description
ValueError If width is less than or equal to zero.

Example

from groupdocs.viewer import Viewer
from groupdocs.viewer.options import HtmlViewOptions, CadOptions

def enable_performance_mode():
    # Load CAD file
    with Viewer("sample.dwg") as viewer:
        view_options = HtmlViewOptions.for_embedded_resources(
            "enable_performance_mode/Output-Page#{0}.html"
        )
        view_options.cad_options = CadOptions.for_rendering_by_width(1000)
        view_options.cad_options.enable_performance_conversion_mode = True
        viewer.view(view_options)

if __name__ == "__main__":
    enable_performance_mode()

See Also