Free Support Forum -

Where to find the demo code for ppt2pdf

I can not find it , can someone point it to me ,thanks !

Dear skyrunner,

Thank you for using Aspose.Slides.

If you are Aspose.Slides for JAVA user, then you can take advantage of Slide.saveToSVG method. This method saves the slide into SVG format, which you then insert into your PDF using iText + Batik library.



Below is the code example to save slide to SVG format.



//Instantiate a Presentation object that represents a PPT file

Presentation pres = new Presentation(new FileInputStream(new File("demo.ppt")));

//Accessing a slide using its slide position

Slide slide = pres.getSlideByPosition(1);

//Saving to SVG format

FileOutputStrem fout=

slid.saveToSVG(new FileOutputStrem(new File("c:\\SlideImage.svg")));


catch(Exception ex)




For adding the SVG to your PDF document, please see this code, which I took from this post.

PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("image.test.pdf"));;

int width = 800;

int height = 600;

PdfContentByte cb = writer.getDirectContent();

PdfTemplate template = cb.createTemplate(width,height);

Graphics2D g2 = template.createGraphics(width,height);

PrintTranscoder prm = new PrintTranscoder();

TranscoderInput ti = new TranscoderInput("520.svg");

prm.transcode(ti, null);

PageFormat pg = new PageFormat();

Paper pp= new Paper();

// bunch of paper options here

ImgTemplate img = new ImgTemplate(template);



If you are Aspose.Slides for .NET user, then you can take the slide image and insert into your PDF document using Aspose.PDF

For a code example of taking Slide Image, see this link

For inserting image in PDF document using Aspose.PDF, please see this link