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

FixedContentEditor has invalid arguments

2 Answers 125 Views
PdfProcessing
This is a migrated thread and some comments may be shown as answers.
cwk
Top achievements
Rank 2
cwk asked on 06 Jun 2015, 03:51 AM

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 Answers, 1 is accepted

Sort by
0
Tanya
Telerik team
answered on 08 Jun 2015, 04:10 PM
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
0
cwk
Top achievements
Rank 2
answered on 22 Jun 2015, 04:59 AM
Hi, thanks! Is working now.
Tags
PdfProcessing
Asked by
cwk
Top achievements
Rank 2
Answers by
Tanya
Telerik team
cwk
Top achievements
Rank 2
Share this question
or