Skip to content

Instantly share code, notes, and snippets.

@aspose-cad-gists
Last active February 15, 2023 11:10

Revisions

  1. aspose-cad-gists revised this gist Feb 15, 2023. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions DWG-to-PDF.md
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,10 @@
    Learn how to convert DWG to PDF: /cad/convert-dwg-to-pdf-online/
    Learn how to convert DWG to PDF: https://blog.aspose.com/cad/convert-dwg-to-pdf-online/

    The following topics are covered in this article:

    1. Convert DWG to PDF Online
    2. Online DWG to PDF Converter - Developer’s Guide
    3. DWG to PDF in C#
    4. Convert DWG file to PDF in Java
    5. DWG to PDF in Python
    6. Convert DWG to PDF Online - Cloud API
    5. Convert DWG to PDF Online - Cloud API
    6. Learning Resources
  2. aspose-cad-gists created this gist Feb 15, 2023.
    10 changes: 10 additions & 0 deletions DWG-to-PDF.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    Learn how to convert DWG to PDF: /cad/convert-dwg-to-pdf-online/

    The following topics are covered in this article:

    1. Convert DWG to PDF Online
    2. Online DWG to PDF Converter - Developer’s Guide
    3. DWG to PDF in C#
    4. Convert DWG file to PDF in Java
    5. DWG to PDF in Python
    6. Convert DWG to PDF Online - Cloud API
    20 changes: 20 additions & 0 deletions DWG-to-PDF_CSharp.cs
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    // This code example demonstrates how to convert DWG to PDF in C#
    // Load DWG file in an instance of Image via its Load method
    using (var image = Image.Load("C:\\Files\\Sample.dwg"))
    {
    // Create an instance of CadRasterizationOptions and set page height and width
    var rasterizationOptions = new Aspose.CAD.ImageOptions.CadRasterizationOptions()
    {
    PageWidth = 1600,
    PageHeight = 1600
    };

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

    // Set the VectorRasterizationOptions property as CadRasterizationOptions
    options.VectorRasterizationOptions = rasterizationOptions;

    // Export DWG to PDF
    image.Save("C:\\Files\\output.pdf", options);
    }
    18 changes: 18 additions & 0 deletions DWG-to-PDF_Java.java
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    // This code example demonstrates how to convert DWG to PDF in Java
    // Load DWG file in an instance of Image via its Load method
    com.aspose.cad.Image objImage = com.aspose.cad.Image.load("C:\\Files\\Sample.dwg");

    // Create an instance of CadRasterizationOptions and set its various properties
    CadRasterizationOptions rasterizationOptions = new CadRasterizationOptions();
    rasterizationOptions.setBackgroundColor(Color.getWhite());
    rasterizationOptions.setPageWidth(1600);
    rasterizationOptions.setPageHeight(1600);

    // Create an instance of PdfOptions
    PdfOptions pdfOptions = new PdfOptions();

    // Set the VectorRasterizationOptions property
    pdfOptions.setVectorRasterizationOptions(rasterizationOptions);

    // Export the DWG to PDF
    objImage.save("C:\\Files\\Sample_out.pdf", pdfOptions);