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

Telerik RadPDFViewer WPF

30 Answers 625 Views
PDFViewer
This is a migrated thread and some comments may be shown as answers.
Bindu
Top achievements
Rank 1
Bindu asked on 27 Aug 2014, 06:16 AM
Hello Team,

I have open and displayed PDF document using Telerik RadPDFViewer WPF application, and i was able to do certain functions like Open, Save, print, Rotate, Zoom, Navigations.

But i want to append a page to the existing document that was opened using RadPDFViewer and also need to upload multiple PDFfiles and display at a time

Please suggest me on this.

Thanks,
Bindu

30 Answers, 1 is accepted

Sort by
0
Deyan
Telerik team
answered on 29 Aug 2014, 12:08 PM
Hello Bindu,

Currently you cannot append pages to the document opened in RadPdfViewer. We will consider implementing such functionality in some of the future releases.

If you have additional questions please do not hesitate to contact us again.

Regards,
Deyan
the Telerik team
 
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.
 
0
Bindu
Top achievements
Rank 1
answered on 04 Sep 2014, 01:25 PM
Hi,

I was using Radgridview and binding data from XML, I want inline delete functionality for each record in the grid and it should delete in XML as well

Thanks
0
Bindu
Top achievements
Rank 1
answered on 05 Sep 2014, 12:35 PM
Hello Team,

Do RadPDFViewer have the functionality of Re-Ordering of pages

Thanks in advance
0
Petya
Telerik team
answered on 09 Sep 2014, 08:26 AM
Hello,

Let me go straight to your questions:

1. You can place a button in the CellTemplate of GridViewColumn which executes a delete command. Please check this online demo for a reference. Also, you can check the Setting CellTemplate and CellEditTemplate help article which demonstrates how to set GridViewColumn's CellTemplate.

2. PDF documents have fixed layout and each object in a document has its specific place. That being said, RadPdfViewer is not capable of editing documents in any way, including reordering its pages.

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.
 
0
Bindu
Top achievements
Rank 1
answered on 22 Sep 2014, 05:46 AM
Hello Team,

I was using RadPDFViewer, fine working with save option in toolbar, but i need to save it in Application folder which saves default without opening opendialog.

Thanks in Advance
0
Bindu
Top achievements
Rank 1
answered on 22 Sep 2014, 07:41 AM
I was using RadPDFViewer, fine working with save option in toolbar, but i need to save it in Application folder which saves default without opening opendialog by passing the filename
0
Petya
Telerik team
answered on 24 Sep 2014, 05:22 PM
Hi Bindu,

I'm presuming you are talking about the Custom save command demo in our SDK examples, could you confirm that? This example contains the code that executes the saving of the PDF file in its CustomSaveCommand class where the Execute method shows a SaveFileDialog. If you want to change that, you could simply save the file to the desired location.
public override void Execute(object parameter)
   {
       using (Stream output = new FileStream("Sample.pdf", FileMode.OpenOrCreate))
       {
             documentStream.Seek(0, SeekOrigin.Begin);
               documentStream.CopyTo(output);
               documentStream.Flush();
               output.Flush();
       }
   }

I hope this helps.

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.
 
0
Bindu
Top achievements
Rank 1
answered on 25 Sep 2014, 06:45 AM
Hello Petya,

Thanks for the reply,

Onclick save button i need to pass 'Filename' from the textbox entered, for the document that i was saving in the desired location.

for example: savefiledialog.Filename=????;

Thanks in advance
Bindu
0
Petya
Telerik team
answered on 29 Sep 2014, 05:15 PM
Hello Bindu,

You can check the documentation of SaveFileDialog for more information on the topic, but generally the dialog has InitialDirectory and FileName properties that allow you to specify where you want to save your file.
SaveFileDialog saveDialog = new SaveFileDialog();
saveDialog.Filter = "PDF File|*.pdf";
saveDialog.InitialDirectory = "c:\\temp";
saveDialog.FileName = "MySample";
 
bool? dialogResult = saveDialog.ShowDialog();
if (dialogResult == true)
{
 
}

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.
 
0
Angela
Top achievements
Rank 1
answered on 05 Oct 2014, 03:19 PM
hello,
Thank you for the support
0
Bindu
Top achievements
Rank 1
answered on 06 Oct 2014, 08:25 AM
Hello Team,

Thanks for your support

My issue here is i need to pass a value to savefiledialog, i got the solution by passing through 'commandparameter'. Once again thanks for your support

Bindu
0
Bindu
Top achievements
Rank 1
answered on 06 Oct 2014, 08:29 AM
I'm trying to take multiple pdf files and read them all into a memory stream to then be shown on a telerik pdf viewer. If I just do one file it works but as soon as I try multiple files it gives me a internal null error (object ref not set to blah blah) and can't step in the code to see where its actualy null. Am I doing this wrong or something?
0
Petya
Telerik team
answered on 08 Oct 2014, 12:22 PM
Hello Bindu,

Adding several PDF documents to the same stream will not merge them together and the behavior you are experiencing is expected. If you want to combine PDFs, at this point the only solution I can suggest is through the RadPdfProcessing library. You can import the two documents and copy the pages and destinations from one of them to the other.
while (sourceDocument.Destinations.Count > 0) {
    Destination destination = sourceDocument.Destinations(0);
    sourceDocument.Dest
inations.Remove(destination);
    targetDocument.Destinations.Add(destination);
}
while (sourceDocument.Pages.Count > 0) {
    RadFixedPage page = sourceDocument.Pages(0);
    sourceDocument.Pages.Remove(page);
    targetDocument.Pages.Add(page);
}

Please note that while both RadPdfViewer and RadPdfProcessing use RadFixedDocument as the base of their model, importing a document with the processing library and passing the RadFixedDocument instance to RadPdfViewer would not work. Instead, you can export the combined PDF to a stream and import it back in RadPdfViewer.

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.

 
0
Bindu
Top achievements
Rank 1
answered on 21 Oct 2014, 09:37 AM
Hello Team

I want to view multiple PDF documents one after the other using RADPDFViewer wpf windows application

Thanks
Bindu
0
Petya
Telerik team
answered on 24 Oct 2014, 08:27 AM
Hi Bindu,

RadPdfViewer allows you to show a single PDF document, but you could try merging several documents together. Are you having troubles implementing the suggestion from my previous post? Once you've merged the documents with the PdfProcessing library you can export them to PDF and show that document in RadPdfViewer.

Let me know if you have any concrete question regarding this.

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.

 
0
Bindu
Top achievements
Rank 1
answered on 24 Oct 2014, 09:31 AM
How to create RadPDFViewer dynamically from code behind,

If i have array[5] i.e 5 pdf documents and for every document i need to create RADPDFViewer, so that i should view all the 5 pdf documents one after the other

Thanks in Advance

Bindu
0
Bindu
Top achievements
Rank 1
answered on 24 Oct 2014, 09:40 AM
Hello Petya,

The thing what i need is
If i have array[5] i.e 5 pdf documents and for every document should have its annotations for each, so that i should view all the 5 pdf documents one after the other with seperate Annotations for each document.

 I don't need to merge PDF documents but i need to show them individually with their annotations.

For this i thought of working in a way of creating RADPDFViewer dynamically, so that for every pdf it will create PDFViewer as well as its annotations.

So for this i was trying to create RadPDFViewer dynamically from code behind, can you please help me on this

Thanks in Advance

Bindu
0
Bindu
Top achievements
Rank 1
answered on 28 Oct 2014, 10:51 AM
Hello Team,

Can anyone help me out on this, is there any other approach

Thanks,
Bindu
0
Petya
Telerik team
answered on 29 Oct 2014, 09:17 AM
Hello Bindu,

RadPdfViewer is an UI control and if you want to show a PDF document in it, you need to make sure the control is in the visual tree. There are several approaches you could adopt in this regard, one of them being to dynamically create the control, assign a document to it and add it to the root of the window. There are plenty of discussions on the topic in internet, for example in this StackOverfow thread and here is a simple example.

If your window contains a Grid definition and you want to place the RadPdfViewer in the first row of the grid, give the Grid control a name in the XAML.
<Grid Name="root">
Then, when you want to show the pdf viewer just create the control, assign a document to it and add it as a child of that grid.
RadPdfViewer pdfViewer = new RadPdfViewer();
pdfViewer.DocumentSource = new PdfDocumentSource(str);
this.root.Children.Add(pdfViewer);
Grid.SetRow(pdfViewer, 1);

An alternative approach is to create a separate window in your application that contains a RadPdfViewer. Every time you need to show a PDF document just instantiate the window and call its Show() method. There is an example of that approach in this MSDN tutorial.

I hope this helps.

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.

 
0
Bindu
Top achievements
Rank 1
answered on 04 Nov 2014, 06:24 AM
I was using PDF Viewer in User Control and call ing XAML window, i want to open and Bind PDF document in PDFViewer

Thanks,
Bindu
0
Petya
Telerik team
answered on 06 Nov 2014, 01:04 PM
Hi Bindu,

Are you having troubles binding the DocumentSource property of the control? You can check this section of the Showing a File article for a reference on the approach. If you are experiencing concrete issues with this, let me know.

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.

 
0
Bindu
Top achievements
Rank 1
answered on 10 Nov 2014, 01:40 PM
Hello Team,

Using usercontrol and calling the usercontrol from mainwindow, as i need to open and view multiple PDF documents.
Now I need to save PDF document from RADPDFViewer codebehind without using any inbuilt Commands

Thanks in Advance
Bindu
0
Petya
Telerik team
answered on 12 Nov 2014, 04:44 PM
Hello Bindu,

RadPdfViewer is a component allowing to show PDF documents. The only way to save the document shown in the control is by using an approach similar to the demo discussed previously in this thread. This, however, requires to use the custom OpenCommand so that the stream to the document can be preserved in memory and I am unable to advise you on another approach.

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.

 
0
Bindu
Top achievements
Rank 1
answered on 18 Nov 2014, 11:09 AM
Hello Petya,

I have opened a PDF file and rotated the document, but after saving the document as in the previous discussion the updated rotated document is not saved instead the file i have opened is saving as it is without rotating.

Identified that the above SaveCommand works with the stream that is passed while opening, please let me know the possibility of passing the updated document to the stream and saving the updated document.

Thanks in advance,
Bindu
0
Bindu
Top achievements
Rank 1
answered on 19 Nov 2014, 09:48 AM
I was working in this way for saving the updated PDF document using RadPDFViewer

 private Stream documentStream; 

 private void RadButtonsave_Click(object sender, RoutedEventArgs e)
        {
            var provider = new PdfFormatProvider();
            MemoryStream memoryStream = new MemoryStream();
            memoryStream.Flush();
            provider.Export(this.pdfViewer.Document, memoryStream);

            this.pdfViewer.DocumentSource = new PdfDocumentSource(memoryStream);
            this.documentStream = memoryStream;
                
                SaveFileDialog saveFileDialog = new SaveFileDialog();
                if (saveFileDialog.ShowDialog() == true)
                {
                        using (Stream saveStream = saveFileDialog.OpenFile())
                        {
                          documentStream.Seek(0, SeekOrigin.Begin);
                          documentStream.CopyTo(saveStream);
                          documentStream.Flush();
                          saveStream.Flush();
                       }
                }
    }

But the problem here i was facing is, it is saving but not displaying content in the saved document, it is also displaying no.of pages and thumbnails.
I think content is not binding in memory stream.
Can anyone please help me out in this

Thanks 
Bindu
0
Bindu
Top achievements
Rank 1
answered on 19 Nov 2014, 09:53 AM
I was working in this way for saving the updated PDF document using RadPDFViewer

 private Stream documentStream; 

 private void RadButtonsave_Click(object sender, RoutedEventArgs e)
        {
            var provider = new PdfFormatProvider();
            MemoryStream memoryStream = new MemoryStream();
            memoryStream.Flush();
            provider.Export(this.pdfViewer.Document, memoryStream);

            this.pdfViewer.DocumentSource = new PdfDocumentSource(memoryStream);
            this.documentStream = memoryStream;
                
                SaveFileDialog saveFileDialog = new SaveFileDialog();
                if (saveFileDialog.ShowDialog() == true)
                {
                        using (Stream saveStream = saveFileDialog.OpenFile())
                        {
                          documentStream.Seek(0, SeekOrigin.Begin);
                          documentStream.CopyTo(saveStream);
                          documentStream.Flush();
                          saveStream.Flush();
                       }
                }
    }

But the problem here i was facing is, it is saving but not displaying content in the saved document, it is also displaying no.of pages and thumbnails without content.
I think content is not binding in memory stream.
Can anyone please help me out in this
0
Bindu
Top achievements
Rank 1
answered on 21 Nov 2014, 06:28 AM
Any help on this.
0
Petya
Telerik team
answered on 21 Nov 2014, 08:58 AM
Hi Bindu,

Like I mentioned before, RadPdfViewer is an UI control that allows showing of PDF files. All features the control exposes are related to the way the document is shown and cannot be preserved. The save command you are working with is merely a workaround that allows users to save the PDF to a file, but as you noticed this PDF is the same one imported in the control and preserved in a stream. That said, there isn't a way for you to save the file rotated or with any other modifications.

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.

 
0
rcmp-grc
Top achievements
Rank 1
answered on 20 Dec 2016, 10:46 PM

I want to use the SDK samples browser to get some ideas on how to display PDF byte array from SQL Server using RadPDFViewer, but the install fails.  Can I get the executable from an alternate location?

Install log is attached.

0
Kalin
Telerik team
answered on 22 Dec 2016, 09:31 AM
Hello Don,

I noticed you have opened another forum thread with same questions. I have already replied you there - could you please check my answer and I will ask you to continue the conversation in the other thread.

Regards,
Kalin
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
PDFViewer
Asked by
Bindu
Top achievements
Rank 1
Answers by
Deyan
Telerik team
Bindu
Top achievements
Rank 1
Petya
Telerik team
Angela
Top achievements
Rank 1
rcmp-grc
Top achievements
Rank 1
Kalin
Telerik team
Share this question
or