Hi Team,
I am trying to convert web to pdf using aspose.pdf for .net but image in pdf is not showing(align) properly and text overwrite itself.
Please refer to the code below-
string url = “https://www.sec.gov/Archives/edgar/data/320193/000119312517003753/d257185ddef14a.htm”;
System.Net.WebRequest request = System.Net.WebRequest.Create(url);
request.Credentials = System.Net.CredentialCache.DefaultCredentials;
System.Net.HttpWebResponse response = (System.Net.HttpWebResponse)request.GetResponse();
Stream dataStream = response.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
string content = reader.ReadToEnd();
reader.Close();
dataStream.Close();
response.Close();
HtmlLoadOptions htmlLoadOptions = new HtmlLoadOptions(url);
htmlLoadOptions.PageInfo.Margin.Bottom = 10;
htmlLoadOptions.PageInfo.Margin.Top = 20;
//Load HTML string
Document doc = new Document(new MemoryStream(System.Text.Encoding.UTF8.GetBytes(content)), htmlLoadOptions);
//Save PDF file
doc.Save(@“C:\sd.pdf”);