We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Converting SVG file to PDF - now want to rotate PDF from Portrait to Landscape

Very simple conversion of SVG output to pdf file. However, it defaults to a portrait orientation. Is there a simple way to change the orientation to landscape?

// create and tune conversion options

Aspose.Pdf.

SvgLoadOptions options = new SvgLoadOptions();

options.ConversionEngine = Aspose.Pdf.

SvgLoadOptions.ConversionEngines.NewEngine;

// load PDF document from SVG

Aspose.Pdf.

Document pdfDocument = new Aspose.Pdf.Document(mydir + "assembly.svg", options);

pdfDocument.PageLayout.IsLandscape =

"True";

// Save PDF document

pdfDocument.Save(mydir +

"assembly.pdf");

// create and tune conversion options

Aspose.Pdf.

SvgLoadOptions options = new SvgLoadOptions();

options.ConversionEngine = Aspose.Pdf.

SvgLoadOptions.ConversionEngines.NewEngine;

// load PDF document from SVG

Aspose.Pdf.

Document pdfDocument = new Aspose.Pdf.Document(mydir + "assembly.svg", options);

pdfDocument.PageLayout.IsLandscape =

"True";

// Save PDF document

pdfDocument.Save(mydir +

"assembly.pdf");

Hi Jim,


Thanks for using our API’s.

In order to accomplish your requirements, please try using following code snippet. In case you encounter any issue, please share the resource files, so that we can test the scenario in our environment.

[C#]

//
create and tune conversion options
<o:p></o:p>

Aspose.Pdf.SvgLoadOptions svgoptions = new SvgLoadOptions();

// svgoptions.ConversionEngine = Aspose.Pdf.SvgLoadOptions.ConversionEngines.NewEngine;

// load PDF document from SVG

Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(@"C:\pdftest\img_04.svg", svgoptions);

// pdfDocument.Pages[1].PageInfo.IsLandscape =true;

// Save PDF document

// pdfDocument.Save(@"C:\pdftest\img_04_Converted.pdf");

PdfPageEditor ppe = new PdfPageEditor();

ppe.BindPdf(pdfDocument);

Aspose.Pdf.PageSize ps = new Aspose.Pdf.PageSize(421, 595);

ps.IsLandscape = true;

ppe.PageSize = ps;

ppe.Save(@"C:\pdftest\img_04_Landscape.pdf");