PdfFormatProvider.Import(MemoryStream) into RadDocument Not Working

1 Answer 706 Views
PdfProcessing
Sajid
Top achievements
Rank 1
Sajid asked on 15 Jun 2022, 07:13 AM

Dear Team,

We are trying to import a pdf file into RadDocument by using PdfFormatProvider.Import() Method but getting exception "This specified method not found" Sample PDF file is attached and below is the piece of code for importing pdf into RadDocument. We need to set a watermark on pdf file by importing in RadDocument. We shall be very thankful to you for your prompt support. Thanks in advance.

string path = @"test watermark_2022_05_16_01_04_16_969_0_2742.pdf";
byte[] readText = File.ReadAllBytes(path);
Stream stream = new MemoryStream(readText);
Telerik.Windows.Documents.FormatProviders.Pdf.PdfFormatProvider pdfProvider = new Telerik.Windows.Documents.FormatProviders.PdfFormatProvider();
RadDocument rdocument = pdfProvider.Import(stream);--On This line exception "This specified method is not found"

1 Answer, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 17 Jun 2022, 03:29 PM

Hello Sajid,

If I understand you right, you are trying to import a PDF document and assign it to the RichTextBoxRadDocument. If so, I am afraid that the RichTextBox is intended to provide you the ability to work with rich text documents and doesn't support the import of PDF documents and this should be the reason for this error message. The PdfFormatProvider provides a RadDocument export-only functionality.

On the other hand, the PdfProcessing`s PdfFormatProvider provides the option to import a PDF file into a RadFixedDocument, if this could be in help for your scenario.

Additionally, we have a feature request logged to provide support for importing a PDF into a RadFlowDocument as well (which later could be imported into a RadDocument): WordsProcessing: Implement import from PDF. You can vote for the feature implementation as well as subscribe to the task by clicking the Follow button, so you can be notified about status changes.

Regards,
Martin
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
PdfProcessing
Asked by
Sajid
Top achievements
Rank 1
Answers by
Martin
Telerik team
Share this question
or