I need to convert dynamic html to pdf which i am doing using stream but am facing issue regarding page width , i want to keep page width as A4 but i am not able to do it.
Code:
Aspose.Pdf.HtmlLoadOptions htmlLoadOptions = new Aspose.Pdf.HtmlLoadOptions();
htmlLoadOptions.PageInfo.Margin.Bottom = 10;
htmlLoadOptions.PageInfo.Margin.Top = 50;
htmlLoadOptions.PageInfo.Width = Aspose.Pdf.PageSize.A4.Width;htmlLoadOptions.PageInfo.Height = Aspose.Pdf.<span style="color:#2b91af;">PageSize</span>.A4.Height; <span style="color:green;">//Load HTML string</span> Aspose.Pdf.<span style="color:#2b91af;">Document</span> doc = <span style="color:blue;">new</span> Aspose.Pdf.<span style="color:#2b91af;">Document</span>(<span style="color:blue;">new</span> <span style="color:#2b91af;">MemoryStream</span>(System.Text.<span style="color:#2b91af;">Encoding</span>.UTF8.GetBytes(htmlString)), htmlLoadOptions); <span style="color:#2b91af;">MemoryStream</span> outStream = <span style="color:blue;">new</span> <span style="color:#2b91af;">MemoryStream</span>();</pre><br><pre style="font-family:Consolas;font-size:13;color:black;background:white;">doc.Save(outStream, Aspose.Pdf.<span style="color:#2b91af;">SaveFormat</span>.Pdf); <span style="color:blue;">byte</span>[] content = outStream.ToArray(); <span style="color:blue;">return</span> <span style="color:blue;">new</span> <span style="color:#2b91af;">FileContentResult</span>(content, <span style="color:#a31515;">"application/pdf"</span>) { FileDownloadName = <span style="color:#a31515;">"Aspose"</span> };</pre>