Hello Aspose Team,
We are currently evaluating Aspose PDF with Aspose Slides, in order to convert a Powerpoint to HTML, and then back to Powerpoint. We are converting a powerpoint to PDF, from PDF to HTML. We edit parts of the HTML within our application, and then we convert it to PDF using Aspose PDF, and save it back as Powerpoint.
Our issue is that the result HTML file is slight different from the original Powerpoint file after the conversion, and when we convert it back to Powerpoint, the charts are looking bad.
Please find attached, a zip file with the original PPTX file, the resulted PDF, HTML and PPTX files.
Please let us know if we can reach our goal with Aspose PDF and Slides.
Below code samples we use to convert PPTX to HTML, and then HTML to PPTX.
PPTX -> HTML
using (var pres = new Presentation(file))
{
ISlide slide = pres.Slides[0];
var result1 = sdlg.ShowDialog();
if (result1.Value)
{
PdfOptions pdOpts = new PdfOptions
{
SaveMetafilesAsPng = true,
};
MemoryStream stream = new MemoryStream();
var pdf = @"…\PDFFromHtml.pdf";
pres.Save(pdf, Aspose.Slides.Export.SaveFormat.Pdf, pdOpts);
using (Document doc = new Document(pdf))
{
HtmlSaveOptions hso = new HtmlSaveOptions()
{
HtmlMarkupGenerationMode = HtmlSaveOptions.HtmlMarkupGenerationModes.WriteAllHtml,
DocumentType = HtmlDocumentType.Html5,
FontSavingMode = HtmlSaveOptions.FontSavingModes.SaveInAllFormats,
FixedLayout = true,
RasterImagesSavingMode = HtmlSaveOptions.RasterImagesSavingModes.AsExternalPngFilesReferencedViaSvg,
PartsEmbeddingMode = HtmlSaveOptions.PartsEmbeddingModes.NoEmbedding,
RemoveEmptyAreasOnTopAndBottom = true,
PagesFlowTypeDependsOnViewersScreenSize = false,
LettersPositioningMethod = HtmlSaveOptions.LettersPositioningMethods.UseEmUnitsAndCompensationOfRoundingErrorsInCss,
SaveTransparentTexts = true,
SaveShadowedTextsAsTransparentTexts = true,
};
doc.Save(sdlg.FileName, hso);
}
}
}
HTML -> PPTX
HtmlLoadOptions htmloptions = new HtmlLoadOptions(dataDir);
htmloptions.PageInfo = new PageInfo { IsLandscape = Aspose.Pdf.PageSize.A4.IsLandscape = true, Height = Aspose.Pdf.PageSize.A4.Height - 55, Margin = new Aspose.Pdf.MarginInfo { Bottom = 0, Left = 0, Right = 0, Top = 0} };
using (Document pdf = new Document(htmlFile, htmloptions))
{
pdf.PageMode = PageMode.FullScreen;
pdf.CenterWindow = true;
pdf.FitWindow = true;
pdf.PageLayout = PageLayout.SinglePage;
pdf.PageInfo = new PageInfo { IsLandscape = Aspose.Pdf.PageSize.A4.IsLandscape = true, Height = Aspose.Pdf.PageSize.A4.Height - 55, Margin = new Aspose.Pdf.MarginInfo { Bottom = 0, Left = 0, Right = 0, Top = 0 } };
pdf.Save(sdlg.FileName, Aspose.Pdf.SaveFormat.Pptx);
}
Regards,
Vali