Hey
Im trying to set the margines of a Aspose.Pdf.Document.
I have a byte [] in HTML format i want to convert to a new byte [] in PDF format.
The conversion itself is no problem.
But the new document have default margines. I can’t change these.
But the new document have default margines. I can’t change these.
I tried this (changing all the margines to 0 dosen’t change the resulting pdf:
public static byte[] ConvertHTMLToPDF(byte[] data)
{
LicenseHelper.Instance.SetLicenses();
HtmlLoadOptions htmloptions = new HtmlLoadOptions();
htmloptions.UseNewConversionEngine = true;
using (MemoryStream inStream = new MemoryStream(data))
{
Aspose.Pdf.Document doc = new Aspose.Pdf.Document(inStream, htmloptions);
doc.PageInfo.Margin = new MarginInfo(top: 10, bottom: 10, left: 10, right: 10);
using (MemoryStream outStream = new MemoryStream())
{
doc.Save(outStream);
// Convert the document to byte form.
byte[] docBytes = outStream.ToArray();
return docBytes;
}
}
}
Anyone know how to control the margines?