Discussion:
[iText-questions] AcroForm with empty Fields array
Gylfi Ingvason
2009-11-19 19:46:31 UTC
Permalink
Gents,

I use PdfStamper to flatten forms/free text and then typically perform other
operations using either PdfWriter or PdfCopy. This has been working fine
until recently when a customer complained that text fields in an AcroForm
were missing after flattening the form.

Upon investigating, I found that the Fields array of the AcroForm was empty.
The form does not get flattened because PdfStamper thinks there is nothing
to do. To my surprise, neither Acrobat nor the FoxIt Reader complain about
this - presumably because the Widget Annot is referenced by the Page object.

Enclosed is a small file that I created by iText to illustrate the problem.
I have deliberately erased the contents of the Fields array (it was '3 0 R')
of the AcroForm (object 7) to simulate the user data.

Here's the interesting part - not only does the file display fine, but if
you use Acrobat to extract that page, it is smart enough to properly
re-construct the Fields array in the process.

This brings up a couple of questions:

1. Is it valid to not reference Widget Annots in a Form and expect them to
work?

The spec seem unambiguous to me that it isn't valid (see PDF 32000-1:2008
pg. 431: "Fields - (Required) An array of references to the document's root
fields (those with no ancestors in the field hierarchy)."). Chapter 15 of
Bruno's book seems to indicate that as well, but perhaps I'm missing
something.

2. What would be the best approach to deal with a form with an empty Fields
array, such that the text gets flattened, assuming that this is legal?

I have conveyed to the customer that I consider the file damaged and he
should get better tools, but it is hard to argue against things like this
where Acrobat gives no sign of anything being wrong. Thus, a third question:

3. Would it be reasonable to patch the iText code such that form flattening
takes place on Annots not referenced in the Fields array of the form?

Best regards,

Gylfi
Mark Storer
2009-11-19 20:33:04 UTC
Permalink
Acrobat 9 Pro's "PDF Syntax Check" doesn't bat an eye. How very Odd. That makes your "get better tools" argument that much more difficult.



--Mark Storer
Senior Software Engineer
Cardiff.com

#include <disclaimer>
typedef std::Disclaimer<Cardiff> DisCard;
-----Original Message-----
Sent: Thursday, November 19, 2009 11:47 AM
Subject: [iText-questions] AcroForm with empty Fields array
Gents,
I use PdfStamper to flatten forms/free text and then
typically perform other
operations using either PdfWriter or PdfCopy. This has been
working fine
until recently when a customer complained that text fields in
an AcroForm
were missing after flattening the form.
Upon investigating, I found that the Fields array of the
AcroForm was empty.
The form does not get flattened because PdfStamper thinks
there is nothing
to do. To my surprise, neither Acrobat nor the FoxIt Reader
complain about
this - presumably because the Widget Annot is referenced by
the Page object.
Enclosed is a small file that I created by iText to
illustrate the problem.
I have deliberately erased the contents of the Fields array
(it was '3 0 R')
of the AcroForm (object 7) to simulate the user data.
Here's the interesting part - not only does the file display
fine, but if
you use Acrobat to extract that page, it is smart enough to properly
re-construct the Fields array in the process.
1. Is it valid to not reference Widget Annots in a Form and
expect them to
work?
The spec seem unambiguous to me that it isn't valid (see PDF
32000-1:2008
pg. 431: "Fields - (Required) An array of references to the
document's root
fields (those with no ancestors in the field hierarchy).").
Chapter 15 of
Bruno's book seems to indicate that as well, but perhaps I'm missing
something.
2. What would be the best approach to deal with a form with
an empty Fields
array, such that the text gets flattened, assuming that this is legal?
I have conveyed to the customer that I consider the file
damaged and he
should get better tools, but it is hard to argue against
things like this
where Acrobat gives no sign of anything being wrong. Thus, a
3. Would it be reasonable to patch the iText code such that
form flattening
takes place on Annots not referenced in the Fields array of the form?
Best regards,
Gylfi
Gylfi Ingvason
2009-11-20 16:21:05 UTC
Permalink
Thanks Mark.

With Acrobat blessing this behavior, I don't think I've got much choice here
- if the Fields array is empty I need to iterate through the Annotation
lists and heard up the Widget objects. I suppose it would not be fair of me
to ask that the FormFlattening code do that for me, but I'll suggest that
anyway in light of the Syntax Checker saying that the PDF is good.

Just as a side note, I'm not sure that we're doing anyone a favor with
accepting bad practices and "fixing" questionable behavior. Recently I was
asked to take a look at a PDF file that crashed some post-processing tools,
but it worked fine if it was processed by us (using iText) first. What I
found was that someone had attempted to concatenate two PDFs using 'copy/b
file1+file2 finalFile' or something like that. When you use PdfWriter to
import the pages in the resulting "PDF" file, it will work like a charm - it
is just a file with a damaged Xref - no big deal. Same thing in Acrobat -
you get a "Do you want to save your changes?" dialog when you close the
viewer, but otherwise there is no hint that the file is garbage.

Anyway, thanks again for taking the time to look at file and respond.

Best regards,

Gylfi

-----Original Message-----
From: Mark Storer [mailto:***@autonomy.com]
Sent: Thursday, November 19, 2009 3:33 PM
To: ***@SolimarSystems.com; Post all your questions about iText
here
Subject: Re: [iText-questions] AcroForm with empty Fields array


Acrobat 9 Pro's "PDF Syntax Check" doesn't bat an eye. How very Odd. That
makes your "get better tools" argument that much more difficult.



--Mark Storer
Senior Software Engineer
Cardiff.com

#include <disclaimer>
typedef std::Disclaimer<Cardiff> DisCard;
-----Original Message-----
Sent: Thursday, November 19, 2009 11:47 AM
Subject: [iText-questions] AcroForm with empty Fields array
Gents,
I use PdfStamper to flatten forms/free text and then
typically perform other
operations using either PdfWriter or PdfCopy. This has been
working fine
until recently when a customer complained that text fields in
an AcroForm
were missing after flattening the form.
Upon investigating, I found that the Fields array of the
AcroForm was empty.
The form does not get flattened because PdfStamper thinks
there is nothing
to do. To my surprise, neither Acrobat nor the FoxIt Reader
complain about
this - presumably because the Widget Annot is referenced by
the Page object.
Enclosed is a small file that I created by iText to
illustrate the problem.
I have deliberately erased the contents of the Fields array
(it was '3 0 R')
of the AcroForm (object 7) to simulate the user data.
Here's the interesting part - not only does the file display
fine, but if
you use Acrobat to extract that page, it is smart enough to properly
re-construct the Fields array in the process.
1. Is it valid to not reference Widget Annots in a Form and
expect them to
work?
The spec seem unambiguous to me that it isn't valid (see PDF
32000-1:2008
pg. 431: "Fields - (Required) An array of references to the
document's root
fields (those with no ancestors in the field hierarchy).").
Chapter 15 of
Bruno's book seems to indicate that as well, but perhaps I'm missing
something.
2. What would be the best approach to deal with a form with
an empty Fields
array, such that the text gets flattened, assuming that this is legal?
I have conveyed to the customer that I consider the file
damaged and he
should get better tools, but it is hard to argue against
things like this
where Acrobat gives no sign of anything being wrong. Thus, a
3. Would it be reasonable to patch the iText code such that
form flattening
takes place on Annots not referenced in the Fields array of the form?
Best regards,
Gylfi
----------------------------------------------------------------------------
--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus
on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
iText-questions mailing list
iText-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions:
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/
Leonard Rosenthol
2009-11-21 22:28:28 UTC
Permalink
There is nothing that says that all Widget annotations have to be listed in the Fields array - they can just be regular annotations. It's weird, but not illegal.

Leonard

-----Original Message-----
From: Gylfi Ingvason [mailto:***@SolimarSystems.com]
Sent: Thursday, November 19, 2009 2:47 PM
To: itext-***@lists.sourceforge.net
Subject: [iText-questions] AcroForm with empty Fields array

Gents,

I use PdfStamper to flatten forms/free text and then typically perform other operations using either PdfWriter or PdfCopy. This has been working fine until recently when a customer complained that text fields in an AcroForm were missing after flattening the form.

Upon investigating, I found that the Fields array of the AcroForm was empty.
The form does not get flattened because PdfStamper thinks there is nothing to do. To my surprise, neither Acrobat nor the FoxIt Reader complain about this - presumably because the Widget Annot is referenced by the Page object.

Enclosed is a small file that I created by iText to illustrate the problem.
I have deliberately erased the contents of the Fields array (it was '3 0 R') of the AcroForm (object 7) to simulate the user data.

Here's the interesting part - not only does the file display fine, but if you use Acrobat to extract that page, it is smart enough to properly re-construct the Fields array in the process.

This brings up a couple of questions:

1. Is it valid to not reference Widget Annots in a Form and expect them to work?

The spec seem unambiguous to me that it isn't valid (see PDF 32000-1:2008 pg. 431: "Fields - (Required) An array of references to the document's root fields (those with no ancestors in the field hierarchy)."). Chapter 15 of Bruno's book seems to indicate that as well, but perhaps I'm missing something.

2. What would be the best approach to deal with a form with an empty Fields array, such that the text gets flattened, assuming that this is legal?

I have conveyed to the customer that I consider the file damaged and he should get better tools, but it is hard to argue against things like this where Acrobat gives no sign of anything being wrong. Thus, a third question:

3. Would it be reasonable to patch the iText code such that form flattening takes place on Annots not referenced in the Fields array of the form?

Best regards,

Gylfi
Gylfi Ingvason
2009-11-23 14:52:45 UTC
Permalink
Thanks Leonard.

Since that is the case, I would suggest that the flatten form code in the
PdfStamper be amended to take that into account.

Paulo/Bruno would you agree?

I'm not familiar with the code that does this, but I'd be happy to try to
tackle it and submit the changes for review if that's what it takes.

Gylfi

-----Original Message-----
From: Leonard Rosenthol [mailto:***@adobe.com]
Sent: Saturday, November 21, 2009 5:28 PM
To: ***@SolimarSystems.com; Post all your questions about iText
here
Subject: RE: [iText-questions] AcroForm with empty Fields array


There is nothing that says that all Widget annotations have to be listed in
the Fields array - they can just be regular annotations. It's weird, but
not illegal.

Leonard

-----Original Message-----
From: Gylfi Ingvason [mailto:***@SolimarSystems.com]
Sent: Thursday, November 19, 2009 2:47 PM
To: itext-***@lists.sourceforge.net
Subject: [iText-questions] AcroForm with empty Fields array

Gents,

I use PdfStamper to flatten forms/free text and then typically perform other
operations using either PdfWriter or PdfCopy. This has been working fine
until recently when a customer complained that text fields in an AcroForm
were missing after flattening the form.

Upon investigating, I found that the Fields array of the AcroForm was empty.
The form does not get flattened because PdfStamper thinks there is nothing
to do. To my surprise, neither Acrobat nor the FoxIt Reader complain about
this - presumably because the Widget Annot is referenced by the Page object.

Enclosed is a small file that I created by iText to illustrate the problem.
I have deliberately erased the contents of the Fields array (it was '3 0 R')
of the AcroForm (object 7) to simulate the user data.

Here's the interesting part - not only does the file display fine, but if
you use Acrobat to extract that page, it is smart enough to properly
re-construct the Fields array in the process.

This brings up a couple of questions:

1. Is it valid to not reference Widget Annots in a Form and expect them to
work?

The spec seem unambiguous to me that it isn't valid (see PDF 32000-1:2008
pg. 431: "Fields - (Required) An array of references to the document's root
fields (those with no ancestors in the field hierarchy)."). Chapter 15 of
Bruno's book seems to indicate that as well, but perhaps I'm missing
something.

2. What would be the best approach to deal with a form with an empty Fields
array, such that the text gets flattened, assuming that this is legal?

I have conveyed to the customer that I consider the file damaged and he
should get better tools, but it is hard to argue against things like this
where Acrobat gives no sign of anything being wrong. Thus, a third question:

3. Would it be reasonable to patch the iText code such that form flattening
takes place on Annots not referenced in the Fields array of the form?

Best regards,

Gylfi
1T3XT info
2009-11-23 15:01:40 UTC
Permalink
Post by Gylfi Ingvason
Thanks Leonard.
Since that is the case, I would suggest that the flatten form code in the
PdfStamper be amended to take that into account.
Paulo/Bruno would you agree?
I'm not familiar with the code that does this, but I'd be happy to try to
tackle it and submit the changes for review if that's what it takes.
I have code that fixes that problem somewhere,
but I don't remember on which computer...
I'll see if I can find it.
br,
Bruno
Paulo Soares
2009-11-23 15:05:39 UTC
Permalink
I'm not sure if I understand all this. It's legal to have fields that only exist as widgets but don't have an entry in the field array in acroforms?

The pdf reference says about the /Fields entry in acroforms:

(Required) An array of references to the document's root fields (those with no ancestors in the field hierarchy).

I think that Leonard was refering to widgets as a way to show an appearance but not actual fields.

Paulo
-----Original Message-----
Sent: Monday, November 23, 2009 2:53 PM
To: 'Leonard Rosenthol'; 'Post all your questions about iText here'
Subject: Re: [iText-questions] AcroForm with empty Fields array
Thanks Leonard.
Since that is the case, I would suggest that the flatten form
code in the
PdfStamper be amended to take that into account.
Paulo/Bruno would you agree?
I'm not familiar with the code that does this, but I'd be
happy to try to
tackle it and submit the changes for review if that's what it takes.
Gylfi
-----Original Message-----
Sent: Saturday, November 21, 2009 5:28 PM
questions about iText
here
Subject: RE: [iText-questions] AcroForm with empty Fields array
There is nothing that says that all Widget annotations have
to be listed in
the Fields array - they can just be regular annotations.
It's weird, but
not illegal.
Leonard
-----Original Message-----
Sent: Thursday, November 19, 2009 2:47 PM
Subject: [iText-questions] AcroForm with empty Fields array
Gents,
I use PdfStamper to flatten forms/free text and then
typically perform other
operations using either PdfWriter or PdfCopy. This has been
working fine
until recently when a customer complained that text fields in
an AcroForm
were missing after flattening the form.
Upon investigating, I found that the Fields array of the
AcroForm was empty.
The form does not get flattened because PdfStamper thinks
there is nothing
to do. To my surprise, neither Acrobat nor the FoxIt Reader
complain about
this - presumably because the Widget Annot is referenced by
the Page object.
Enclosed is a small file that I created by iText to
illustrate the problem.
I have deliberately erased the contents of the Fields array
(it was '3 0 R')
of the AcroForm (object 7) to simulate the user data.
Here's the interesting part - not only does the file display
fine, but if
you use Acrobat to extract that page, it is smart enough to properly
re-construct the Fields array in the process.
1. Is it valid to not reference Widget Annots in a Form and
expect them to
work?
The spec seem unambiguous to me that it isn't valid (see PDF
32000-1:2008
pg. 431: "Fields - (Required) An array of references to the
document's root
fields (those with no ancestors in the field hierarchy).").
Chapter 15 of
Bruno's book seems to indicate that as well, but perhaps I'm missing
something.
2. What would be the best approach to deal with a form with
an empty Fields
array, such that the text gets flattened, assuming that this is legal?
I have conveyed to the customer that I consider the file
damaged and he
should get better tools, but it is hard to argue against
things like this
where Acrobat gives no sign of anything being wrong. Thus, a
3. Would it be reasonable to patch the iText code such that
form flattening
takes place on Annots not referenced in the Fields array of the form?
Best regards,
Gylfi
Aviso Legal:
Esta mensagem � destinada exclusivamente ao destinat�rio. Pode conter informa��o confidencial ou legalmente protegida. A incorrecta transmiss�o desta mensagem n�o significa a perca de confidencialidade. Se esta mensagem for recebida por engano, por favor envie-a de volta para o remetente e apague-a do seu sistema de imediato. � proibido a qualquer pessoa que n�o o destinat�rio de usar, revelar ou distribuir qualquer parte desta mensagem.

Disclaimer:
This message is destined exclusively to the intended receiver. It may contain confidential or legally protected information. The incorrect transmission of this message does not mean the loss of its confidentiality. If this message is received by mistake, please send it back to the sender and delete it from your system immediately. It is forbidden to any person who is not the intended receiver to use, distribute or copy any part of this message.
Leonard Rosenthol
2009-11-23 21:49:06 UTC
Permalink
A Widget annotation does NOT have be an AcroForm field - it can just be an annotation on the page. (granted, that would be strange and probably not very useful - but it's perfectly legal).

Leonard

-----Original Message-----
From: Paulo Soares [mailto:***@glintt.com]
Sent: Monday, November 23, 2009 10:06 AM
To: Post all your questions about iText here
Subject: Re: [iText-questions] AcroForm with empty Fields array

I'm not sure if I understand all this. It's legal to have fields that only exist as widgets but don't have an entry in the field array in acroforms?

The pdf reference says about the /Fields entry in acroforms:

(Required) An array of references to the document's root fields (those with no ancestors in the field hierarchy).

I think that Leonard was refering to widgets as a way to show an appearance but not actual fields.

Paulo
-----Original Message-----
Sent: Monday, November 23, 2009 2:53 PM
To: 'Leonard Rosenthol'; 'Post all your questions about iText here'
Subject: Re: [iText-questions] AcroForm with empty Fields array
Thanks Leonard.
Since that is the case, I would suggest that the flatten form code in
the PdfStamper be amended to take that into account.
Paulo/Bruno would you agree?
I'm not familiar with the code that does this, but I'd be happy to try
to tackle it and submit the changes for review if that's what it
takes.
Gylfi
-----Original Message-----
Sent: Saturday, November 21, 2009 5:28 PM
iText here
Subject: RE: [iText-questions] AcroForm with empty Fields array
There is nothing that says that all Widget annotations have
to be listed in
the Fields array - they can just be regular annotations.
It's weird, but
not illegal.
Leonard
-----Original Message-----
Sent: Thursday, November 19, 2009 2:47 PM
Subject: [iText-questions] AcroForm with empty Fields array
Gents,
I use PdfStamper to flatten forms/free text and then
typically perform other
operations using either PdfWriter or PdfCopy. This has been
working fine
until recently when a customer complained that text fields in
an AcroForm
were missing after flattening the form.
Upon investigating, I found that the Fields array of the
AcroForm was empty.
The form does not get flattened because PdfStamper thinks
there is nothing
to do. To my surprise, neither Acrobat nor the FoxIt Reader
complain about
this - presumably because the Widget Annot is referenced by
the Page object.
Enclosed is a small file that I created by iText to
illustrate the problem.
I have deliberately erased the contents of the Fields array
(it was '3 0 R')
of the AcroForm (object 7) to simulate the user data.
Here's the interesting part - not only does the file display
fine, but if
you use Acrobat to extract that page, it is smart enough to properly
re-construct the Fields array in the process.
1. Is it valid to not reference Widget Annots in a Form and
expect them to
work?
The spec seem unambiguous to me that it isn't valid (see PDF
32000-1:2008
pg. 431: "Fields - (Required) An array of references to the
document's root
fields (those with no ancestors in the field hierarchy).").
Chapter 15 of
Bruno's book seems to indicate that as well, but perhaps I'm missing
something.
2. What would be the best approach to deal with a form with
an empty Fields
array, such that the text gets flattened, assuming that this is legal?
I have conveyed to the customer that I consider the file
damaged and he
should get better tools, but it is hard to argue against
things like this
where Acrobat gives no sign of anything being wrong. Thus, a
3. Would it be reasonable to patch the iText code such that
form flattening
takes place on Annots not referenced in the Fields array of the form?
Best regards,
Gylfi
Aviso Legal: Esta mensagem ? destinada exclusivamente ao destinat?rio. Pode conter informa??o confidencial ou legalmente protegida. A incorrecta transmiss?o desta mensagem n?o significa a perca de confidencialidade. Se esta mensagem for recebida por engano, por favor envie-a de volta para o remetente e apague-a do seu sistema de imediato. ? proibido a qualquer pessoa que n?o o destinat?rio de usar, revelar ou distribuir qualquer parte desta mensagem. Disclaimer: This message is destined exclusively to the intended receiver. It may contain confidential or legally protected information. The incorrect transmission of this message does not mean the loss of its confidentiality. If this message is received by mistake, please send it back to the sender and delete it from your system immediately. It is forbidden to any person who is not the intended receiver to use, distribute or copy any part of this message.
1T3XT info
2009-11-23 15:06:28 UTC
Permalink
Post by Gylfi Ingvason
Thanks Leonard.
Since that is the case, I would suggest that the flatten form code in the
PdfStamper be amended to take that into account.
Found it! But some changes are needed.
The comments are in Dutch, and the code assumes that
all the annotations in each page are widget annotations.
I should clean the code up and add more checks.

public static void main(String[] args)
throws IOException, DocumentException {
PdfReader reader = new PdfReader("sworn_DOWA_en.pdf");
// formulier ophalen
PdfDictionary root = reader.getCatalog();
PdfDictionary form = root.getAsDict(PdfName.ACROFORM);
PdfArray fields = form.getAsArray(PdfName.FIELDS);
// fields is leeg en dit zou niet mogen

// pagina's ophalen
PdfDictionary pages = root.getAsDict(PdfName.PAGES);
PdfArray kids = pages.getAsArray(PdfName.KIDS);
PdfDictionary page;
// annotaties van de pagina toevoegen als form fields
PdfArray annots;
for (int i = 0; i < kids.size(); i++) {
page = (PdfDictionary)kids.getDirectObject(i);
annots = page.getAsArray(PdfName.ANNOTS);
for (int j = 0; j < annots.size(); j++) {
fields.add(annots.getPdfObject(j));
}
}
// de gewijzigde file saven
PdfStamper stamper = new PdfStamper(reader,
new FileOutputStream("new_form.pdf"));
stamper.close();

// testen welke velden er gevonden worden
reader = new PdfReader("new_form.pdf");
AcroFields formfields = reader.getAcroFields();
for (Iterator i = formfields.getFields().keySet().iterator();
i.hasNext();) {
System.out.println(i.next());
}
}
Gylfi Ingvason
2009-11-23 15:21:26 UTC
Permalink
Awesome! Thanks a lot Bruno - you guys are the best.

Gylfi

-----Original Message-----
From: 1T3XT info [mailto:***@1t3xt.info]
Sent: Monday, November 23, 2009 10:06 AM
To: Post all your questions about iText here
Subject: Re: [iText-questions] AcroForm with empty Fields array
Post by Gylfi Ingvason
Thanks Leonard.
Since that is the case, I would suggest that the flatten form code in
the PdfStamper be amended to take that into account.
Found it! But some changes are needed.
The comments are in Dutch, and the code assumes that all the annotations in
each page are widget annotations.
I should clean the code up and add more checks.

public static void main(String[] args)
throws IOException, DocumentException {
PdfReader reader = new PdfReader("sworn_DOWA_en.pdf");
// formulier ophalen
PdfDictionary root = reader.getCatalog();
PdfDictionary form = root.getAsDict(PdfName.ACROFORM);
PdfArray fields = form.getAsArray(PdfName.FIELDS);
// fields is leeg en dit zou niet mogen

// pagina's ophalen
PdfDictionary pages = root.getAsDict(PdfName.PAGES);
PdfArray kids = pages.getAsArray(PdfName.KIDS);
PdfDictionary page;
// annotaties van de pagina toevoegen als form fields
PdfArray annots;
for (int i = 0; i < kids.size(); i++) {
page = (PdfDictionary)kids.getDirectObject(i);
annots = page.getAsArray(PdfName.ANNOTS);
for (int j = 0; j < annots.size(); j++) {
fields.add(annots.getPdfObject(j));
}
}
// de gewijzigde file saven
PdfStamper stamper = new PdfStamper(reader,
new FileOutputStream("new_form.pdf"));
stamper.close();

// testen welke velden er gevonden worden
reader = new PdfReader("new_form.pdf");
AcroFields formfields = reader.getAcroFields();
for (Iterator i = formfields.getFields().keySet().iterator();
i.hasNext();) {
System.out.println(i.next());
}
}

----------------------------------------------------------------------------
--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus
on what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
iText-questions mailing list
iText-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions:
http://www.1t3xt.info/examples/ You can also search the keywords list:
http://1t3xt.info/tutorials/keywords/
Mark Storer
2009-12-02 17:07:01 UTC
Permalink
Actually, I do things that would qualify All The Time: Icon-only pushbuttons that are always read-only.

I find annotations to be easier to reposition/duplicate than content.

--Mark Storer
Senior Software Engineer
Cardiff.com

#include <disclaimer>
typedef std::Disclaimer<Cardiff> DisCard;
-----Original Message-----
Sent: Monday, November 23, 2009 1:49 PM
To: Post all your questions about iText here
Subject: Re: [iText-questions] AcroForm with empty Fields array
A Widget annotation does NOT have be an AcroForm field - it
can just be an annotation on the page. (granted, that would
be strange and probably not very useful - but it's perfectly legal).
Leonard
-----Original Message-----
Sent: Monday, November 23, 2009 10:06 AM
To: Post all your questions about iText here
Subject: Re: [iText-questions] AcroForm with empty Fields array
I'm not sure if I understand all this. It's legal to have
fields that only exist as widgets but don't have an entry in
the field array in acroforms?
(Required) An array of references to the document's root
fields (those with no ancestors in the field hierarchy).
I think that Leonard was refering to widgets as a way to show
an appearance but not actual fields.
Paulo
-----Original Message-----
Sent: Monday, November 23, 2009 2:53 PM
To: 'Leonard Rosenthol'; 'Post all your questions about iText here'
Subject: Re: [iText-questions] AcroForm with empty Fields array
Thanks Leonard.
Since that is the case, I would suggest that the flatten
form code in
the PdfStamper be amended to take that into account.
Paulo/Bruno would you agree?
I'm not familiar with the code that does this, but I'd be
happy to try
to tackle it and submit the changes for review if that's what it
takes.
Gylfi
-----Original Message-----
Sent: Saturday, November 21, 2009 5:28 PM
questions about
iText here
Subject: RE: [iText-questions] AcroForm with empty Fields array
There is nothing that says that all Widget annotations have
to be listed in
the Fields array - they can just be regular annotations.
It's weird, but
not illegal.
Leonard
-----Original Message-----
Sent: Thursday, November 19, 2009 2:47 PM
Subject: [iText-questions] AcroForm with empty Fields array
Gents,
I use PdfStamper to flatten forms/free text and then
typically perform other
operations using either PdfWriter or PdfCopy. This has been
working fine
until recently when a customer complained that text fields in
an AcroForm
were missing after flattening the form.
Upon investigating, I found that the Fields array of the
AcroForm was empty.
The form does not get flattened because PdfStamper thinks
there is nothing
to do. To my surprise, neither Acrobat nor the FoxIt Reader
complain about
this - presumably because the Widget Annot is referenced by
the Page object.
Enclosed is a small file that I created by iText to
illustrate the problem.
I have deliberately erased the contents of the Fields array
(it was '3 0 R')
of the AcroForm (object 7) to simulate the user data.
Here's the interesting part - not only does the file display
fine, but if
you use Acrobat to extract that page, it is smart enough to properly
re-construct the Fields array in the process.
1. Is it valid to not reference Widget Annots in a Form and
expect them to
work?
The spec seem unambiguous to me that it isn't valid (see PDF
32000-1:2008
pg. 431: "Fields - (Required) An array of references to the
document's root
fields (those with no ancestors in the field hierarchy).").
Chapter 15 of
Bruno's book seems to indicate that as well, but perhaps I'm missing
something.
2. What would be the best approach to deal with a form with
an empty Fields
array, such that the text gets flattened, assuming that
this is legal?
I have conveyed to the customer that I consider the file
damaged and he
should get better tools, but it is hard to argue against
things like this
where Acrobat gives no sign of anything being wrong. Thus, a
3. Would it be reasonable to patch the iText code such that
form flattening
takes place on Annots not referenced in the Fields array of
the form?
Best regards,
Gylfi
Aviso Legal: Esta mensagem ? destinada exclusivamente ao
destinat?rio. Pode conter informa??o confidencial ou
legalmente protegida. A incorrecta transmiss?o desta mensagem
n?o significa a perca de confidencialidade. Se esta mensagem
for recebida por engano, por favor envie-a de volta para o
remetente e apague-a do seu sistema de imediato. ? proibido a
qualquer pessoa que n?o o destinat?rio de usar, revelar ou
distribuir qualquer parte desta mensagem. Disclaimer: This
message is destined exclusively to the intended receiver. It
may contain confidential or legally protected information.
The incorrect transmission of this message does not mean the
loss of its confidentiality. If this message is received by
mistake, please send it back to the sender and delete it from
your system immediately. It is forbidden to any person who is
not the intended receiver to use, distribute or copy any part
of this message.
--------------------------------------------------------------
----------------
Let Crystal Reports handle the reporting - Free Crystal
Reports 2008 30-Day
trial. Simplify your report design, integration and
deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
iText-questions mailing list
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://www.1t3xt.com/docs/book.php
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/
Loading...