Render DWF layers

Design Web Format File (.dwf) consists of various user layers. Layers represent various parts of the entire drawing, for example, this drawing describes a plan of a building and it’s parts like stairs, walls, doors located in different layers.


Let’s take a sample DWF described above and then we’ll process with GroupDocs.Viewer and compare results.

By default GroupDocs.Viewer renders all layers:

How to view only specific layers

If you want to view only specific layers you can set CadOptions.Layers property of HtmlViewOptions (or PngViewOptions, or JpgViewOptions, orPdfViewOptions) class.

Let’s view only “Doors”, “Stairs”, “Walls” layers, to do that use following code,

using (Viewer viewer = new Viewer("sample.dwf"))
    PngViewOptions viewOptions = new PngViewOptions();

    options.CadOptions.Layers.Add(new Results.Layer("Stairs"));
    options.CadOptions.Layers.Add(new Results.Layer("Walls"));
    options.CadOptions.Layers.Add(new Results.Layer("Doors"));


Now GroupDocs.Viewer will render only these layers: