Relative image path in web app (not using xml)


#1

Hello,

I’m trying to add a relative path to an image in a pdf as follows (vb.net web app):

Dim image1 As Aspose.Pdf.Image = New Aspose.Pdf.Image
image1.PositioningType = PositioningType.ColumnRelative
image1.Top = 0
section.Paragraphs.Add(image1)
image1.ImageInfo.File = "~/Images/pdf/myimage.jpg"
image1.ImageInfo.ImageFileType = ImageFileType.Jpeg

Is this possible, because it’s not working? I do not want to use absolute paths as the web application will be hosted on another server.

Thanks in advance…

Will




#2

Dear Will,

Thank you for considering Aspose.

You can use the MapPath() method just like the code in the demos.


#3

Thanks.
Will