This is a migrated thread and some comments may be shown as answers.

HtmlFormatProvider and page size

2 Answers 249 Views
PdfProcessing
This is a migrated thread and some comments may be shown as answers.
Peter
Top achievements
Rank 1
Peter asked on 22 Nov 2019, 09:02 AM

Hi

I am generating a PDF from a html file using HtmlFormatProvider, RadFlowDocument and PdfFormatProvider.

The generated PDF contains some large tables that is not rendered correctly.

This can be solved if I can set the html page witdth somehow.  Is it possible?

 

2 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 22 Nov 2019, 12:35 PM

Hi Peter,

You can set the width of the table. Here is an example: 

RadFlowDocument document;

var htmlProvider = new HtmlFormatProvider();
document = htmlProvider.Import(File.ReadAllText(@"D:\test2.html"));

foreach (Table table in document.EnumerateChildrenOfType<Table>())
{
    table.LayoutType = TableLayoutType.FixedWidth;
    table.PreferredWidth = new TableWidthUnit(2000);
}

I hope this helps. Please let me know if you have additional questions.

Regards,
Dimitar
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Peter
Top achievements
Rank 1
answered on 22 Nov 2019, 01:52 PM
Thanks, that worked!
Tags
PdfProcessing
Asked by
Peter
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Peter
Top achievements
Rank 1
Share this question
or