How to add Image to PushButtonField

2 posts, 0 answers
  1. Bhavesh
    Bhavesh avatar
    1 posts
    Member since:
    Jun 2017

    Posted 20 Jun Link to this post

    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? 
  2. Georgi
    Admin
    Georgi avatar
    9 posts

    Posted 21 Jun Link to this post

    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

Back to Top