Skip to content

Instantly share code, notes, and snippets.

@GroupDocsGists
Last active January 11, 2019 13:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GroupDocsGists/6e932cfd172fab3553e4938bb67c9b64 to your computer and use it in GitHub Desktop.
Save GroupDocsGists/6e932cfd172fab3553e4938bb67c9b64 to your computer and use it in GitHub Desktop.
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