PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Fri Apr 19, 2024 6:32 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Fri Sep 23, 2016 10:44 am 
Offline

Joined: Fri Sep 23, 2016 10:34 am
Posts: 1
Hi,

This is for my published ASP.NET project.

I have an image that needs to be used in my application.

To draw the images onto my application I am using the following code:

Code:
Dim image = XImage.FromFile("/resources/Remortgage Quote Template.jpg")
gfx.DrawImage(image, 0, 0)


The error message I receive is:

The file 'D:\resources\Purchase Quote Template.jpg' does not exist

I have tried other path strings such as "~/resources/Remortgage Quote Template.jpg" and "../resources/Remortgage Quote Template.jpg"

I have ensured that the file has been correctly uploaded to the resources folder.

It concerns me that it is not searching through the wwwroot folder and is instead searching a D:\ drive.

Thanks
Joab


Top
 Profile  
Reply with quote  
PostPosted: Fri Sep 23, 2016 9:48 pm 
Offline
PDFsharp Expert
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 915
Location: CCAA
Hi!

You can query the original folder of your assembly and search the image relatively to that folder.

I think you can also get the absolute path for the wwwroot folder and search relatively from there.

Or embed the image as a resource of the assembly and load it from a stream (if it is a static image).

_________________
Best regards
Thomas
(Freelance Software Developer with several years of MigraDoc/PDFsharp experience)


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: Bing [Bot] and 286 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group