Tiled rendering or (rendering by coordinates) is the process of rendering CAD drawings (into an image, HTML or PDF) by dividing into square parts and rendering each part (or tile) separately. The advantage of this process is that the amount of memory involved is reduced as compared to rendering the entire document at once. Generally, DWG documents are divided into pages by Model and Layouts, but when the tiled rendering is enabled, only the Model is rendered and every tile composes a separate page.
Before you start rendering by coordinates, you should obtain the overall width and height of the document using the Info method as shown in the code sample below. After you know the width and height, determine the starting point (X and Y coordinates) and the width and the height of the tile (region you want to render). Add the tiles to CadOptions.Tiles list as shown in the sample below. The coordinates start from the bottom left corner of the drawing and have only positive values as shown in the sample picture below.
Overall size of the document is 650px height and 750px width. The selected tile starts at coordinate X: 250 and Y: 100 and has a width 150px, height: 200px,,
You can add as many tiles as you need.
The following code sample demonstrates how to render DWG drawing into an image by dividing into four equal parts.
API Usage
There are steps that usage of GroupDocs.Viewer Cloud consists of:
Upload input document into cloud storage
Render document or get document info
Download rendered document from storage
Steps 1 and 3 are storage operations, please refer to this File API documentation for usage details.
Swagger UI lets you call this REST API directly from the browser.
SDK examples
The API is completely independent of your operating system, database system or development language. We provide and support API SDKs in many development languages in order to make it even easier to integrate. You can see our available SDKs list here.
SDK Examples
// For complete examples and data files, please go to https://github.com/groupdocs-viewer-cloud/groupdocs-viewer-cloud-dotnet-samplesstringMyClientSecret="";// Get Client Id and Client Secret from https://dashboard.groupdocs.cloudstringMyClientId="";// Get Client Id and Client Secret from https://dashboard.groupdocs.cloudvarconfiguration=newConfiguration(MyClientId,MyClientSecret);varinfoApiInstance=newInfoApi(configuration);varviewOptions=newViewOptions{FileInfo=newFileInfo{FilePath="SampleFiles/with_layers_and_layouts.dwg"}};varinfoResponse=infoApiInstance.GetInfo(newGetInfoRequest(viewOptions));// Get width and heightvarwidth=infoResponse.Pages[0].Width.Value;varheight=infoResponse.Pages[0].Height.Value;// Set tile width and height as a half of image total widthvartileWidth=width/2;vartileHeight=height/2;varpointX=0;varpointY=0;*Createimageoptionsandaddfourtiles,oneforeachquarterviewOptions=newViewOptions{FileInfo=newFileInfo{FilePath="SampleFiles/with_layers_and_layouts.dwg"},ViewFormat=ViewOptions.ViewFormatEnum.HTML,RenderOptions=newHtmlOptions{CadOptions=newCadOptions()}};viewOptions.RenderOptions.CadOptions.Tiles=newList<Tile>();vartile=newTile{StartPointX=pointX,StartPointY=pointY,Width=tileWidth,Height=tileHeight};viewOptions.RenderOptions.CadOptions.Tiles.Add(tile);pointX+=tileWidth;tile=newTile{StartPointX=pointX,StartPointY=pointY,Width=tileWidth,Height=tileHeight};viewOptions.RenderOptions.CadOptions.Tiles.Add(tile);pointX=0;pointY+=tileHeight;tile=newTile{StartPointX=pointX,StartPointY=pointY,Width=tileWidth,Height=tileHeight};viewOptions.RenderOptions.CadOptions.Tiles.Add(tile);pointX+=tileWidth;tile=newTile{StartPointX=pointX,StartPointY=pointY,Width=tileWidth,Height=tileHeight};viewOptions.RenderOptions.CadOptions.Tiles.Add(tile);varapiInstance=newViewApi(configuration);varresponse=apiInstance.CreateView(newCreateViewRequest(viewOptions));
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.