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

Free Support Forum - aspose.com

Background image file does not render in Pdf.BindXML in case of Web applications

I am trying to call Pdf.BindXML with a XML stream which contains a section with background image specification. Sample:

<Section BackgroundImageFile="…/images/background.jpg"
BackgroundImageType=“jpeg”> …

In such a case, an exception is thrown saying “could not locate the image file”. On debugging, I found that the Current Working Directory is %SystemRoot%\system32. (Probably for IIS or ASP WP). So based on this CWD, obviously the image file could not be located as the relative path of the file is with respect to the root of the Web application. Let me know if you can reproduce this problem. If yes, there are atleast two possible solutions:

1) Use the path of the root of Web application as base directory for resolving relative paths. But this will not work in case Aspose.PDF is used in classic ASP/COM

2) Give a public property for the user to set the base directory.



Thank you for considering Aspose.

Well, I am unable to reproduce this error as bydefault the exception is set to none if image is not found from the source location. But your idea looks fruitful to give a property to set the Base path for images. I will discuss the oppurtunity to support this feature with the developers and will let you know as soon as solution is found.