|
// Create a new PDF document
PdfDocument document = new PdfDocument();
//Add a page to the document
PdfPage page = document.Pages.Add();
//Create PDF graphics for the page
PdfGraphics graphics = page.Graphics;
//Set the standard font
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 20);
Stream imgStream = typeof(MainPage).GetTypeInfo().Assembly.GetManifestResourceStream("App5.Assets.Electricalengineering.jpg");
//Draw the text
graphics.DrawString("Hello World!!!", font, PdfBrushes.Black, new PointF(0, 0));
PdfImage image = PdfImage.FromStream(imgStream);
//Draws the image to the PDF page
RectangleF bounds = new RectangleF(176, 0, 390, 130);
page.Graphics.DrawImage(image, bounds);
//Save the document to the stream
MemoryStream stream = new MemoryStream();
document.Save(stream);
//Close the document
document.Close(true); |
|
Stream imgStream = typeof(MainPage).GetTypeInfo().Assembly.GetManifestResourceStream("App5.Assests.Electricalengineering.jpg"); |
|
|