PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu Jul 18, 2024 11: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
 Post subject: Image not found
PostPosted: Mon Feb 20, 2012 1:18 pm 
Offline

Joined: Mon Feb 20, 2012 1:06 pm
Posts: 2
Hi All,

I have just started playing with PDFsharp & MigraDoc and I have a problem referencing an image. This is a wpf project, and I have a folder "Images" under the root directory. Inside the Images folder I have a picture "mypic.jpg", with it is build action set to "Content", and the copy to output directory "copy always"

Root
___Images (folder)
______mypic.jpg
___Window1.xaml

This is the code:

Code:
 static void CreateHeader()
        {
            // Put a logo in the header
            Image image = section.Headers.Primary.AddImage("../Images/mypic.jpg");
            image.Height = "0.5cm";
            image.LockAspectRatio = true;
            image.RelativeVertical = RelativeVertical.Line;
            image.RelativeHorizontal = RelativeHorizontal.Margin;
            image.Top = ShapePosition.Top;
            image.Left = ShapePosition.Right;
            image.WrapFormat.Style = WrapStyle.Through;
        }


Any help will be greatly appreciate it.

Thanks


Top
 Profile  
Reply with quote  
 Post subject: Re: Image not found
PostPosted: Mon Feb 20, 2012 1:23 pm 
Offline

Joined: Mon Feb 20, 2012 1:06 pm
Posts: 2
Found the right way to reference it:

Image image = section.Headers.Primary.AddImage("Images/mypic.jpg");


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: No registered users and 47 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