Create Pdf from Image
Product Version | Product | Author |
---|---|---|
2021.1.325 | RadPdfProcessing | Dimitar Karamfilov |
Description
The example is showing how to create a PDF file by using an image.
Solution
In this example you will create a brand new PDF document, add a page to it, and draw the image using the FixedContentEditor
var doc = new RadFixedDocument();
var page = doc.Pages.AddPage();
var editor = new FixedContentEditor(page);
using (FileStream fs = new FileStream(@"....\telerik_logo.jpg", FileMode.Open))
{
editor.DrawImage(fs);
}
var provider = new PdfFormatProvider();
File.WriteAllBytes(@"result.pdf", provider.Export(doc));