I have a form in a windows application. The form contains grids, table, images, other data and a link called PDF generate. What is the best way to generate a pdf with the same format on the form with all the data using telerik controls?
The easiest way to achieve this is to put the controls which you want to export to a panel. Then take a snapshot of the panel and add it to a pdf file. For example:
Telerik.Windows.Documents.Fixed.Model.Objects.Image image = new Telerik.Windows.Documents.Fixed.Model.Objects.Image();
image.ImageSource = new Telerik.Windows.Documents.Fixed.Model.Resources.ImageSource(ms);
image.Width = radPanel1.Width;
image.Height = radPanel1.Height;
document.Pages.First().Content.Add(image);
}
PdfFormatProvider provider = new PdfFormatProvider();
using (Stream output = File.OpenWrite("Test.pdf"))
{
provider.Export(document, output);
}
}
Another way would be to manually construct the entire pdf document. The following article shows how you can create complex documents: Getting Started with RadPdfProcessing.
I hope this helps.
Regards,
Dimitar
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items