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

Free Support Forum - aspose.com

Relative Paths to Images

Is it possible to use relative paths when referencing images in xml.

Instead of this

Do Something like this

Hi Dale,

Thanks for using our products.

Kindly use the below mentioned approach for accessing image using relative path.

Please do let us know if you need any further assistance.

Thanks & Regards,

rashid.ali,

I tried using the ..\Images\img.jpg but just get the error below. If there is something else I should try please let me know thanks.

ApplicationException: Can't open image file .\Images\rarrowq1.JPG]
xc0a8130c468d13ee.xa460a0b649265441.x9a4e6b7d06323b1a(Image xe058541ca798c059, ImageFileType x0182a6dae298f8a4, String x8dcfbf7b6ef33595, String xf3e8db661c71fd5e, String x6dcb3eaa4aca7389, Int32 x0784b68e528f2eb1, Int32 x6c884ce115067193, Boolean x4a29b7050d0b6013, Boolean xc2b092f31bc52bbe, Byte[] xf1c258adc3c53c0e, Stream xc8f3f690897a858e) +1584
x3f91538e8c0de749.x8cc6f4ae84548c02.x7af2d95226c39577(Pdf x6beba47238e0ade6, Image xe058541ca798c059) +824
x3f91538e8c0de749

Hi Dale,

Thanks for your feedback, can you please share some details regarding the template XML document and code snippet you are using. This will help us to figure out the issue and reply back to you soon.

We apologize for your inconvenience.

Thanks & Regards,

Unfortunately there is much code to show but its below

if (seg.InlineParagraph.GetType().Name == "Image")
{
Aspose.Pdf.Image ff = seg.InlineParagraph as Aspose.Pdf.Image;

}

This xml works  
<Header Type="Both" IsFirstPageOnly="true" Alignment="Left" MarginLeft="0" MarginTop="20">
      <Table ColumnWidths=" 4inch 4inch">
        <Row>
          <Cell>
            <Image File="C:\inetpub\SomeApp\Images\someimage.jpg" Alignment="Left" ImageScale="0.5" Type="Jpeg" ></Image>
          </Cell>
This one does not
 <Header Type="Both" IsFirstPageOnly="true" Alignment="Left" MarginLeft="0" MarginTop="20">
      <Table ColumnWidths=" 4inch 4inch">
        <Row>
          <Cell>
            <Image File="..\Images\someimage.jpg" Alignment="Left" ImageScale="0.5" Type="Jpeg" ></Image>
          </Cell>
 
 
Thanks for your help.

Hi Dale,

Thank you for the sample code. I tried using your code to test your issue but unable to replicate the scenario at my end. Please create a sample application to show the issue. This will help us to figure out the issue and reply back to you soon.

Moreover, please try the latest version of Aspose.Pdf for .NET v6.4.2 and check it by using

We apologize for your inconvenience.

Thanks & Regards,