Convert Specific Pdf Page

Hello,

I do see SaveOptions which can be used to export PDF (all pages) to HTML / SVG. However I wish to know if there is option to specify a page also?

It does create multiple files on disk. But I want to know option where to specify a Page[x] and get resulting (exported) HTML or SVG as Stream (for that pdf page only).

Thanks,
Jay

Hi Jay,


Thanks for contacting support.

You can specify the particular page of PDF using Page page = pdfDocument.pages[1]; code line or you may consider creating a temporary PDF document of single page and perform required conversion/manipulation. For more information, please visit Get a Particular Page of the PDF File

In the event of any further query, please feel free to contact.

Hello,

I would avoid creating a temp PDF. Please guide what change is required to specify a page in below:

Document pdfDocument = new Document(@“test.pdf”);

Aspose.Pdf.SvgSaveOptions saveOptions = new Aspose.Pdf.SvgSaveOptions();

// do not compress SVG image to Zip archive
saveOptions.CompressOutputToZipArchive = false;

// resultant file name
string outFileName = @“TestReport.svg”;

// save the output in SVG files
pdfDocument.Save(outFileName, saveOptions);

Thanks,
Jay

Hi Jay,


The file format conversion feature is performed over document/complete file level. However you may consider using following code snippet to convert only first page of source file to SVG format.

[C#]

Document pdfDocument = new Document(@“c:/pdftest/ChartsandGraphs.pdf”);<o:p></o:p>

Document tempdoc = new Document();

tempdoc.Pages.Add(pdfDocument.Pages[1]);

Aspose.Pdf.SvgSaveOptions saveOptions = new Aspose.Pdf.SvgSaveOptions();

// do not compress SVG image to Zip archive

saveOptions.CompressOutputToZipArchive = false;

// resultant file name

string outFileName = @"c:/pdftest/ChartsandGraphs.svg";

// save the output in SVG files

tempdoc.Save(outFileName, saveOptions);