I am trying to convert my html document to pptx. Frist I am converting my html to pdf and then pdf to pptx by using aspose,pdf. I want to adjust page margins in the pptx. So I am doing it to pdf and convert it to pptx. But my margins are not changing according to my need, Could you please help me to change margins ???
//this is my convert method
public List<byte[]> Convert(ContentsDto content, IDictionary<string, string> options, Func<DependentContent, Task<ContentsDto>> GetDependency = null)
{
License htmlLicense = new License();
htmlLicense.SetLicense("Aspose.Total.NET.lic");
var pdfBytearray = new List<byte[]>();
HtmlLoadOptions htmlLoadOptions = new HtmlLoadOptions() { CustomLoaderOfExternalResources = ResourceLoading, HtmlMediaType = HtmlMediaType.Print };
//Manipulate html document
HtmlDocument htmlDocument = new HtmlDocument();
using (var htmlStream = new MemoryStream(content.Data))
{
htmlDocument.Load(htmlStream);
AddFroalaCSSSupport(htmlDocument);
}
using (var htmlOutputStream = new MemoryStream())
{
//convert html to pdf
htmlDocument.Save(htmlOutputStream);
htmlOutputStream.Seek(0, System.IO.SeekOrigin.Begin);
Document pdfDocument = new Document(htmlOutputStream, htmlLoadOptions);
AddFooter(pdfDocument);
Page page = pdfDocument.Pages.Add();
MarginInfo marginInfo = new MarginInfo();
page.PageInfo.Margin.Left=1000;
//convert pdf to pptx
PptxSaveOptions pptx_save = new PptxSaveOptions();
using (var pptxStream = new MemoryStream())
{
pdfDocument.Save(pptxStream, pptx_save);
pptxStream.Seek(0, System.IO.SeekOrigin.Begin);
pdfBytearray.Add(pptxStream.ToArray());
}
}
return pdfBytearray;
}
//this is my margin changing part in the above method. this is not working. Could you please help me to write the correct solution?
Page page = pdfDocument.Pages.Add();
MarginInfo marginInfo = new MarginInfo();
page.PageInfo.Margin.Left=1000;