Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
141296 | Dec 5,2018 06:49 AM UTC | Dec 6,2018 10:20 AM UTC | UWP | 1 |
![]() |
Tags: Pdf |
//Initialize PDF document.
PdfDocument doc = new PdfDocument();
//Add pages to the PDF document.
PdfPage page = doc.Pages.Add();
//Initialize PdfUnitConverter.
PdfUnitConvertor converter = new PdfUnitConvertor();
//Convert Millemeter to Point
float x = converter.ConvertUnits(54, PdfGraphicsUnit.Millimeter, PdfGraphicsUnit.Point);
float y = converter.ConvertUnits(11, PdfGraphicsUnit.Millimeter, PdfGraphicsUnit.Point);
//Font size.
float fontSize = converter.ConvertUnits(12f, PdfGraphicsUnit.Millimeter, PdfGraphicsUnit.Point);
//Create PdfFont.
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, fontSize, PdfFontStyle.Regular);
page.Graphics.DrawString("Hello World", font, PdfBrushes.Black, new PointF(x,y));
//Initialize memorystream
MemoryStream ms = new MemoryStream();
//Save the document to stream
doc.Save(ms);
|
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.