We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Html -> Pdf converting can not get image using impersonate account

I have a local image file, when i try to convert image tag such as " " to Pdf. .
If i do not grant access for "ASP_NET" (machine acc) to c:\Temp ; Then the converting failed with error:

Access to the path C:\Temp\test.jpg' is denied.

My web application use impersonate account. When i try to render the same file using API then no problem.

I grant access for ASP_NET to C:\Temp then no problem too.

The problem is that my web server and file server is hosted seperately. I cannot grant access for ASP_NET (local acc) to file server.

Hi,

Thank you for considering Aspose.

Can you please provide detailed info about "When i try to render the same file using API then no problem"?

When generate the PDF we have to access the image file in the HTML. Please test if the following code work:

FileStream fs = new FileStream("c:\temp\test.jpg",FileMode.Open,FileAccess.Read,FileShare.Read);

In the same context, following code work fine.

Pdf document = new Pdf();

Image img = new Image();
ImageInfo imgInfo = new ImageInfo();
imgInfo.File = @"\catsql\temp\Images\Resources\Questionnaire_4630\1847653791.jpg";
imgInfo.FixWidth = 50;
imgInfo.FixHeight = 50;
img.ImageInfo= imgInfo;

document.Sections[0].Paragraphs.add(img);


But following code will not work:

string htmlCode = @"";
Text text = new Text(htmlCode);
text.IsHtmlTagSupported = true;
document.Sections[0].Paragraphs.add(text);

The file is exported successful, but no image.

I have logged this issue as PDFNET-6897. We will try to fix it ASAP.

Hi,

Thank you for considering Aspose.Pdf. I have tested the code you provided and found it worked well. I cannot reproduce the error as you mentioned. Would you please provide me the origin project which produced the error and all the details regarding the configuration. I need these to relocate the error. Thank you for your information. I will solve the issue as soon as possible.