Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

Here we create a MigraDoc Document object to draw the content of this page

static void SamplePage1(PdfDocument document)
{
  PdfPage page = document.AddPage();
  XGraphics gfx = XGraphics.FromPdfPage(page);
  // HACK²
  gfx.MUH = PdfFontEncoding.Unicode;
  gfx.MFEH = PdfFontEmbedding.Default;
 
  XFont font = new XFont("Verdana", 13, XFontStyle.Bold);
 
  gfx.DrawString("The following paragraph was rendered using MigraDoc:", font, XBrushes.Black,
    new XRect(100, 100, page.Width - 200, 300), XStringFormats.Center);
 
  // You always need a MigraDoc document for rendering.
  Document doc = new Document();
  Section sec = doc.AddSection();
  // Add a single paragraph with some text and format information.
  Paragraph para = sec.AddParagraph();
  para.Format.Alignment = ParagraphAlignment.Justify;
  para.Format.Font.Name = "Times New Roman";
  para.Format.Font.Size = 12;
  para.Format.Font.Color = MigraDoc.DocumentObjectModel.Colors.DarkGray;
  para.Format.Font.Color = MigraDoc.DocumentObjectModel.Colors.DarkGray;
  para.AddText("Duisism odigna acipsum delesenisl ");
  para.AddFormattedText("ullum in velenit", TextFormat.Bold);
  para.AddText(" ipit iurero dolum zzriliquisis nit wis dolore vel et nonsequipit, velendigna "+
    "auguercilit lor se dipisl duismod tatem zzrit at laore magna feummod oloborting ea con vel "+
    "essit augiati onsequat luptat nos diatum vel ullum illummy nonsent nit ipis et nonsequis "+
    "niation utpat. Odolobor augait et non etueril landre min ut ulla feugiam commodo lortie ex "+
    "essent augait el ing eumsan hendre feugait prat augiatem amconul laoreet. ≤≥≈≠");
  para.Format.Borders.Distance = "5pt";
  para.Format.Borders.Color = Colors.Gold;
 
  // Create a renderer and prepare (=layout) the document
  MigraDoc.Rendering.DocumentRenderer docRenderer = new DocumentRenderer(doc);
  docRenderer.PrepareDocument();
 
  // Render the paragraph. You can render tables or shapes the same way.
  docRenderer.RenderObject(gfx, XUnit.FromCentimeter(5), XUnit.FromCentimeter(10), "12cm", para);
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: how to check if every element in array is true c# 
Csharp :: plays ervices unity sigin 
Csharp :: what is difference between int.Parse and toint32 in c# 
Csharp :: reflection assemblies gettypes 
Csharp :: C# Blocks without statements 
Csharp :: hacker 
Csharp :: how to modigy login page asp.net core 
Csharp :: start wpf application when windows start 
Csharp :: how to reset checkbox visual studio c# 
Csharp :: k8s You must be logged in to the server (Unauthorized) 
Csharp :: ignore warning openxml 
Csharp :: Unity make a homing object 
Csharp :: C# devexpress get foucused dataRow of child gridView 
Csharp :: how to unit test dbcontext in .net core 
Csharp :: return value of a mocked value will be as the input c# 
Csharp :: aws asp.net tutorial 
Csharp :: lizzo net worth 
Csharp :: Open Windows Explorer to a certain directory from within a WPF app 
Csharp :: displaying list in gameobject Unity 
Csharp :: c# replace foreach with lambda 
Csharp :: how to declare two int variables in only one line c# 
Csharp :: unity gamemanager instance not set to an instance of an object 
Csharp :: c# windows form BalloonTipIcon close 
Csharp :: c# decimal 
Csharp :: Maximum Sum of Non-Adjacent Elements 
Csharp :: unity NetworkBehaviour the type or namespace could not be found 
Csharp :: how to get day name from datetimepicker in c# 
Csharp :: c# get regedit value 
Csharp :: Responsive Bootstrap 4 Admin Dashboard icon cdn 
Csharp :: css text no word wrap 
ADD CONTENT
Topic
Content
Source link
Name
3+9 =