Rank: Newbie
Groups: Registered
Joined: 7/25/2018(UTC) Posts: 7  Location: Sherwood Park, Alberta Thanks: 1 times
|
Is there a simple way to apply some styles (background colour, etc.) to field controls (widgets or w/e)?
Is seems that all of the properties are get; only.
|
|
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 1/5/2016(UTC) Posts: 1,138
Thanks: 10 times Was thanked: 133 time(s) in 130 post(s)
|
You may try to change them through its Dictionary Property.
But the appearance of most controls is specified through an appearance stream of that control. Most likely you need to change this one.
If you provide a document and tell me what you want to change, I might try to make a sample code for you.
|
|
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 7/25/2018(UTC) Posts: 7  Location: Sherwood Park, Alberta Thanks: 1 times
|
I don't have a specific form just now but let's use the case of "highlighting" (changing the background colour) of a textbox. I, in my blissful ignorance, proceeded as such Code:var field = pdfControl.Document.GetField("field_name"); // extension method
foreach (var control in field.Controls)
{
control.BackColor = "yellow"; // super contrived
}
So, yeh, I've been reading up on appearance streams but if you could fast-track this, that would be great. =)
|
|
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 1/5/2016(UTC) Posts: 1,138
Thanks: 10 times Was thanked: 133 time(s) in 130 post(s)
|
Originally Posted by: cjansen  I don't have a specific form just now but let's use the case of "highlighting" (changing the background colour) of a textbox. Do you need to highlight acroform fields in the PdfViewer control? Seems FormHighlightColor property is that you are looking for. https://pdfium.patagames...99-63a6-13c80e90b755.htmEdited by user Thursday, August 16, 2018 8:10:34 AM(UTC)
| Reason: Not specified
|
|
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 7/25/2018(UTC) Posts: 7  Location: Sherwood Park, Alberta Thanks: 1 times
|
that was just an example.
Let's say I want to make a blue border with a pink background colour?
I understand that the control has an AP entry in its dictionary and the AP entry can have entries for N, R, and D. and that those have (indirect links?) to FormXObjects?
But, honestly, I'm not sure how to implement this.
|
|
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 1/5/2016(UTC) Posts: 1,138
Thanks: 10 times Was thanked: 133 time(s) in 130 post(s)
|
Well... acro field control it is the widget annotation. This too complex subject for discuss. Usual appearance of this annotation is designed by the creator of the concrete PDF document. So styling of this in general may be difficult. You may found more info about widgets here on a page 640 http://archimedespalimps...al/pdf_reference_1-7.pdfSome things may be changed via dictionary parameters. Some of them via appearance stream only. And some are not widgets at all, although you can visually think that they are. For example, some widgets may not have any contours, but these contours are drawn separately around the widget. Here the example how to change font, font size and stroke color for the widget under mouse cursor. Code: private void pdfViewer1_DoubleClick(object sender, EventArgs e)
{
var mouse = e as MouseEventArgs;
var pagePoint = pdfViewer1.ClientToPage(pdfViewer1.CurrentIndex, mouse.Location);
int zOrder;
var ctrl = pdfViewer1.CurrentPage.GetControlAtPoint(pagePoint.X, pagePoint.Y, out zOrder);
if(ctrl!= null)
{
ctrl.Dictionary["DA"] = PdfTypeString.Create("/Arial 9 Tf 1 0 0 rg");
}
pdfViewer1.CurrentPage.Dispose();
pdfViewer1.ClearRenderBuffer();
pdfViewer1.Invalidate();
}
Here is an example how to generate stream which can be used as an appearance stream for an annotation https://forum.patagames....-Embedded-Fonts#post1430Edited by user Thursday, August 16, 2018 9:31:08 AM(UTC)
| Reason: Not specified
|
|
|
|
|
|
Forum Jump
You can post new topics in this forum.
You can reply to topics in this forum.
You can delete your posts in this forum.
You can edit your posts in this forum.
You cannot create polls in this forum.
You can vote in polls in this forum.
Important Information:
The Patagames Software Support Forum uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close