Reputation:
I am using Winnovative to convert HTML to PDF. There are two server one web and other one is file server(To store only files). Both servers are in network.
PDF code is running on web server and at the end file is used to store at file server. In HTML template all images are given full path even though image are broken in PDF files.
Below is a simple code that is used.
PdfConverter PdfConv = new PdfConverter();
PdfConv.LicenseKey = "xxx-xxx-xxx-xxx";
WindowsImpersonationContext impersonateOnFileServer = ImpersonateOnFileServer(Username, Domain, Password);
PdfConv.SavePdfFromHtmlStringToFile(HTMLToConvert, FilePath);
ImpersonateOnFileServer is a method to authenticate network as I said PDF is used to store at file sever so It is required. WindowsImpersonation is working well because PDF is saved and the only problem is with images.
For the test purpose I have put aside file sever concept and tried to save PDF at web server in application root folder then images are showing in PDF.
Therefore conclusion is there is something goes wrong when I store PDF to file server that I understood after all test.
If anyone has came across with this problem or any idea please draw me on right way.
Thank you.
Upvotes: 1
Views: 1302
Reputation: 523
If the images are accessible only for some users then you have to also impersonate the context in which the Winnovative navigator runs. You can do this using the HtmlToPdfConverter.ImpersonationOptions object. You can set the username, domain and password and also the logon mode for the impersonated user which can be automatic or explicit.
Upvotes: 0
Reputation: 11
try using http://wkhtmltopdf.org/'s free
I used on a project and it worked fine
Upvotes: 1