Welcome GuestLogin

PDFsharp and MigraDoc Wiki

RSS RSS

Navigation




Quick Search
»

PoweredBy

Visit the new Website for PDFsharp & MigraDoc Foundation 6.0 for .NET 6 and find information about the new version for Windows, Linux, and other platforms.

<< Previous^UpNext >>
This sample shows how to use images in MigraDoc documents.

PDF Output File

See the PDF file created by this sample: output.pdf (19 kB)

Screen Shots

Here is a sample screen shot:

Hello World with image

Source Code

This snippet shows how to add an image to a MigraDoc document:
/// 
/// Creates an absolutely minimalistic document.
/// 
static Document CreateDocument()
{
  // Create a new MigraDoc document
  Document document = new Document();
 
  // Add a section to the document
  Section section = document.AddSection();
 
  // Add a paragraph to the section
  Paragraph paragraph = section.AddParagraph();
 
  // Add some text to the paragraph
  paragraph.AddFormattedText("Hello, World!", TextFormat.Italic);
  section.AddImage("../../SomeImage.png");
 
  return document;
}

Note: The samples on this site usually show and discuss code snippets only. The complete source code of the samples with solutions for Visual Studio is available from the download area on CodePlex.


Visit the new Website for PDFsharp & MigraDoc Foundation 6.0 for .NET 6 and find information about the new version for Windows, Linux, and other platforms.



Miscellaneous
Home
PDFsharp
FAQ
Samples
Articles
MigraDoc
FAQ
Samples
Articles

ScrewTurn Wiki version 3.0.5.600. Some of the icons created by FamFamFam.

Impressum - Privacy Policy, Data Protection Declaration, Legal Notice