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

How to add Image to PushButtonField

1 Answer 25 Views
PdfProcessing
This is a migrated thread and some comments may be shown as answers.
Bhavesh
Top achievements
Rank 1
Bhavesh asked on 20 Jun 2018, 08:14 PM
Hello, I have an Interactive Form which is a single page PDF form that I am attempting to fill in C# code. The Interactive form has a 2 Image fields and 8 text fields to populate. When I grammatically load, the text fields appears as a textbox type object where as Image field is not. Instead it appears as PushButton field. What I am attempting here is to add image in the Image field that program reads as PushButton.  Is there a way to inert Image in to these two fields programmatically? 

1 Answer, 1 is accepted

Sort by
0
Georgi
Telerik team
answered on 21 Jun 2018, 04:02 PM
Hi Bhavesh,

I am sharing my reply from the support ticket on the same topic:

Image fields are represented in the PDF document model as PushButtonField associated with JavaScript action. Currently, JavaScript actions are not supported for RadPdfProcessing. We have an already logged feature request in our feedback portal were you can vote to increase the priority and subscribe to be notified for any status updates.

However, you can set the IconSource properties of the PushButtonWidget using the PushButtonAppearanceCharacteristics class. For example:
foreach(PushButtonWidget widget in pushButton.Widgets)
{
    using (Stream imageStream = this.GetResourceStream("Telerik_logo.jpg"))
    {
        FormSource formSource = new FormSource
        {
            Size = size
        };
   
        FixedContentEditor formEditor = new FixedContentEditor(formSource);
        formEditor.DrawImage(imageStream, size);
   
        widget.AppearanceCharacteristics.IconAndCaptionPosition = IconAndCaptionPosition.NoCaptionIconOnly;
        widget.AppearanceCharacteristics.IconFitOptions.ScalingType = IconScalingType.FitExactly;
        widget.AppearanceCharacteristics.NormalIconSource = formSource;
   
        widget.RecalculateContent();
    }
}

I hope the above-suggested approach will help you implement the desired goal. 

Regards,
Georgi
Progress Telerik

Tags
PdfProcessing
Asked by
Bhavesh
Top achievements
Rank 1
Answers by
Georgi
Telerik team
Share this question
or