Hi Team,
Hi Asad,
Thanks for your inquiry. Aspose.Pdf evaluation version has two limitations, evaluation watermark and at most four elements of any collection can be viewed. Please make a request for 30 days temporary license to evaluate our product without any limitation, it will resolve the issue.
Please feel free to contact us for any further assistance.
Best Regards,
Hi Team,
Hi Asad,
Thanks for sharing more details. I have tried to generate PDF from URL by using the code snippet which you have shared and was able to generate an output containing all images present in the URL. I have modified your code snippet a little (i.e I have set ExternalResourcesCredentials field of HtmlLoadOptions).
Please check the following code snippet and also the attached output file generated by the code.
System.Net.WebRequest request = System.Net.WebRequest.Create(“https://www.sec.gov/Archives/edgar/data/320193/000119312517003764/d307349ddefa14a.htm”);<o:p></o:p>
// If required by the server, set the credentials.
request.Credentials = System.Net.CredentialCache.DefaultCredentials;
// time out in miliseconds before the request times out
// request.Timeout = 100;
// Get the response.
System.Net.HttpWebResponse response = (System.Net.HttpWebResponse)request.GetResponse();
// Get the stream containing content returned by the server.
Stream dataStream = response.GetResponseStream();
// Open the stream using a StreamReader for easy access.
StreamReader reader = new StreamReader(dataStream);
// Read the content.
string responseFromServer = reader.ReadToEnd();
reader.Close();
dataStream.Close();
response.Close();
MemoryStream stream = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(responseFromServer));
HtmlLoadOptions options = new HtmlLoadOptions("https://www.sec.gov/Archives/edgar/data/320193/000119312517003764/");
options.ExternalResourcesCredentials = System.Net.CredentialCache.DefaultCredentials;
options.PageInfo.IsLandscape = true;
// Load HTML file
Document pdfDocument = new Document(stream, options);
// Save output as PDF format
pdfDocument.Save("HTMLtoPDF_DOM.pdf");
In case of any further assistance please feel free to contact us.
Best Regards,
Hi Team,
Converting this url into pdf cause text overwrite in pdf.
System.Net.WebRequest request = System.Net.WebRequest.Create(“https://www.sec.gov/Archives/edgar/data/789019/000119312516740765/d243670ddefa14a.htm”);
// If required by the server, set the credentials.
request.Credentials = System.Net.CredentialCache.DefaultCredentials;
// time out in miliseconds before the request times out
// request.Timeout = 100;
// Get the response.
System.Net.HttpWebResponse response = (System.Net.HttpWebResponse)request.GetResponse();
// Get the stream containing content returned by the server.
Stream dataStream = response.GetResponseStream();
// Open the stream using a StreamReader for easy access.
StreamReader reader = new StreamReader(dataStream);
// Read the content.
string responseFromServer = reader.ReadToEnd();
reader.Close();
dataStream.Close();
response.Close();
MemoryStream stream = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(responseFromServer));
HtmlLoadOptions options = new HtmlLoadOptions(“https://www.sec.gov/Archives/edgar/data/789019/000119312516740765/”);
options.ExternalResourcesCredentials = System.Net.CredentialCache.DefaultCredentials;
// Load HTML file
Document pdfDocument = new Document(stream, options);
options.PageInfo.IsLandscape = true;
// Save output as PDF format
pdfDocument.Save(@“C:\1223HTMLtoPDF_DOM.pdf”);
Hi team,
As i am converting this url into pdf, text overwrite happens. Please look into it.
System.Net.WebRequest request = System.Net.WebRequest.Create(“https://www.sec.gov/Archives/edgar/data/789019/000119312516740765/d243670ddefa14a.htm”);
// If required by the server, set the credentials.
request.Credentials = System.Net.CredentialCache.DefaultCredentials;
// time out in miliseconds before the request times out
// request.Timeout = 100;
// Get the response.
System.Net.HttpWebResponse response = (System.Net.HttpWebResponse)request.GetResponse();
// Get the stream containing content returned by the server.
Stream dataStream = response.GetResponseStream();
// Open the stream using a StreamReader for easy access.
StreamReader reader = new StreamReader(dataStream);
// Read the content.
string responseFromServer = reader.ReadToEnd();
reader.Close();
dataStream.Close();
response.Close();
MemoryStream stream = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(responseFromServer));
HtmlLoadOptions options = new HtmlLoadOptions(“https://www.sec.gov/Archives/edgar/data/789019/000119312516740765/”);
options.ExternalResourcesCredentials = System.Net.CredentialCache.DefaultCredentials;
// Load HTML file
Document pdfDocument = new Document(stream, options);
options.PageInfo.IsLandscape = true;
// Save output as PDF format
pdfDocument.Save(@“C:\1223HTMLtoPDF_DOM.pdf”);
Hi Asad,
pdfDocument.ProcessParagraphs();<o:p></o:p>
// Resize contents of resultant PDF
int[] page_cnt1 = new int[pdfDocument.Pages.Count];
for (int i = 0; i < pdfDocument.Pages.Count; i++)
{
page_cnt1[i] = i + 1;
}
PdfFileEditor pfe = new PdfFileEditor();
pfe.ResizeContents(pdfDocument, page_cnt1, PdfFileEditor.ContentsResizeParameters.PageResize(Aspose.Pdf.PageSize.A4.Width, Aspose.Pdf.PageSize.A4.Height));