Hi there
I’m having an issue getting an externally references css to apply during conversion. This is the code I’m using.
WebRequest request = WebRequest.Create(“http://my_url/sample2.html”);
request.Credentials = CredentialCache.DefaultCredentials;
HttpWebResponse response = (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 htmlLoadOptions = new HtmlLoadOptions(“http://my_url/”);
Document doc = new Document(stream, htmlLoadOptions);
doc.Save(“C:\temp\html_output.pdf”);
Attached is the html and the stylesheet. The images render properly but the div style is not applied. When I load the html directly, I can see that the styles are applied properly in HTML.
The converted PDF doesn’t reflect the font styles.
Can someone from Support answer my question? We’re evaluating purchasing Aspose and this could be a showstopper if it doesn’t work as expected.
Hi Sze,
Thanks for contacting support.
I have tested the scenario using following code snippet and as per my observations, the Image does not appear in PDF file but I can see that text formatting is being honored. For the sake of correction, I have logged this problem as PDFNEWNET-40257 in our issue tracking system. We will further look into the details of this problem and will keep you posted on the status of correction. Please be patient and spare us little time. We are sorry for this inconvenience.
For your reference, I have attached the output generated over my end.
[C#]
HtmlLoadOptions htmlLoadOptions = new HtmlLoadOptions(@“C:\pdftest\sample-code”); <o:p></o:p>
Document doc = new Document(@"C:\pdftest\sample-code\sample1.html", htmlLoadOptions);
doc.Save(@“C:\pdftest\sample-code\sample1_output.pdf”);
The issues you have found earlier (filed as PDFNET-40257) have been fixed in Aspose.PDF for .NET 23.2.