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

MemoryStream Webpage HTML to PDF

1 Answer 488 Views
WordsProcessing
This is a migrated thread and some comments may be shown as answers.
Alex Tushinsky
Top achievements
Rank 2
Alex Tushinsky asked on 01 Oct 2015, 03:47 PM

Hello,

I am writing a very specific type of a report, which I have to control line height, dynamically generate content, and fill in a chart object.  I'm currently doing this using OpenXML and Microsoft Word.  When created, the end result is exported into PDF.  This always seemed like overkill for me, and I would have preferred to use Telerik Reporting, except that Reporting doesn't let me set specific line heights.

In any case, I would like to try to dynamically build a web page of the report that I'm doing, which would be formatted exactly as I need it to be, and would also incorporate a RadChart.  I would like to use either WordsProcessing or PDFProcessing to take the MemoryStream of this HTML page, and output it to PDF.  Is this possible?  I don't see any specific examples, although I see there is a conversion demo which can take HTML as input and create a PDF as output.

Thank you,
Alex

1 Answer, 1 is accepted

Sort by
0
Boby
Telerik team
answered on 05 Oct 2015, 11:24 AM
Hello Alex,

I will list some options and limitations and will leave the decision on how to proceed to you:

- Create an HTML page with the report data and use directly the ClientExportManager to export it to PDF. Not sure if this would work for you, as the page should be rendered in the browser.

- Create HTML or (, RTF) with the report data, import it with RadWordsProcessing to produce an instance of RadFlowDocument, and then export to PDF using the PdfFormatProvider. Note that each conversion has some limitations, as all of the formats are extremely complex and we support only a subset of them. Here you can decide to skip the importing and create the RadFlowDocument from scratch, using the rich document model or the RadFlowDocumentEditor helper class (or a combination of both).

- You can use directly RadPdfProcessing to generate the PDF document from scratch. As building a document with text can be inconvenient with the fixed model (e.g. you have to split the text to lines by yourself) you can use the RadFixedDocumentEditor utility class, which provides a convenient way to generate fixed content in a flow-like manner. 

Also, note that currently charts are not supported from RadWordsProcessing document model, so the import operations will skip them from any of the available flow formats.

Regards,
Boby
Telerik
Tags
WordsProcessing
Asked by
Alex Tushinsky
Top achievements
Rank 2
Answers by
Boby
Telerik team
Share this question
or