How to flatten PDF form, while still keep the button intact? - pdfbox

I have flatten pdf form using PDFBOX acroForm.flatten(). but using this method it will remove the button.
I still want the button to work even after I flatten my pdf.
This the pdf i want to flatten

Use flatten with parameters:
public void flatten(List<PDField> fields, boolean refreshAppearances)
this will only flatten the fields you want.

Related

customizing dc-tableview via the underlying DataTables object

dc-tableview is an interactive chart for dc.js library that presents filtered data (by crossfilter.js) in tableview form. The method "getDatatable()" returns underlying DataTable object for advanced manipulation (https://github.com/karenpommeroy/dc-tableview#object-getdatatable).
Question: how exactly can I use this method (after initialization), in order to be able to (for example):
Change the strings (like the "search" label)
Format numbers in the columns
Perform conditional formatting (like red negative numbers)
(work around this issue* in tableview by having access to the DataTable object)
Given that:
const tableView = new dc.tableview("#tableview-container");
,

display textbox shape value

When you add a textbox shape to the screen, you can use one of the following two methods to edit the displayed string:
[textbox].textframe.characters.text
or
[textbox].textframe.characters.caption
Is there any benefit of using one over the other? Any limitations?

Angular5 form array validation for dynamically created fields

I am using angular5 in that I am using form array to dynamically generating the fields. Initially I want to load form array as 0 files. If I am clicking plus button I want to add two fields. With validation.
If from array is empty i.e now fields are created I have to submit the button without this dynamic fields.
If fields are created I have to set validation without entering information in fields i won't enable submit button.
If I am setting validators.required in form array I can't able to submit without entering in first two fields
I need a solution for this one guys.
Assuming you are using template driven approach, the place where you are looping through your data to generate dynamic controls, create an index variable like *ngFor=" val in collection; let i=index" and then use that i to make each control unique by appending i with the name of the control like <input type="text" name="txtId-{{i}} #txtId="ngModel" [(ngModel)]="someId" />
Now if you try to use txtId.valid inside the loop it will be unique for every row.

ABC PDF version 6.0 Form Fields Read Only

We have a VB.NET program that is using Supergoo's ABCPDF version 6.1.1.2. Our program takes standard XML strings and places values in a corresponding PDF form field on the template PDF.
Problem:
We have over 3000 PDF files that have all been "tagged" with form fields. There could be up to 50 form fields on the template PDFs for a total of roughly 150,000 form fields in use potentially. We have noticed that some of these form fields have their form field common properties set to hidden by mistake. (see screenshot)
The issue is that the PDF coming back after the string values have been added are not showing up. Duh right? Fix the form field property and call it done. However, there is no way to know how many other of the other 150,000 form fields have been improperly tagged like this.
Does anyone know if I can adjust the PDF generation program to forcefully ignore that form field common property? Here is a sample of the vb.net code I am hoping to slightly alter...
Dim theDoc As Doc = New Doc
theDoc.Form.Fields("SampleFieldName").?????? 'can we set something here to ignore the hidden property?
According to the docs at
http://www.websupergoo.com/helppdfnet/source/6-abcpdf.objects/field/2-properties/page.htm
The .Page property of a Field object will tell you the page the field is on. Since Page is a class, if the result 'Is Nothing' then you know that the field is not visible since it doesn't appears on any page in the PDF document.
Please note that there are a few caveats when using fields that are not hidden but not actually visible when rendered (being too small, being spread on two pages, etc). If you need need to handle that you may be interested in http://www.websupergoo.com/helppdfnet/source/6-abcpdf.objects/field/2-properties/rect.htm depending on your use cases.
For the ABCPDF v6 software, I have discovered through Mihai's suggestion that it is possible. I have coded this C# example in the hopes that it helps someone down the road...
static void SetFillableFieldsToWriteableExample(string origFileLocation, string newFileLocation)
{
Doc theDoc = new Doc();
theDoc.Read(origFileLocation);
var theFields = theDoc.Form.GetFieldNames();
foreach (string theField in theFields)
{
Field theFieldInstance = theDoc.Form[theField];
theDoc.SetInfo(theFieldInstance.ID, "/F", "4");
}
theDoc.Save(newFileLocation);
}
I have tested this and it works when all fields are text fields on the PDF. Not sure on the other field types.
This code should not be used in a production environment as written here. There is no guarantee that the origFileLocation or newFileLocation references a PDF and no error handling among other issues. This is for demonstration purposes only.

get label from notebook tab

I have a gtk.Notebook and i want get text of label from current gtk.noteBook tab.
I make that:
text = self.get_tab_label(self.get_nth_page(self.get_current_page()))
if i print text i see:
But in gtk help i read that: get_tab_label_text: returnvalue: the text of the tab label, or None if the tab label widget is not a gtk.Label.
How can i get tet from label in this situation?
Thank you.
Any gtk.Widget can be a Notebook tab label. It is usually a gtk.Label, but not always. So two API methods exist to cover both situations:
gtk.Notebook.get_tab_label() returns a gtk.Widget that is the label widget. If it is a gtk.Label, you will need to call gtk.Label.get_text() to get the text.
gtk.Notebook.get_tab_label_text() returns a string of text only if the label widget is a gtk.Label, otherwise will return None.