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

Creating Text Boxes inside PDF Viewer Presenter

3 Answers 155 Views
PDFViewer
This is a migrated thread and some comments may be shown as answers.
Farshid
Top achievements
Rank 1
Farshid asked on 02 Apr 2015, 03:12 PM
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

3 Answers, 1 is accepted

Sort by
0
Petya
Telerik team
answered on 06 Apr 2015, 04:02 PM
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.

 
0
Farshid
Top achievements
Rank 1
answered on 08 Apr 2015, 07:46 PM

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 

 

 

 

0
Tanya
Telerik team
answered on 13 Apr 2015, 01:43 PM
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.

 
Tags
PDFViewer
Asked by
Farshid
Top achievements
Rank 1
Answers by
Petya
Telerik team
Farshid
Top achievements
Rank 1
Tanya
Telerik team
Share this question
or