We're using Aspose.Pdf.Generator to create custom PDFs with rectangles and text among other things. This works fine.
When I save the PDF as PPTX, the output looks OK, but the rectangles are output as a single image, while the text is maintained in text format.
I imagine some may prefer this, but we have an issue with this.
We need to be able to stretch and move the output on the slides such that the text transforms with the same proportions as the rectangles.
Currently, while re-sizing the rectangles, the text will attempt to word-wrap, maintains font-size, etc (see attached "ppt_test.pptx").
Is there any way to control how text is converted as part of the PPTX conversion?
Is there anything I can do different in the PDF.Generator code to make sure the text will convert differently?
I have tried saving the pages of the PDF as images, and then adding them back in, but something is not working right (see attached "ppt-test-image.pptx").
This is the code with commented attempts I've tried:
var doc = new Document(sourcePath);var doc = new Document(fileStream);//convert page to an image and add back to help with PPT conversionvar jpegDevice = new JpegDevice(new Resolution(300), 100);foreach (Page page in doc.Pages)
{// var page = doc.Pages[1]; var imageStream = new MemoryStream();// var imageStream = new FileStream(@"C:\Development\Practice\AsposePDF\AsposePdfPractice\page.jpg", FileMode.Create);jpegDevice.Process(page, imageStream);// imageStream.Close();// var image = new Image();// page.Paragraphs.Add(image);// image.ImageStream = imageStream;page.AddImage(imageStream, page.CropBox);// page.AddImage(@"C:\Development\Practice\AsposePDF\AsposePdfPractice\page.jpg", page.CropBox);imageStream.Close();
}doc.Save(filePath, new PptxSaveOptions());// imageStream.Close();
Also, since some pages in our final PDF will have pages with just text (that we don't want to convert to images), it might be easier to handle this issue in the PDF generation code, rather than trying to extract out certain pages from the PDF to create images (unless there's an easy way to check for IDs or elements to filter out the pages we need).
Recap:
We're creating the PDF.
We want to convert the PDF into PPTX.
We want the PPTX to have a single image per slide so it can be stretched.
We want to be able to select identifiable Pages from PDF to convert into images in PPTX.
We want to be able to use streams as much as possible since we're running in a web context.
Do you have any suggestions?
Thanks,
Joey