Create PDF from RadFlowDocument

9 posts, 1 answers
  1. Timo
    Timo avatar
    5 posts
    Member since:
    Jan 2011

    Posted 12 Mar 2014 Link to this post

    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





  2. Answer
    Petya
    Admin
    Petya avatar
    975 posts

    Posted 14 Mar 2014 Link to this post

    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.

     
  3. Ole Oscar
    Ole Oscar avatar
    18 posts
    Member since:
    Jun 2008

    Posted 10 Jul 2014 in reply to Petya Link to this post

    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
  4. Petya
    Admin
    Petya avatar
    975 posts

    Posted 11 Jul 2014 Link to this post

    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.
     
  5. Ole Oscar
    Ole Oscar avatar
    18 posts
    Member since:
    Jun 2008

    Posted 14 Jul 2014 in reply to Petya Link to this post

    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
  6. Petya
    Admin
    Petya avatar
    975 posts

    Posted 15 Jul 2014 Link to this post

    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.
     
  7. Iwhp
    Iwhp avatar
    40 posts
    Member since:
    Dec 2009

    Posted 23 Oct 2014 Link to this post

    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
  8. Petya
    Admin
    Petya avatar
    975 posts

    Posted 27 Oct 2014 Link to this post

    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.

     
  9. mozell
    mozell avatar
    1 posts
    Member since:
    Mar 2016

    Posted 07 Mar Link to this post

    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

Back to Top