
Third, load one image from your local file as stream, and insert this image to different position in one paragraph.

Second, get the builder object from current document. This document level builder is flow-like manager, it will add separated input content to different blocks, paragraphs or pages. This C# tutorial shows how to add image to Pdf page using PdfDocumentBuilder object. How to Insert Image to PDF using Document-Level Builder in C# language Using (FileStream fs = File.OpenWrite( "InsertImage.pdf")) insert image as original size //block.InsertImage(imgStream) //insert image with customized sizeīlock.InsertImage(imgStream, new Size(100, 100))

Add image using Block object using (Stream imgStream = File.OpenRead( "sample2.jpg")) insert image with customized size //builder.DrawImage(imgStream, new Size(80, 80)) Add image using builder's DrawImage directly using (Stream imgStream = File.OpenRead( "sample.jpg")) PageContentBuilder builder = new PageContentBuilder(page) Using (FileStream fs = File.OpenRead( "sample.pdf")) (Block is the basic container in PDF, all the element is drawn in Block)įinally save the document.

Third, load one image from your local file as stream, and render this image to wanted location by calling DrawImage method in builder.įourth, load another image from your local file as stream, and insert this image to page by Block object. Second, get the builder object from current page. All the content editing, such as text and image, is processed in this page level content builder.įirst, load an existing document, and target to first page. This C# tutorial shows how to insert a logo image to Pdf page using PageContentBuilder object. How to Insert Image to PDF using Page-Level Builder in C# language You can actually add images to existing pages using iDiTect.Pdf.
