FixedContentEditor has invalid arguments

3 posts, 0 answers
  1. cwk
    cwk avatar
    31 posts
    Member since:
    Apr 2007

    Posted 05 Jun 2015 Link to this post

    Hi, I am new to PDFProcessing, was following the example codes, but could not compile...Error 2 Argument 1: cannot convert from 'Telerik.Windows.Pdf.Documents.Fixed.Model.RadFixedPage' to 'Telerik.Windows.Documents.Fixed.Model.Common.IContentRootElement' 

    Error 1 The best overloaded method match for 'Telerik.Windows.Documents.Fixed.Model.Editing.FixedContentEditor.FixedContentEditor(Telerik.Windows.Documents.Fixed.Model.Common.IContentRootElement)' has some invalid arguments 
     

    I am using version 2015.1.331.40, runtime version v4.0.30319

     

    RadFixedDocument document = new RadFixedDocument();
    RadFixedPage page = document.Pages.AddPage();
    FixedContentEditor editor = new FixedContentEditor(page);
    editor.DrawText("Hello RadPdfProcessing!");
    PdfFormatProvider provider = new PdfFormatProvider();
    using (Stream output = File.OpenWrite("Hello.pdf"))
    {
    provider.Export(document, output);
    }

  2. Tanya
    Admin
    Tanya avatar
    405 posts

    Posted 08 Jun 2015 Link to this post

    Hello Chik,

    In the RadPdfProcessing library and the RadPdfViewer control there is a few classes with identical names. For example, for the RadPdfProcessing you should use the RadFixedPage and RadFixedDocument classes from the Telerik.Windows.Documents.Fixed.Model namespace and if you need to use the same classes, but for the RadPdfViewer control, you should use the ones form the Telerik.Windows.Pdf.Documents.Fixed.Model. You could refer to the snippet below, which I modified to work with the RadPdfProcessing library:
    Telerik.Windows.Documents.Fixed.Model.RadFixedDocument document = new Telerik.Windows.Documents.Fixed.Model.RadFixedDocument();
    Telerik.Windows.Documents.Fixed.Model.RadFixedPage page = document.Pages.AddPage();
    Telerik.Windows.Documents.Fixed.Model.Editing.FixedContentEditor editor = new Telerik.Windows.Documents.Fixed.Model.Editing.FixedContentEditor(page);
    editor.DrawText("Hello RadPdfProcessing!");
    Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfFormatProvider provider = new Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfFormatProvider();
    using (Stream output = File.OpenWrite("Hello.pdf"))
    {
        provider.Export(document, output);
    }

    I hope this is helpful.

    Regards,
    Tanya
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. cwk
    cwk avatar
    31 posts
    Member since:
    Apr 2007

    Posted 21 Jun 2015 in reply to Tanya Link to this post

    Hi, thanks! Is working now.
Back to Top