ExternalResourcesBasePath property

It appears that the ExternalResourcesBasePath property doesn't utilize the static property Pdf.Credentials when retrieving resources over http, whereas the ImgUrl property does. Is this a known issue, or is this by design?

Also, I see no way to set the user-agent http header as the requests don't send this header. Can this be added as a static property Pdf.UserAgent and then used like the credentials are for web requests?

Hi Mark,

Thanks for your inquiry.

mguinness:

It appears that the ExternalResourcesBasePath property doesn't utilize the static property Pdf.Credentials when retrieving resources over http, whereas the ImgUrl property does. Is this a known issue, or is this by design?


After initial investigation, we have logged an investigation ticket, PDFNEWNET-37102, for further investigation and resolution.


mguinness:

Also, I see no way to set the user-agent http header as the requests don't send this header. Can this be added as a static property Pdf.UserAgent and then used like the credentials are for web requests?


Moreover, we have logged a feature request, PDFNEWNET-37103, in our issue tracking system for support of user-agent string. We will keep you updated about the issues resolution progress via this forum thread.

We are sorry for the inconvenience caused.

Best Regards,

Hi Mark,


In addition to above reply. In reference to ExternalResourceBasePath property, we will appreciate, if you please share your sample code. It would help us to address your requirement exactly during investigation and resolution as well.

Looking forward to your sample code.

Best Regards,

This is code that can demonstrate the problem. Please note that this is for a private intranet website using Windows Authentication (NTLM). You will need an HTML page referencing an external CSS file. In this example, the images are retrieved with the Authorization header, but the stylesheet does not. It would also be useful if some type of logging was available which shows the HTTP response codes returned by the web server.

WebClient wc = new WebClient();
wc.Credentials = CredentialCache.DefaultNetworkCredentials;

wc.BaseAddress = "http://anydomain/";

string html = wc.DownloadString("anypage.aspx");

Pdf pdf = new Pdf();
Pdf.Credentials = CredentialCache.DefaultNetworkCredentials;
Section section = pdf.Sections.Add();
Text text2 = new Text(section, html);
text2.IsHtmlTagSupported = true;
section.Paragraphs.Add(text2);
pdf.HtmlInfo.ImgUrl = wc.BaseAddress;
pdf.HtmlInfo.ExternalResourcesBasePath = wc.BaseAddress;
pdf.Save("output.pdf");

Hi Mark,


Thank you very much for sharing the code snippet and details. We have shared the information with our development team. We will notify you via this forum thread as soon issue is resolved

Thanks for your patience and cooperation.

Best Regards,

The issues you have found earlier (filed as PDFNEWNET-37103) have been fixed in Aspose.Pdf for .NET 10.0.0.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.