Having problems exporting a document with .Export

2 posts, 0 answers
  1. danparker276
    danparker276 avatar
    389 posts
    Member since:
    Aug 2010

    Posted 19 Jul 2012 Link to this post

    I must be missing something simple, but I'm trying to export a document the way it is on many help files:
                       using (Stream output = dialog.OpenFile())
                       {
                           PdfFormatProvider pdf = DocumentFormatProvidersManager.GetProviderByExtension("pdf") as PdfFormatProvider;
                           pdf.Export(document,output);
                       }

    But it's not finding the Export function.  The intellisense will get pdf.Import, but not Export. I'm pretty sure I have all the references, (Documents, Documents.Fixed, Documents.FormatProviders.Pdf) I get the error below.  

    I'm getting the error:
    Error 9 'Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfFormatProvider' does not contain a definition for 'Export' and no extension method 'Export' accepting a first argument of type 'Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfFormatProvider' could be found (are you missing a using directive or an assembly reference?)

    It also can't resovle DocxFormatProvider
  2. Iva Toteva
    Admin
    Iva Toteva avatar
    1319 posts

    Posted 20 Jul 2012 Link to this post

    Hi Dan,

    There are two different PdfFormatProviders - one used by RadRichTextBox to export its document to PDF and one used by RadPdfViewer to import PDF documents.

    The PdfFormatProvider located in the Telerik.Windows.Documents.Fixed assembly, Telerik.Windows.Documents.Fixed.FormatProviders.Pdf is used by RadPdfViewer. It can only import PDF documents.

    On the other hand, the provider that is able to export RadDocument is located in the Telerik.Windows.Documents.FormatProviders.Pdf assembly (which depends on Telerik.Windows.Zip), in the Telerik.Windows.Documents.FormatProviders.Pdf namespace. 

    Make sure to have referenced the correct assemblies and added the right using declarations. For docx format, you should also add a reference to Telerik.Windows.Documents.FormatProviders.OpenXml.dll. You can find more information on the required assembly references for all format providers here.


    Regards,
    Iva Toteva
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. DevCraft banner
Back to Top