Telerik RadPDFViewer WPF

29 posts, 0 answers
  1. Bindu
    Bindu avatar
    1 posts
    Member since:
    Aug 2014

    Posted 27 Aug 2014 Link to this post

    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
  2. Deyan
    Admin
    Deyan avatar
    135 posts

    Posted 29 Aug 2014 Link to this post

    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.
     
  3. UI for WPF is Visual Studio 2017 Ready
  4. Bindu
    Bindu avatar
    25 posts
    Member since:
    Aug 2014

    Posted 04 Sep 2014 in reply to Deyan Link to this post

    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
  5. Bindu
    Bindu avatar
    25 posts
    Member since:
    Aug 2014

    Posted 05 Sep 2014 in reply to Deyan Link to this post

    Hello Team,

    Do RadPDFViewer have the functionality of Re-Ordering of pages

    Thanks in advance
  6. Petya
    Admin
    Petya avatar
    975 posts

    Posted 09 Sep 2014 Link to this post

    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.
     
  7. Bindu
    Bindu avatar
    25 posts
    Member since:
    Aug 2014

    Posted 22 Sep 2014 Link to this post

    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
  8. Bindu
    Bindu avatar
    25 posts
    Member since:
    Aug 2014

    Posted 22 Sep 2014 Link to this post

    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
  9. Petya
    Admin
    Petya avatar
    975 posts

    Posted 24 Sep 2014 Link to this post

    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.
     
  10. Bindu
    Bindu avatar
    25 posts
    Member since:
    Aug 2014

    Posted 25 Sep 2014 in reply to Petya Link to this post

    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
  11. Petya
    Admin
    Petya avatar
    975 posts

    Posted 29 Sep 2014 Link to this post

    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.
     
  12. Angela
    Angela avatar
    1 posts
    Member since:
    Oct 2014

    Posted 05 Oct 2014 in reply to Petya Link to this post

    hello,
    Thank you for the support
  13. Bindu
    Bindu avatar
    25 posts
    Member since:
    Aug 2014

    Posted 06 Oct 2014 in reply to Petya Link to this post

    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
  14. Bindu
    Bindu avatar
    25 posts
    Member since:
    Aug 2014

    Posted 06 Oct 2014 in reply to Bindu Link to this post

    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?
  15. Petya
    Admin
    Petya avatar
    975 posts

    Posted 08 Oct 2014 Link to this post

    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.

     
  16. Bindu
    Bindu avatar
    25 posts
    Member since:
    Aug 2014

    Posted 21 Oct 2014 in reply to Petya Link to this post

    Hello Team

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

    Thanks
    Bindu
  17. Petya
    Admin
    Petya avatar
    975 posts

    Posted 24 Oct 2014 Link to this post

    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.

     
  18. Bindu
    Bindu avatar
    25 posts
    Member since:
    Aug 2014

    Posted 24 Oct 2014 Link to this post

    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
  19. Bindu
    Bindu avatar
    25 posts
    Member since:
    Aug 2014

    Posted 24 Oct 2014 in reply to Bindu Link to this post

    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
  20. Bindu
    Bindu avatar
    25 posts
    Member since:
    Aug 2014

    Posted 28 Oct 2014 in reply to Bindu Link to this post

    Hello Team,

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

    Thanks,
    Bindu
  21. Petya
    Admin
    Petya avatar
    975 posts

    Posted 29 Oct 2014 Link to this post

    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.

     
  22. Bindu
    Bindu avatar
    25 posts
    Member since:
    Aug 2014

    Posted 04 Nov 2014 in reply to Petya Link to this post

    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
  23. Petya
    Admin
    Petya avatar
    975 posts

    Posted 06 Nov 2014 Link to this post

    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.

     
  24. Bindu
    Bindu avatar
    25 posts
    Member since:
    Aug 2014

    Posted 10 Nov 2014 in reply to Petya Link to this post

    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
  25. Petya
    Admin
    Petya avatar
    975 posts

    Posted 12 Nov 2014 Link to this post

    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.

     
  26. Bindu
    Bindu avatar
    25 posts
    Member since:
    Aug 2014

    Posted 18 Nov 2014 in reply to Petya Link to this post

    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
  27. Bindu
    Bindu avatar
    25 posts
    Member since:
    Aug 2014

    Posted 19 Nov 2014 in reply to Bindu Link to this post

    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
  28. Bindu
    Bindu avatar
    25 posts
    Member since:
    Aug 2014

    Posted 19 Nov 2014 in reply to Bindu Link to this post

    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
  29. Bindu
    Bindu avatar
    25 posts
    Member since:
    Aug 2014

    Posted 21 Nov 2014 in reply to Bindu Link to this post

    Any help on this.
  30. Petya
    Admin
    Petya avatar
    975 posts

    Posted 21 Nov 2014 Link to this post

    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.

     
Back to Top
UI for WPF is Visual Studio 2017 Ready