This is a migrated thread and some comments may be shown as answers.
Form Field Image
1 Answer 10 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Fadi asked on 11 Jan 2021, 04:28 PM

Do you have any sample code to set a form field with an image so that the image is centered in the form field but keeps it's aspect ratio without going outside the bounding box? Does the image need to be resized first to reduce filesize?


1 Answer, 1 is accepted

Sort by
Telerik team
answered on 12 Jan 2021, 09:44 AM

Hello Fadi,

Yes, this is possible. You will need a PushButtonField to hold the image in this case. The image should be smaller than the field rectangle, otherwise, it will be cut off to fit the available size. Here is an example that shows this: 

RadFixedDocument document = new RadFixedDocument();
var page = document.Pages.AddPage();

FormSource form = new FormSource();
form.Size = new System.Windows.Size(1000, 1000);

var editor = new FixedContentEditor(form);
editor.DrawImage(new FileStream(@"..\..\test.png", FileMode.Open));

PushButtonField pushButtonField = new PushButtonField("Test");

PushButtonWidget widget = pushButtonField.Widgets.AddWidget();

widget.Rect = new Rect(25, 25, 805, 612);
widget.HighlightingMode = HighlightingMode.NoHighlighting;

widget.AppearanceCharacteristics.Background = new RgbColor(0, 255, 255, 255);
widget.AppearanceCharacteristics.BorderColor = new RgbColor(0, 255, 255, 255);
widget.Border = new AnnotationBorder(0, AnnotationBorderStyle.None, null);

widget.AppearanceCharacteristics.NormalIconSource = form;
widget.AppearanceCharacteristics.IconAndCaptionPosition = IconAndCaptionPosition.NoCaptionIconOnly;
widget.AppearanceCharacteristics.IconFitOptions.ScalingType = IconScalingType.Proportional;

widget.AppearanceCharacteristics.NormalCaption = null;



PdfFormatProvider provider = new PdfFormatProvider();
File.WriteAllBytes(@"..\..\result.pdf", provider.Export(document));

I hope this helps. Should you have any other questions do not hesitate to ask.

Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at

Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question