New to Telerik Document Processing? Start a free 30-day trial

Change Flow Document Properties when converting to PDF

Updated on Jun 5, 2026

Environment

VersionProductAuthor
2020.1.218RadWordsProcessingDimitar Karamfilov

Description

The RadWordsProcessing library allows you to convert various document formats (DOCX, RTF, TXT, HTML) to PDF. When converting, you may need to change the document properties such as page size, orientation, or margins.

Solution

Change the properties of the RadFlowDocument before exporting to PDF.

Example 1: Change the RadFlowDocument Properties While Exporting

csharp
HtmlFormatProvider htmlProvider = new HtmlFormatProvider();
RadFlowDocument document = htmlProvider.Import(html);

foreach (var section in document.Sections)
{
    section.PageMargins = new Padding(150);
    section.PageSize = PaperTypeConverter.ToSize(PaperTypes.A4);
    section.Rotate(PageOrientation.Landscape);
}

PdfFormatProvider pdfProvider = new PdfFormatProvider();

using (Stream output = File.Create(save))
{              
    pdfProvider.Export(document, output);
}

See Also