Last active
          October 24, 2022 06:18 
        
      - 
      
 - 
        
Save aspose-com-kb/32ee9981addbff3816684c8cf4da35d1 to your computer and use it in GitHub Desktop.  
    Code to Convert DGN to JPG in C#. For more details: https://kb.aspose.com/cad/net/how-to-convert-dgn-to-jpg-in-csharp/
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | using System; | |
| using Aspose.CAD; | |
| namespace AsposeProjects | |
| { | |
| class Program | |
| { | |
| static void Main(string[] args) // Main function to convert DGN to JPG in C# | |
| { | |
| // Initialize license | |
| License lic = new License(); | |
| lic.SetLicense("Aspose.Total.lic"); | |
| // Load the DGN file. | |
| using (Aspose.CAD.FileFormats.Dgn.DgnImage dgnImage = (Aspose.CAD.FileFormats.Dgn.DgnImage)Aspose.CAD.Image.Load("input.dgn")) | |
| { | |
| // Create an object of DgnRasterizationOptions | |
| Aspose.CAD.ImageOptions.CadRasterizationOptions rasterizationOptions = new Aspose.CAD.ImageOptions.CadRasterizationOptions(); | |
| rasterizationOptions.PageWidth = 600; | |
| rasterizationOptions.PageHeight = 300; | |
| rasterizationOptions.NoScaling = true; | |
| rasterizationOptions.AutomaticLayoutsScaling = false; | |
| // Create JpegOptions class object | |
| Aspose.CAD.ImageOptionsBase options = new Aspose.CAD.ImageOptions.JpegOptions(); | |
| options.VectorRasterizationOptions = rasterizationOptions; | |
| // Call Save method | |
| dgnImage.Save("DGNToJPG.jpg", options); | |
| } | |
| Console.WriteLine("Done"); | |
| } | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment