Could an example be provided on how to create a PDF and set the Margins and Orientation for WinForms?
And if this involves the orientation involves use of PageRotation, could you please include how to rotate the text to match the rotation?
1 Answer, 1 is accepted
1
Tanya
Telerik team
answered on 01 Oct 2015, 11:42 AM
Hello Trey,
You could use the API of RadFixedDocumentEditor to set the margins and rotation of a page. Please, refer to the snippet below, which demonstrates how you could achieve this:
RadFixedDocument document = new RadFixedDocument();
using (RadFixedDocumentEditor editorDocument = new RadFixedDocumentEditor(document))
{
editorDocument.SectionProperties.PageMargins = new Padding(300);
editorDocument.InsertLine("Some longer test sentence.");
editorDocument.InsertRun("Another Run.");
}
Using the PageRotation property of the SectionProperties object, the text will be automatically rotated with the page.
Hope this is helpful.
Regards,
Tanya
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
You can also do so by using the PdfStreamWriter, which is a good tool for manipulating existing content without modifying it internally. Our Developer Focused Examples contain a great way of manipulating pages that makes use of the PdfStreamWriter - Manipulate pages. I've modified it in a way that achieves your goal in a small sample project, which I've attached here.