示例#1
0
        public static void Run()
        {
            //ExStart:ExportToPDF
            // The path to the documents directory.
            string MyDir          = Directory.GetCurrentDirectory();
            string sourceFilePath = MyDir + "\\dwg-files\\Bottom_plate.dwg";

            using (Aspose.CAD.Image image = Aspose.CAD.Image.Load(sourceFilePath))
            {
                // Create an instance of CadRasterizationOptions and set its various properties
                Aspose.CAD.ImageOptions.CadRasterizationOptions rasterizationOptions = new Aspose.CAD.ImageOptions.CadRasterizationOptions();
                rasterizationOptions.BackgroundColor = Aspose.CAD.Color.White;
                rasterizationOptions.PageWidth       = 1600;
                rasterizationOptions.PageHeight      = 1600;

                // Create an instance of PdfOptions
                Aspose.CAD.ImageOptions.PdfOptions pdfOptions = new Aspose.CAD.ImageOptions.PdfOptions();
                // Set the VectorRasterizationOptions property
                pdfOptions.VectorRasterizationOptions = rasterizationOptions;

                MyDir = MyDir + "Bottom_plate_out.pdf";
                // Export the DWG to PDF
                image.Save(MyDir, pdfOptions);
            }
            //ExEnd:ExportToPDF
            Console.WriteLine("\nThe DWG file exported successfully to PDF.\nFile saved at " + MyDir);
        }
示例#2
0
        public static void Run()
        {
            //ExStart:SettingAutoLayoutScaling
            // The path to the documents directory.
            string MyDir          = RunExamples.GetDataDir_ConvertingCAD();
            string sourceFilePath = MyDir + "conic_pyramid.dxf";

            using (Aspose.CAD.Image image = Aspose.CAD.Image.Load(sourceFilePath))
            {
                // Create an instance of CadRasterizationOptions and set its various properties
                Aspose.CAD.ImageOptions.CadRasterizationOptions rasterizationOptions = new Aspose.CAD.ImageOptions.CadRasterizationOptions();
                rasterizationOptions.PageWidth  = 1600;
                rasterizationOptions.PageHeight = 1600;

                // Set Auto Layout Scaling
                rasterizationOptions.AutomaticLayoutsScaling = true;

                // Create an instance of PdfOptions
                Aspose.CAD.ImageOptions.PdfOptions pdfOptions = new Aspose.CAD.ImageOptions.PdfOptions();

                // Set the VectorRasterizationOptions property
                pdfOptions.VectorRasterizationOptions = rasterizationOptions;

                MyDir = MyDir + "result_out.pdf";
                //Export the CAD to PDF
                image.Save(MyDir, pdfOptions);
            }
            //ExEnd:SettingAutoLayoutScaling
            Console.WriteLine("\nAuto layout scaling setup successfully.\nFile saved at " + MyDir);
        }
示例#3
0
      public static void Run()
      {
          //ExStart:SearchText
          // The path to the documents directory.
          string MyDir          = RunExamples.GetDataDir_DWGDrawings();
          string sourceFilePath = MyDir + "search.dwg";

          // Load an existing DWG file as CadImage.
          using (Aspose.CAD.FileFormats.Cad.CadImage cadImage = (Aspose.CAD.FileFormats.Cad.CadImage)Aspose.CAD.Image.Load(sourceFilePath))
          {
              // Search for text in the file
              foreach (Aspose.CAD.FileFormats.Cad.CadObjects.CadBaseEntity entity in cadImage.Entities)
              {
                  // Please, note: we iterate through CadText entities here, but some other entities may contain text also, e.g. CadMText and others
                  IterateCADNodes(entity);
              }

              // Search for text on specific layout get all layout names and link each layout with corresponding block with entities
              Aspose.CAD.FileFormats.Cad.CadLayoutDictionary layouts = cadImage.Layouts;
              string[] layoutNames = new string[layouts.Count];
              int      i           = 0;
              foreach (Aspose.CAD.FileFormats.Cad.CadObjects.CadLayout layout in layouts.Values)
              {
                  layoutNames[i++] = layout.LayoutName;
                  System.Console.WriteLine("Layout " + layout.LayoutName + " is found");

                  // Find block, applicable for DWG only
                  Aspose.CAD.FileFormats.Cad.CadTables.CadBlockTableObject blockTableObjectReference = null;
                  foreach (Aspose.CAD.FileFormats.Cad.CadTables.CadBlockTableObject tableObject in cadImage.BlocksTables)
                  {
                      if (string.Equals(tableObject.HardPointerToLayout, layout.ObjectHandle))
                      {
                          blockTableObjectReference = tableObject;
                          break;
                      }
                  }

                  if (blockTableObjectReference != null)
                  {
                      // Collection cadBlockEntity.Entities contains information about all entities on specific layout if this collection has no elements it means layout is a copy of Model layout and contains the same entities
                      Aspose.CAD.FileFormats.Cad.CadObjects.CadBlockEntity cadBlockEntity = cadImage.BlockEntities[blockTableObjectReference.BlockName];
                  }
              }

              //Export to pdf
              Aspose.CAD.ImageOptions.CadRasterizationOptions rasterizationOptions = new Aspose.CAD.ImageOptions.CadRasterizationOptions();
              rasterizationOptions.PageWidth  = 1600;
              rasterizationOptions.PageHeight = 1600;
              rasterizationOptions.AutomaticLayoutsScaling = true;
              //rasterizationOptions.CenterDrawing = true;

              // Please, note: if cadBlockEntity collection mentioned above (for dwg) for selected layout or entitiesOnLayouts collection by layout's BlockTableRecordHandle (for dxf) is empty - export result file will be empty and you should draw Model layout instead
              rasterizationOptions.Layouts = new[] { "Layout1" };

              Aspose.CAD.ImageOptions.PdfOptions pdfOptions = new Aspose.CAD.ImageOptions.PdfOptions();

              pdfOptions.VectorRasterizationOptions = rasterizationOptions;
              cadImage.Save(MyDir + "SearchText_out.pdf", pdfOptions);
          }
      }
示例#4
0
        public static void Run()
        {
            //ExStart:ExportDXFSpecificLayoutToPDF
            // The path to the documents directory.
            string MyDir          = RunExamples.GetDataDir_DXFDrawings();
            string sourceFilePath = MyDir + "conic_pyramid.dxf";

            using (Aspose.CAD.Image image = Aspose.CAD.Image.Load(sourceFilePath))
            {
                // Create an instance of CadRasterizationOptions and set its various properties
                Aspose.CAD.ImageOptions.CadRasterizationOptions rasterizationOptions = new Aspose.CAD.ImageOptions.CadRasterizationOptions();
                rasterizationOptions.PageWidth  = 1600;
                rasterizationOptions.PageHeight = 1600;
                // Specify desired layout name
                rasterizationOptions.Layouts = new string[] { "Model" };

                // Create an instance of PdfOptions
                Aspose.CAD.ImageOptions.PdfOptions pdfOptions = new Aspose.CAD.ImageOptions.PdfOptions();
                // Set the VectorRasterizationOptions property
                pdfOptions.VectorRasterizationOptions = rasterizationOptions;

                MyDir = MyDir + "conic_pyramid_layout_out.pdf";
                // Export the DXF to PDF
                image.Save(MyDir, pdfOptions);
            }
            //ExEnd:ExportDXFSpecificLayoutToPDF
            Console.WriteLine("\nThe DXF file with specific layout exported successfully to PDF.\nFile saved at " + MyDir);
        }
        public static void Run()
        {
            try
            {
                //ExStart:ExportDGNToPdf
                // The path to the documents directory.
                string MyDir          = RunExamples.GetDataDir_ExportingDGN();
                string sourceFilePath = MyDir + "Nikon_D90_Camera.dgn";
                // Load an existing DGN file as CadImage.
                using (Aspose.CAD.FileFormats.Cad.CadImage cadImage = (Aspose.CAD.FileFormats.Cad.CadImage)Aspose.CAD.Image.Load(sourceFilePath))
                {
                    // Create an object of CadRasterizationOptions class and define/set different properties
                    Aspose.CAD.ImageOptions.CadRasterizationOptions rasterizationOptions = new Aspose.CAD.ImageOptions.CadRasterizationOptions();
                    rasterizationOptions.PageWidth               = 600;
                    rasterizationOptions.PageHeight              = 300;
                    rasterizationOptions.CenterDrawing           = true;
                    rasterizationOptions.ScaleMethod             = Aspose.CAD.FileFormats.Cad.ScaleType.None;
                    rasterizationOptions.AutomaticLayoutsScaling = true;

                    // Create an object of PdfOptions class as we are converting the image to PDF format and assign CadRasterizationOptions object to it.
                    Aspose.CAD.ImageOptions.PdfOptions pdfOptions = new Aspose.CAD.ImageOptions.PdfOptions();
                    pdfOptions.VectorRasterizationOptions = rasterizationOptions;

                    // Call the save method of the CadImage class object.
                    cadImage.Save(MyDir + "ExportDGNToPdf_out.pdf", pdfOptions);
                }
                //ExEnd:ExportDGNToPdf
                Console.WriteLine("\nThe DGN file exported successfully to PDF.\nFile saved at " + MyDir);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Please use valid input file." + ex.Message);
            }
        }
        public static void Run()
        {
            //ExStart:ConvertLayoutsToRasterImage
            // The path to the documents directory.
            string MyDir          = RunExamples.GetDataDir_ConvertingCAD();
            string sourceFilePath = MyDir + "conic_pyramid.dxf";

            using (Aspose.CAD.Image image = Aspose.CAD.Image.Load(sourceFilePath))
            {
                // Create an instance of CadRasterizationOptions
                Aspose.CAD.ImageOptions.CadRasterizationOptions rasterizationOptions = new Aspose.CAD.ImageOptions.CadRasterizationOptions();

                // Set page width & height
                rasterizationOptions.PageWidth  = 1200;
                rasterizationOptions.PageHeight = 1200;

                // Specify a list of layout names
                rasterizationOptions.Layouts = new string[] { "Model", "Layout1" };

                // Create an instance of TiffOptions for the resultant image
                ImageOptionsBase options = new Aspose.CAD.ImageOptions.TiffOptions(Aspose.CAD.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);

                // Set rasterization options
                options.VectorRasterizationOptions = rasterizationOptions;

                MyDir = MyDir + "conic_pyramid_layoutstorasterimage_out_.tiff";

                // Save resultant image
                image.Save(MyDir, options);
            }
            //ExEnd:ConvertLayoutsToRasterImage
            Console.WriteLine("\nCAD layouts converted successfully to raster image format.\nFile saved at " + MyDir);
        }
        public static void Run()
        {
            //ExStart:ConvertDrawingToRasterImage
            // The path to the documents directory.
            string MyDir          = RunExamples.GetDataDir_ConvertingCAD();
            string sourceFilePath = MyDir + "conic_pyramid.dxf";

            using (Aspose.CAD.Image image = Aspose.CAD.Image.Load(sourceFilePath))
            {
                // Create an instance of CadRasterizationOptions
                Aspose.CAD.ImageOptions.CadRasterizationOptions rasterizationOptions = new Aspose.CAD.ImageOptions.CadRasterizationOptions();
                // Set page width & height
                rasterizationOptions.PageWidth  = 1200;
                rasterizationOptions.PageHeight = 1200;

                // Create an instance of PngOptions for the resultant image
                ImageOptionsBase options = new Aspose.CAD.ImageOptions.PngOptions();
                //Set rasterization options
                options.VectorRasterizationOptions = rasterizationOptions;

                MyDir = MyDir + "conic_pyramid_raster_image_out_.png";
                // Save resultant image
                image.Save(MyDir, options);
            }
            //ExEnd:ConvertDrawingToRasterImage
            Console.WriteLine("\nCAD drawing converted successfully to raster image format.\nFile saved at " + MyDir);
        }
示例#8
0
        public static void Run()
        {
            //ExStart:ExportDXFToPDF
            // The path to the documents directory.
            string MyDir          = RunExamples.GetDataDir_DXFDrawings();
            string sourceFilePath = MyDir + "DT-00.dxf";//"conic_pyramid.dxf";

            using (Aspose.CAD.Image image = Aspose.CAD.Image.Load(sourceFilePath))
            {
                // Create an instance of CadRasterizationOptions and set its various properties
                Aspose.CAD.ImageOptions.CadRasterizationOptions rasterizationOptions = new Aspose.CAD.ImageOptions.CadRasterizationOptions();
                rasterizationOptions.BackgroundColor = Aspose.CAD.Color.White;
                rasterizationOptions.PageWidth       = 1600;
                rasterizationOptions.PageHeight      = 1600;

                // Create an instance of PdfOptions
                Aspose.CAD.ImageOptions.PdfOptions pdfOptions = new Aspose.CAD.ImageOptions.PdfOptions();
                // Set the VectorRasterizationOptions property
                pdfOptions.VectorRasterizationOptions = rasterizationOptions;

                MyDir = MyDir + "conic_pyramid_out.pdf";
                //Export the DXF to PDF
                image.Save(MyDir, pdfOptions);
            }
            //ExEnd:ExportDXFToPDF
            Console.WriteLine("\nThe DXF drawing exported successfully to PDF.\nFile saved at " + MyDir);
        }
示例#9
0
        public static void Run()
        {
            //ExStart:CADLayersToRasterImageFormats
            // The path to the documents directory.
            string MyDir          = RunExamples.GetDataDir_ConvertingCAD();
            string sourceFilePath = MyDir + "conic_pyramid.dxf";

            // Load a CAD drawing in an instance of Image
            using (var image = Aspose.CAD.Image.Load(sourceFilePath))
            {
                // Create an instance of CadRasterizationOptions
                var rasterizationOptions = new Aspose.CAD.ImageOptions.CadRasterizationOptions();
                // Set image width & height
                rasterizationOptions.PageWidth  = 500;
                rasterizationOptions.PageHeight = 500;

                // Set the drawing to render at the center of image
                rasterizationOptions.CenterDrawing = true;

                // Add the layer name to the CadRasterizationOptions's layer list
                rasterizationOptions.Layers = new string[] { "LayerA" };
                // Create an instance of JpegOptions (or any ImageOptions for raster formats)
                var options = new Aspose.CAD.ImageOptions.JpegOptions();
                // Set VectorRasterizationOptions property to the instance of CadRasterizationOptions
                options.VectorRasterizationOptions = rasterizationOptions;
                //Export each layer to Jpeg format
                MyDir = MyDir + "CADLayersToRasterImageFormats_out.jpg";
                image.Save(MyDir, options);
            }

            Console.WriteLine("\nCAD layers converted successfully to raster image format.\nFile saved at " + MyDir);
        }
示例#10
0
        public static void AutoAdjustingCADDrawingSize()
        {
            // The path to the documents directory.
            string MyDir = RunExamples.GetDataDir_ConvertingCAD();

            string sourceFilePath = MyDir + "sample.dwg";

            // Load a CAD drawing in an instance of Image
            using (var image = Aspose.CAD.Image.Load(sourceFilePath))
            {
                // Create an instance of BmpOptions class
                Aspose.CAD.ImageOptions.BmpOptions bmpOptions = new Aspose.CAD.ImageOptions.BmpOptions();

                // Create an instance of CadRasterizationOptions and set its various properties
                Aspose.CAD.ImageOptions.CadRasterizationOptions cadRasterizationOptions = new Aspose.CAD.ImageOptions.CadRasterizationOptions();
                bmpOptions.VectorRasterizationOptions = cadRasterizationOptions;
                cadRasterizationOptions.CenterDrawing = true;

                // Set the layouts property
                cadRasterizationOptions.Layouts = new string[] { "Model" };

                //Export layout to BMP format
                string outPath = sourceFilePath + ".bmp";
                image.Save(outPath, bmpOptions);
            }

            //ExEnd:AutoAdjustingCADDrawingSize
        }
示例#11
0
        public static void Run()
        {
            //ExStart:ParticularDWGToImage
            string MyDir          = RunExamples.GetDataDir_DWGDrawings();
            string sourceFilePath = MyDir + "visualization_-_conference_room.dwg";
            var    cadImage       = (CadImage)Aspose.CAD.Image.Load(sourceFilePath);

            CadBaseEntity[]      entities         = cadImage.Entities;
            List <CadBaseEntity> filteredEntities = new List <CadBaseEntity>();

            foreach (CadBaseEntity baseEntity in entities)
            {
                // selection or filtration of entities
                if (baseEntity.TypeName == CadEntityTypeName.TEXT)
                {
                    filteredEntities.Add(baseEntity);
                }
            }

            cadImage.Entities = filteredEntities.ToArray();

            // Create an instance of CadRasterizationOptions and set its various properties
            Aspose.CAD.ImageOptions.CadRasterizationOptions rasterizationOptions =
                new Aspose.CAD.ImageOptions.CadRasterizationOptions();
            rasterizationOptions.PageWidth  = 1600;
            rasterizationOptions.PageHeight = 1600;

            // Set Auto Layout Scaling
            rasterizationOptions.AutomaticLayoutsScaling = true;

            // Create an instance of PdfOptions
            Aspose.CAD.ImageOptions.PdfOptions pdfOptions = new Aspose.CAD.ImageOptions.PdfOptions();

            // Set the VectorRasterizationOptions property
            pdfOptions.VectorRasterizationOptions = rasterizationOptions;

            string outFile = MyDir + "result_out_generated.pdf";

            // Export the CAD to PDF
            cadImage.Save(outFile, pdfOptions);

            //ExEnd:ParticularDWGToImage
        }
        public static void ConvertAllLayersToRasterImageFormats()
        {
            //ExStart:ConvertAllLayersToRasterImageFormats
            // The path to the documents directory.
            string MyDir          = RunExamples.GetDataDir_ConvertingCAD();
            string sourceFilePath = MyDir + "conic_pyramid.dxf";

            // Load a CAD drawing in an instance of CadImage
            using (var image = (Aspose.CAD.FileFormats.Cad.CadImage)Aspose.CAD.Image.Load(sourceFilePath))
            {
                // Create an instance of CadRasterizationOptions
                var rasterizationOptions = new Aspose.CAD.ImageOptions.CadRasterizationOptions();
                // Set image width & height
                rasterizationOptions.PageWidth  = 500;
                rasterizationOptions.PageHeight = 500;
                // Set the drawing to render at the center of image
                rasterizationOptions.CenterDrawing = true;

                // Get the layers in an instance of CadLayersDictionary
                var layers = image.Layers;
                // Iterate over the layers
                foreach (var layer in layers.ValuesTyped)
                {
                    // Display layer name for tracking
                    Console.WriteLine("Start with " + layer.Name);

                    // Add the layer name to the CadRasterizationOptions's layer list
                    rasterizationOptions.Layers.Add(layer.Name);

                    // Create an instance of JpegOptions (or any ImageOptions for raster formats)
                    var options = new Aspose.CAD.ImageOptions.JpegOptions();
                    // Set VectorRasterizationOptions property to the instance of CadRasterizationOptions
                    options.VectorRasterizationOptions = rasterizationOptions;
                    // Export each layer to Jpeg format
                    image.Save(layer.Name + "_out_.jpg", options);
                }
            }
            //ExEnd:ConvertAllLayersToRasterImageFormats
            Console.WriteLine("\nCAD all layers converted successfully to raster image format.");
        }
        public static void Run()
        {
            //ExStart:EnableTrackingForCADRendering
            // The path to the documents directory.
            string MyDir          = RunExamples.GetDataDir_ConvertingCAD();
            string sourceFilePath = MyDir + "conic_pyramid.dxf";

            using (Aspose.CAD.Image image = Aspose.CAD.Image.Load(sourceFilePath))
            {
                MemoryStream stream = new MemoryStream();
                Aspose.CAD.ImageOptions.PdfOptions pdfOptions = new Aspose.CAD.ImageOptions.PdfOptions();
                // Create an instance of CadRasterizationOptions and set its various properties
                Aspose.CAD.ImageOptions.CadRasterizationOptions cadRasterizationOptions = new Aspose.CAD.ImageOptions.CadRasterizationOptions();
                pdfOptions.VectorRasterizationOptions = cadRasterizationOptions;
                cadRasterizationOptions.PageWidth     = 800;
                cadRasterizationOptions.PageHeight    = 600;

                image.Save(stream, pdfOptions);
            }
            //ExEnd:EnableTrackingForCADRendering
            Console.WriteLine("\nTracking enabled successfully for CAD rendering process.");
        }
示例#14
0
        public static void Run()
        {
            //ExStart:SupportOfOBJ

            string MyDir = RunExamples.GetDataDir_OBJDrawings();

            using (Aspose.CAD.Image CADDoc = Aspose.CAD.Image.Load(MyDir + "example-580-W.obj"))
            {
                Aspose.CAD.ImageOptions.CadRasterizationOptions rasterizationOptions =
                    new Aspose.CAD.ImageOptions.CadRasterizationOptions();

                rasterizationOptions.PageWidth  = CADDoc.Size.Width;
                rasterizationOptions.PageHeight = CADDoc.Size.Height;

                Aspose.CAD.ImageOptions.PdfOptions CADf = new Aspose.CAD.ImageOptions.PdfOptions();
                CADf.VectorRasterizationOptions = rasterizationOptions;

                CADDoc.Save(MyDir + "example-580-W_custom.pdf", CADf);
            }

            //ExEnd:SupportOfOBJ
        }
示例#15
0
        public static void Run()
        {
            //ExStart:ExportSpecificDXFLayoutToImage

            // The path to the documents directory.
            string MyDir          = RunExamples.GetDataDir_DXFDrawings();
            string sourceFilePath = MyDir + "for_layers_test.dwf";

            using (var image = (Aspose.CAD.FileFormats.Cad.CadImage)Aspose.CAD.Image.Load(sourceFilePath))
            {
                // Create an instance of CadRasterizationOptions
                var rasterizationOptions = new Aspose.CAD.ImageOptions.CadRasterizationOptions();
                // Set image width & height
                rasterizationOptions.PageWidth  = 500;
                rasterizationOptions.PageHeight = 500;
                // Set the drawing to render at the center of image
                // rasterizationOptions.CenterDrawing = true;

                // Get the layers in an instance of CadLayersDictionary
                var layersList = image.Layers;
                // Iterate over the layers
                foreach (var layerName in layersList.GetLayersNames())
                {
                    // Display layer name for tracking
                    Console.WriteLine("Start with " + layerName);

                    // Add the layer name to the CadRasterizationOptions's layer list
                    rasterizationOptions.Layers = new string[] { "LayerA" };
                    // Create an instance of JpegOptions (or any ImageOptions for raster formats)
                    var options = new Aspose.CAD.ImageOptions.JpegOptions();
                    // Set VectorRasterizationOptions property to the instance of CadRasterizationOptions
                    options.VectorRasterizationOptions = rasterizationOptions;
                    //Export each layer to Jpeg format
                    image.Save(layerName + "_out.jpg", options);
                }
            }
            //ExEnd:ExportSpecificDXFLayoutToImage
        }
示例#16
0
        public static void Run()
        {
            //ExStart:SettingCanvasSizeAndMode
            // The path to the documents directory.
            string MyDir          = RunExamples.GetDataDir_ConvertingCAD();
            string sourceFilePath = MyDir + "conic_pyramid.dxf";

            using (Aspose.CAD.Image image = Aspose.CAD.Image.Load(sourceFilePath))
            {
                // Create an instance of CadRasterizationOptions and set its various properties
                Aspose.CAD.ImageOptions.CadRasterizationOptions rasterizationOptions = new Aspose.CAD.ImageOptions.CadRasterizationOptions();
                rasterizationOptions.PageWidth  = 1600;
                rasterizationOptions.PageHeight = 1600;
                rasterizationOptions.AutomaticLayoutsScaling = true;
                rasterizationOptions.NoScaling = false;

                // Create an instance of PdfOptions
                Aspose.CAD.ImageOptions.PdfOptions pdfOptions = new Aspose.CAD.ImageOptions.PdfOptions();

                // Set the VectorRasterizationOptions property
                pdfOptions.VectorRasterizationOptions = rasterizationOptions;

                //Export CAD to PDF
                image.Save(MyDir + "result_out.pdf", pdfOptions);

                // Create an instance of TiffOptions
                Aspose.CAD.ImageOptions.TiffOptions tiffOptions = new Aspose.CAD.ImageOptions.TiffOptions(Aspose.CAD.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);

                // Set the VectorRasterizationOptions property
                tiffOptions.VectorRasterizationOptions = rasterizationOptions;

                //Export CAD to TIFF
                image.Save(MyDir + "result_out.tiff", tiffOptions);
            }
            //ExEnd:SettingCanvasSizeAndMode
            Console.WriteLine("\nCanvas size and mode setup successfully.");
        }
示例#17
0
        public static void Run()
        {
            //ExStart:SettingBackgroundAndDrawingColors
            // The path to the documents directory.
            string MyDir          = RunExamples.GetDataDir_ConvertingCAD();
            string sourceFilePath = MyDir + "conic_pyramid.dxf";

            using (Aspose.CAD.Image image = Aspose.CAD.Image.Load(sourceFilePath))
            {
                // Create an instance of CadRasterizationOptions and set its various properties
                Aspose.CAD.ImageOptions.CadRasterizationOptions rasterizationOptions = new Aspose.CAD.ImageOptions.CadRasterizationOptions();
                rasterizationOptions.PageWidth       = 1600;
                rasterizationOptions.PageHeight      = 1600;
                rasterizationOptions.BackgroundColor = Aspose.CAD.Color.Beige;
                rasterizationOptions.DrawType        = Aspose.CAD.FileFormats.Cad.CadDrawTypeMode.UseDrawColor;
                rasterizationOptions.DrawColor       = Aspose.CAD.Color.Blue;

                // Create an instance of PdfOptions
                Aspose.CAD.ImageOptions.PdfOptions pdfOptions = new Aspose.CAD.ImageOptions.PdfOptions();
                // Set the VectorRasterizationOptions property
                pdfOptions.VectorRasterizationOptions = rasterizationOptions;

                //Export CAD to PDF
                image.Save(MyDir + "result_out.pdf", pdfOptions);

                // Create an instance of TiffOptions
                Aspose.CAD.ImageOptions.TiffOptions tiffOptions = new Aspose.CAD.ImageOptions.TiffOptions(Aspose.CAD.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);

                // Set the VectorRasterizationOptions property
                tiffOptions.VectorRasterizationOptions = rasterizationOptions;

                //Export CAD to TIFF
                image.Save(MyDir + "result_out.tiff", tiffOptions);
            }
            //ExEnd:SettingBackgroundAndDrawingColors
            Console.WriteLine("\nBackground and drawing colors setup successfully.");
        }
        private List <string> GetDocumentPages(string file, string folderName, int currentPage)
        {
            List <string> lstOutput   = new List <string>();
            string        outfileName = "page_{0}";
            string        outPath     = Config.Configuration.OutputDirectory + folderName + "/" + outfileName;

            currentPage = currentPage - 1;
            Directory.CreateDirectory(Config.Configuration.OutputDirectory + folderName);
            string imagePath = string.Format(outPath, currentPage) + ".jpeg";

            if (System.IO.File.Exists(imagePath) && currentPage > 0)
            {
                lstOutput.Add(imagePath);
                return(lstOutput);
            }

            int i = currentPage;

            var filename = System.IO.File.Exists(Config.Configuration.WorkingDirectory + folderName + "/" + file)
                                ? Config.Configuration.WorkingDirectory + folderName + "/" + file
                                : Config.Configuration.OutputDirectory + folderName + "/" + file;

            using (FilePathLock.Use(filename))
            {
                try
                {
                    Aspose.CAD.Live.Demos.UI.Models.License.SetAsposeCADLicense();


                    // Load an existing CAD document
                    Aspose.CAD.FileFormats.Cad.CadImage image = (Aspose.CAD.FileFormats.Cad.CadImage)Aspose.CAD.Image.Load(filename);

                    // Create an instance of CadRasterizationOptions
                    Aspose.CAD.ImageOptions.CadRasterizationOptions rasterizationOptions = new Aspose.CAD.ImageOptions.CadRasterizationOptions();

                    // Set image width & height
                    rasterizationOptions.PageWidth  = 1024;
                    rasterizationOptions.PageHeight = 1024;
                    // Set the drawing to render at the center of image
                    //rasterizationOptions.CenterDrawing = true;
                    //rasterizationOptions.TypeOfEntities = Aspose.CAD.ImageOptions.TypeOfEntities.Entities3D;

                    rasterizationOptions.AutomaticLayoutsScaling = true;
                    rasterizationOptions.NoScaling       = false;
                    rasterizationOptions.ContentAsBitmap = true;

                    // Set Graphics options
                    rasterizationOptions.GraphicsOptions.SmoothingMode     = Aspose.CAD.SmoothingMode.HighQuality;
                    rasterizationOptions.GraphicsOptions.TextRenderingHint = Aspose.CAD.TextRenderingHint.AntiAliasGridFit;
                    rasterizationOptions.GraphicsOptions.InterpolationMode = Aspose.CAD.InterpolationMode.HighQualityBicubic;


                    // Get the layers in an instance of CadLayersDictionary
                    var layersList = image.Layers;
                    lstOutput.Add(layersList.Count.ToString());
                    i = 0;
                    // Iterate over the layers
                    foreach (var layerName in layersList.GetLayersNames())
                    {
                        if (i == currentPage)
                        {
                            // Add the layer name to the CadRasterizationOptions's layer list
                            rasterizationOptions.Layers[i] = layerName;

                            // Create an instance of PngOptions for the resultant image
                            Aspose.CAD.ImageOptions.JpegOptions options = new Aspose.CAD.ImageOptions.JpegOptions();

                            // Set rasterization options
                            options.VectorRasterizationOptions = rasterizationOptions;
                            image.Save(imagePath, options);
                            lstOutput.Add(imagePath);
                            image.Dispose();
                            break;
                        }
                        i++;
                    }
                    if (!image.Disposed)
                    {
                        image.Dispose();
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                return(lstOutput);
            }
        }