Rank: Advanced Member
Groups: Registered
Joined: 10/13/2017(UTC) Posts: 52  Location: Freiburg Thanks: 3 times
|
Hi, is it possible to hide a button of a form via PdfViewer? Sample: Code:pdfViewer1.LoadDocument(pdfFile);
PdfDocument pdfDocument = this.pdfViewer1.Document;
PdfInteractiveForms pdfForm = pdfDocument.FormFill.InterForm;
PdfField field = pdfForm.Fields.FirstOrDefault(x => x.FullName == "XXX");
field.hide()
Thank you for your time! Regards Peter Edited by moderator Thursday, July 19, 2018 6:33:56 PM(UTC)
| Reason: Not specified
|
|
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 1/5/2016(UTC) Posts: 1,138
Thanks: 10 times Was thanked: 133 time(s) in 130 post(s)
|
Hi, Yes it is possible. Please look at code below Code:PdfDocument pdfDocument = this.pdfViewer1.Document;
PdfInteractiveForms pdfForm = pdfDocument.FormFill.InterForm;
PdfField field = pdfForm.Fields.FirstOrDefault(x => x.FullName == "Push Button0");
foreach(var ctrl in field.Controls)
{
ctrl.Dictionary["F"] = PdfTypeNumber.Create(32); //Bit 6 - NoView. If set, do not display the annotation on the screen or allow it to interact with the user.
//The annotation may be printed (depending on the setting of the Print flag) but should
//be considered hidden for purposes of onscreen display and user interaction.
}
pdfViewer1.Invalidate();
Each field can have one or more views on one or more pages. These views are called "controls" and are essentially the WidgetAnnotations. And you can set the visibility flag (among other things) for these annotations. For example, the above code sets the invisibility flag to all controls on the found field. The value of the annotation dictionary’s F entry is an unsigned 32-bit integer containing flags specifying various characteristics of the annotation. Bit positions within the flag word are numbered from 1 (low-order) to 32 (high-order). Bit Position - Name 1 - Invisible 2 - Hidden 3 - Print 4 - NoZoom 5 - NoRotate 6 - NoView 7 - ReadOnly 8 - Locked 9 - ToggleNoView 10 - LockedContents More info about annotation flags you may found on page 608 here: http://archimedespalimps...al/pdf_reference_1-7.pdfEdited by user Thursday, July 19, 2018 7:09:04 PM(UTC)
| Reason: Not specified
|
 1 user thanked Paul Rayman for this useful post.
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 10/13/2017(UTC) Posts: 52  Location: Freiburg Thanks: 3 times
|
Hi Paul, thank you very much for the quick help! Great! Peter
|
|
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot 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