SVG Drawings

Exporting SVG Format To PDF

Aspose.CAD for Python allows developers to export an SVG file to PDF format. SVG to PDF conversion approach works as follows:

  1. Load SVG drawing file using the Image.load factory method.
  2. Create an object of the CadRasterizationOptions class and set the page_height & page_width properties.
  3. Create an object of the PdfOptions class and set the VectorRasterizationOptions property.
  4. Call Image.save while passing an object of PdfOptions as the second parameter.

Sample Code

import aspose.cad as cad;
cadImage = cad.Image.load("file.svg");
rasterizationOptions = cad.imageoptions.CadRasterizationOptions()
rasterizationOptions.page_width = 1200
rasterizationOptions.page_height = 1200
pdfOptions = cad.imageoptions.PdfOptions()
pdfOptions.vector_rasterization_options = rasterizationOptions
cadImage.save("result.pdf", pdfOptions)