Creating Text Boxes inside PDF Viewer Presenter

4 posts, 0 answers
  1. Farshid
    Farshid avatar
    2 posts
    Member since:
    Sep 2014

    Posted 02 Apr 2015 Link to this post

    Hi,

    I am deciding on using PDF Viewer for my project or not and need answer to this question:

    I need to be able to place text boxes and custom user controls on the PDF pages in specific coordinates which will act like a PDF Form. These controls should act as if they are part of the PDF, but in fact the information about those controls is not saved within the PDF and my program creates them dynamically.

    Is this doable using a custom presenter or any other means?

    Thanks,
    Farshid

  2. Petya
    Admin
    Petya avatar
    975 posts

    Posted 06 Apr 2015 Link to this post

    Hi Farshid,

    Actually, custom presenters are intended to change the way the document is visualized and interacted with. To achieve the desired I'd suggest creating a custom layer instead. This will allow to add on top of the existing control logic about those fields and keep the underlying PDF intact.

    Take a look at this code library that was submitted awhile back, as well as Deyan's latest post. The code in the examples draws paths over a Canvas, but extending this to show editable controls (like a TextBox) should be possible. 

    I hope this is helpful.

    Regards,
    Petya
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  3. DevCraft banner
  4. Farshid
    Farshid avatar
    2 posts
    Member since:
    Sep 2014

    Posted 08 Apr 2015 in reply to Petya Link to this post

    Thanks for your reply Petya,

     

    For the most part you are right. It is theoretically possible using that code. However there is a problem: The text box that is inserted in the page using this method, never receives the keyboard focus and therefore user cannot enter anything in it.  

     

    This is how I did it: In the code that you mentioned, I added the following code snippet inside HighlightUILayer.cs in the Initialize function so that a text box appears on the top left side of each page:

    this.container.Children.Add(new TextBox
    {
        Margin= new System.Windows.Thickness(50),
        Width = 200,
        Height = 30,
        Text = "Test",
        IsEnabled = true,
        Background = new SolidColorBrush(Colors.Red)
    });

     

    Do you think this is solvable?

     

    Regards,

    Farshid 

     

     

     

  5. Tanya
    Admin
    Tanya avatar
    405 posts

    Posted 13 Apr 2015 Link to this post

    Hi Farshid,

    The issue is related to an inappropriate behavior of the PagePresenter of RadPdfViewer. I logged the bug in our backlog and you could subscribe to its public item in the feedback portal in order to receive updates on the matter. Your Telerik points were updated as a token of appreciation for the report.

    Regards,
    Tanya
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
Back to Top