Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

This page contains six pages, created with MigraDoc and scaled down to fit on one page

static void SamplePage2(PdfDocument document)
{
  PdfPage page = document.AddPage();
  XGraphics gfx = XGraphics.FromPdfPage(page);
  // HACK²
  gfx.MUH = PdfFontEncoding.Unicode;
  gfx.MFEH = PdfFontEmbedding.Default;
 
  // Create document from HalloMigraDoc sample
  Document doc = HelloMigraDoc.Documents.CreateDocument();
 
  // Create a renderer and prepare (=layout) the document
  MigraDoc.Rendering.DocumentRenderer docRenderer = new DocumentRenderer(doc);
  docRenderer.PrepareDocument();
 
  // For clarity we use point as unit of measure in this sample.
  // A4 is the standard letter size in Germany (21cm x 29.7cm).
  XRect A4Rect = new XRect(0, 0, A4Width, A4Height);
 
  int pageCount = docRenderer.FormattedDocument.PageCount;
  for (int idx = 0; idx < pageCount; idx++)
  {
    XRect rect = GetRect(idx);
 
    // Use BeginContainer / EndContainer for simplicity only. You can naturaly use you own transformations.
    XGraphicsContainer container = gfx.BeginContainer(rect, A4Rect, XGraphicsUnit.Point);
 
    // Draw page border for better visual representation
    gfx.DrawRectangle(XPens.LightGray, A4Rect);
 
    // Render the page. Note that page numbers start with 1.
    docRenderer.RenderPage(gfx, idx + 1);
 
    // Note: The outline and the hyperlinks (table of content) does not work in the produced PDF document.
 
    // Pop the previous graphical state
    gfx.EndContainer(container);
  }
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: float into int unoity 
Csharp :: void on TriggerCollisionEnter2D 
Csharp :: jobject alternative in system.text.json 
Csharp :: read system data dataset 
Csharp :: how to instantiate more enemies in unity 
Csharp :: unity get quaternion z 
Csharp :: how to make diagonal movement not double the speed of the player in unity 
Csharp :: Archivarskodex freischalten 
Csharp :: c# compare months 
Csharp :: C# print all properties of an object including children objects 
Csharp :: c# Prefix Sum of Matrix (Or 2D Array) 
Csharp :: linq query to fetch parent child data from same table in c# 
Csharp :: gcm_sender_id convert text 
Csharp :: How to return a list to view after foreach in c# 
Csharp :: validate preview input number wpf 
Csharp :: asp net mvc convert ienumerable to selectlistitem 
Csharp :: mongodb truncation exception c# 
Csharp :: in c# show error when user choose old datetime 
Csharp :: classe padre figlio c# 
Csharp :: firefoxoptions setpreference to trust certificates 
Csharp :: how to make dissapear an object in unity 
Csharp :: edit opened excel file directly 
Csharp :: c# print expression tree 
Csharp :: unity phone vibration 
Csharp :: rename join table in many to many 
Csharp :: unity check if animator has parameter 
Csharp :: c# read file while writing 
Csharp :: return a list of list from yaml via C# 
Csharp :: binance slp to php 
Csharp :: c# ef dynamic ApplyConfiguration 
ADD CONTENT
Topic
Content
Source link
Name
8+4 =