Skip to content

Latest commit

 

History

History
46 lines (33 loc) · 1.54 KB

change-properties-when-converting-flow-to-pdf.md

File metadata and controls

46 lines (33 loc) · 1.54 KB
title description type page_title slug position tags res_type
Change Flow Document Properties when converting to PDF
Learn how to control the Document Properties when converting flow document to PDF with Telerik Document Processing.
how-to troubleshooting
Change Flow Document Properties when converting to PDF
change-properties-when-converting-flow-to-pdf
0
pdf, html, docx, page, margin
kb
Product Version Product Author
2020.1.218 RadWordsProcessing Dimitar Karamfilov

Description

The [RadWordsProcessing]({%slug radwordsprocessing-overview%}) library allows you to convert various documents formats (docx, rtf, txt, html) to PDF. When converting you may need to modify the document properties (page size or orientation, margins).

Solution

Change the properties of the RadFlowDocument.

C# Change the RadFlowDocument properties while exporting.

{{region change-properties-when-converting-flow-to-pdf1}} 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);
}

{{endregion}}