Export AutoCAD DXF Drawing to PDF & Set Image Size in .NET Applications

This tutorial explains how .NET developers can export DXF Drawings to PDF using Aspose.Imaging for .NET. Aspose.Imaging includes a feature for reading AutoCAD DXF drawing entities and rendering them as an entire drawing into PDF format. It is possible to customize the conversion process to achieve specific results. <br/> We have introduced a new Cad class in the Aspose.Imaging.FileFormats namespace. The Cad class is a family of AutoCAD drawings and since they all share similar schemes, it was decided to adopt a similar object model for the AutoCAD drawings family. To accomplish DXF to PDF export, a new class, PdfOptions, has been introduced to the Aspose.Imaging.ImageOptions namespace.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//your code here... [C# Code Sample]
using Aspose.Imaging.FileFormats.Cad;
using Aspose.Imaging.ImageOptions;
namespace DxfExamples
{
    /// <summary>
    /// Represents test examples for DXF -> PDF export
    /// </summary>
    public class DxfExamples
    {
        /// <summary>
        /// Default export.
        /// </summary>
        public void DefaultExport()
        {
            // Name of the file
            string filename = "Drawing1.dxf";
            // Load an image
            using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(filename))
            {
                // Create options
                PdfOptions pdfOptions = new PdfOptions();
                // Set output file size
                pdfOptions.PageWidth = 800;
                pdfOptions.PageHeight = 600;
                // Export
                image.Save(filename + ".pdf", pdfOptions);
            }
        }
    }
}
//[VB.NET Code Sample]
Imports Aspose.Imaging.FileFormats.Cad
Imports Aspose.Imaging.ImageOptions
Namespace DxfExamples
        ''' <summary>
        ''' Represents test examples for DXF -> PDF export
        ''' </summary>
        Public Class DxfExamples
            ''' <summary>
X

Url: http://www.aspose.com/.net/imaging-component.aspx

Language: C# | User: Sheraz Khan | Created: Apr 2, 2014 | Tags: Convert DXF Drawings to PDF, Export AutoCAD DXF to PDF, Open DXF drawing file, Setting the Image Size, image auto-scaling option, .NET Imaging Convert DXF Drawings to PDF Export AutoCAD DXF to PDF Open DXF drawing file Setting the Image Size image auto-scaling option .NET Imaging