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

Create PDF from RadFlowDocument

8 Answers 2070 Views
WordsProcessing
This is a migrated thread and some comments may be shown as answers.
Peter
Top achievements
Rank 1
Peter asked on 12 Mar 2014, 09:41 AM
Hello,

I'd like to use the new RadWordProcessing (2014 Q1) to create generic report documents for my customers.
The documents should preferably be saved in PDF format.

As far as I've seen, there is currently no PdfFormatProvider which supports RadFlowDocuments. Instead it expects a RadDocument as export parameter.
Is it possible to convert RadFlowDocuments to RadDocuments to use the available PdfFormatProvider with the RadDocument?
Or just create PDF files from RadFlowDocuments?
Is this a planned feature in the near future?

Thanks and kind regards
Timo Bohl





8 Answers, 1 is accepted

Sort by
0
Accepted
Petya
Telerik team
answered on 14 Mar 2014, 04:54 PM
Hello Timo,

Thank you for your interest in RadWordsProcessing.

Providing a way to create a PDF document from RadFlowDocument is in our plans, but I am unfortunately unable to comment on any particular date when it might be available. The preferences of our clients are highly valued when determining the roadmap and your feedback regarding this is highly appreciated.

At this point there is no way to convert RadFlowDocument to RadDocument either. The best thing I could suggest is to use one of the formats supported by both components (for example DOCX) to make the conversion and use PdfFormatProvider to export to PDF.

Do not hesitate to get back to us if you have any additional comments or questions. I would gladly assist you.

Regards,
Petya
Telerik
 

DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

 
0
Ole Oscar
Top achievements
Rank 1
answered on 10 Jul 2014, 08:54 AM
Hi,
I didn't know that there existed a solution from Telerik for WordProcessing. We do use Telerik a lot in our solutions both for DNN and standalone and it is the preferred library of UI components.
We have been looking for a solution for over three years where we can convert/handle docx/html to pdf for document production. Both from UI and backoffice. Today we use an very old version of another library. It is so expensive that we can't afford to upgrade it. The licensing model for most of these PDF libraries makes it almost impossible to justify the investment.

Best Regards
Ole Oscar Johnsen
0
Petya
Telerik team
answered on 11 Jul 2014, 02:50 PM
Hi Ole Oscar Johnsen,

The Telerik UI for WPF provides several controls and libraries which utilize creation, edition, import and export of different file formats. Here's a short summary including the documentation links for your reference:
  • RadPdfProcessing: This brand new library allows you to create, import and export PDF documents.
  • RadPdfViewer: The control allows you to visualize PDF documents.
  • RadRichTextBox: The control visualizes documents in the most common flow formats - DOCX, RTF, HTML and TXT, as well as in its native XAML format. Additionally, you can export the document to all of the above and PDF format.
  • RadSpreadProcessing: The library enables creation, import and export of the most common spreadsheet formats - XLSX, CSV and TXT. Additionally, you have the ability to export the documents to PDF.
  • RadSpreadsheet: Provides you with the ability to show and modify the above-mentioned formats as well as a variety of editing features.
  • RadWordsProcessing: Provides the ability to import, modify and export to a variety of formats - DOCX, RTF, HTML and TXT. Export to PDF, as mentioned in my previous reply, is not yet supported but is on top of our backlog. You can track this item in the Feedback & Ideas Portal to be notified about our progress.

We are doing our best to have every scenario covered and are constantly working on improving all these components. Should you decide to utilize any of them and have any questions, feel free to contact us and we will gladly assist you.

Regards,
Petya
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Ole Oscar
Top achievements
Rank 1
answered on 14 Jul 2014, 07:47 AM
Many tanks for the information.
Is it possible to notice me when you have something that I can test for export to PDF in RadWordsProcessing. At the moment we are using five different libraries for handling of files. One for text/csv files, one for xls and xlsx , one for PDF, MS OpenXml for docx and standard .NET for xml. I think we can replace them except xml by using RadSpreadProcessing if it supports csv/txt as expected and RadWordsProcessing. We import/export and handles a lot of files. both small and large files in our applications. We can live without support for xls if you don't support it.

It is basically three main areas where we need support.
Import and export "tabular data" into the applications. xlsx, csv, txt, xml
(Xml is not tabular but in over 90% of the times it is organized in a tabular way or you can convert to it).

Document production of pdf documents from docx templates with merge of custom data.

Document production of pdf documents based on a html document like for example personal statements with tables/graphs text and so on. For the production of the html we use Telerik components like for example RadGrid.
 
Regards
Ole Oscar
0
Petya
Telerik team
answered on 15 Jul 2014, 04:07 PM
Hi Ole Oscar,

You can track the item I previously pointed you to in order to be notified about any progress we make on the matter: Implement export of FlowDocument to PDF.

As to the other requirements you listed, at this point XLS is not one of the supported formats and it is not in our immediate plans. All other points, however, seem passable with the help of the listed libraries.

Regards,
Petya
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Iwhp
Top achievements
Rank 1
answered on 23 Oct 2014, 10:00 AM
As my understanding from above, it should be possible to convert a RadFlowDocument to a RadFixDocument.
How?

I am looking for a way to convert a DOCX to a PDF.
I am also looking for a way to save either the DOCX or the PDF as a JPG or PNG (page by page).

Thankx, Harry
0
Petya
Telerik team
answered on 27 Oct 2014, 02:14 PM
Hi Harry,

I'm afraid that converting RadFixedDocument to RadFlowDocument is still not genuinely supported. However, we just started working on the feature and it should be available for one of our next official releases.

In the meantime, in the released today Q3 2014 we introduced some helper classes that allow creation of fixed documents in flow manner. What this means is that you could enumerate the elements of a flow document and using RadFixedDocumentEditor create a fixed document based on the flow one.

As to creating images from the document, RadPdfViewer exposes functionality that can help you in this task. You can use the control to import a PDF file and create images from the pages through the API of the ThumbnailFactory.
private void CreateThumbnail()
{
    PdfFormatProvider provider = new PdfFormatProvider(stream, FormatProviderSettings.ReadOnDemand);
    RadFixedDocument document = provider.Import();
    ThumbnailFactory factory = new ThumbnailFactory();
    RadFixedPage page = document.Pages[3];
    ImageSource source = factory.CreateThumbnail(page, page.Size);
  
    Image image = new Image();
    image.Source = source;
    Window window = new Window();
    window.Content = image;
    window.ShowDialog();
}

I hope this is useful.

Regards,
Petya
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
mozell
Top achievements
Rank 1
answered on 07 Mar 2016, 12:20 PM

PdfFormatProvider makes it easy to import and export RadFlowDocument to PDF format, preserving the entire document structure and formatting.
All you have to do in order to use PdfFormatProvider is add references to the assemblies listed below:
Telerik.Windows.Documents.Core.dll
Telerik.Windows.Documents.Flow.dll
Telerik.Windows.Zip.dll
Telerik.Windows.Documents.Flow.FormatProviders.Pdf.dll
Telerik.Windows.Documents.Fixed.dll

 

In order to export a document to PDF you need to use the Export() method of PdfFormatProvider.

The code snippet in Example 1 shows how to create a PdfFormatProvider instance and use it to export RadFlowDocument to a file.
[C#] Example 1: Export to PDF File
PdfFormatProvider provider = new PdfFormatProvider();using (Stream output = File.OpenWrite("sample.pdf")){RadFlowDocument document = CreateRadFlowDocument(); provider.Export(document, output);}

 

contents of a RadFlowDocument to a RadFIxedDocument.
[C#] Example 2: Export to RadFixedDocument
RadFlowDocument document = CreateRadFlowDocument();PdfFormatProvider provider = new PdfFormatProvider();RadFixedDocument fixedDocument = provider.ExportToFixedDocument(document)

*Edited by administrator*

I hope i helped you out

Thank you

Tags
WordsProcessing
Asked by
Peter
Top achievements
Rank 1
Answers by
Petya
Telerik team
Ole Oscar
Top achievements
Rank 1
Iwhp
Top achievements
Rank 1
mozell
Top achievements
Rank 1
Share this question
or