Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
GroupDocs.Viewer for .NET 18.1
// For complete examples and data files, please go to https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-.NET
// Setup GroupDocs.Viewer config
ViewerConfig config = Utilities.GetConfigurations();
// Create image handler
ViewerImageHandler imageHandler = new ViewerImageHandler(config);
string guid = DocumentName;
// Get document info
CadDocumentInfoContainer documentInfo = (CadDocumentInfoContainer)imageHandler.GetDocumentInfo(guid);
// Loop through all layers contained in the drawing
foreach (var layer in documentInfo.Layers)
Console.WriteLine("Layer name: {0}", layer.Name);
// For complete examples and data files, please go to https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-.NET
// Get Configurations
ViewerConfig config = Utilities.GetConfigurations();
// Create html handler
ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler(config);
string guid = DocumentName;
// Set default font
HtmlOptions options = new HtmlOptions();
options.DefaultFontName = "Calibri";
// Get pages
List<PageHtml> pages = htmlHandler.GetPages(guid, options);
foreach (PageHtml page in pages)
{
//Save each page at disk
Utilities.SaveAsHtml(page.PageNumber + "_" + DocumentName, page.HtmlContent);
}
// For complete examples and data files, please go to https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-.NET
// Get Configurations
ViewerConfig config = Utilities.GetConfigurations();
// Create html handler
ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler(config);
string guid = DocumentName;
// Instantiate HtmlOptions object and set RenderNotes property
HtmlOptions options = new HtmlOptions();
options.SlidesOptions.RenderNotes = true; // Default value is false
// Get document pages in Html form
List<PageHtml> pages = htmlHandler.GetPages(guid, options);
foreach (PageHtml page in pages)
{
//Save each page at disk
Utilities.SaveAsHtml(page.PageNumber + "_" + DocumentName, page.HtmlContent);
}
// For complete examples and data files, please go to https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-.NET
// Get Configurations
ViewerConfig config = Utilities.GetConfigurations();
// Create html handler
ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler(config);
string guid = DocumentName;
// Set CAD options to render specific layers
HtmlOptions options = new HtmlOptions();
options.CadOptions.Layers.Add("electrical");
options.CadOptions.Layers.Add("walls");
// Get pages
List<PageHtml> pages = htmlHandler.GetPages(guid, options);
foreach (PageHtml page in pages)
{
//Save each page at disk
Utilities.SaveAsHtml(page.PageNumber + "_" + DocumentName, page.HtmlContent);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.