Bug 687498 - PDF Interpreter : Not handled Acroform flag "NeedAppearances"
Summary: PDF Interpreter : Not handled Acroform flag "NeedAppearances"
Status: NOTIFIED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: PDF Interpreter (show other bugs)
Version: 8.14
Hardware: All Windows 2000
: P3 enhancement
Assignee: Alex Cherepanov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-06-03 02:04 UTC by Elamathi
Modified: 2008-12-19 08:31 UTC (History)
3 users (show)

See Also:
Customer:
Word Size: ---


Attachments
sample pdf giving problem (248.19 KB, application/pdf)
2004-06-03 02:05 UTC, Elamathi
Details
patch (6.33 KB, patch)
2005-08-14 21:38 UTC, Alex Cherepanov
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Elamathi 2004-06-03 02:04:01 UTC
Operating System : Linux Suse 8.1
Ghostscript Version :  8.0  /  8.14

Problem
I am trying to convert PDF to Tiff in Linux using AFPL ghostscript 8.0. The 
output tiff is missing form  fields of input PDF. Also I tried the lattest  
AFPL ghostscript 8.14. I got the same result

About PDF File
***************
The PDF file is having an acroform with fields defined. The form has the flag 
called "NeedAppearances" set to true.  And It does not define any stream( even 
Normal streams)  for these fields.  PDF Spec 1.4 says if this flag is true, the 
viewer application has to constuct a stream. I have the doubt that if 
Ghostscript handles this case.

It is a production and very urgent problem.  Any suggestions are appreciated.   
Is there any workaround to overcome this problem. Herewith I have attached the 
sample.

Thank you

Regards
Mathi
Comment 1 Elamathi 2004-06-03 02:05:23 UTC
Created attachment 699 [details]
sample pdf giving problem
Comment 2 Ray Johnston 2004-06-09 10:30:42 UTC
Ghostscript doesn't handle this, nor does xpdf.

This is an enhancement that we may get to some day. If someone
wants to pay for the development of this feature, we will do
this, since it may be useful to others.
Comment 3 Ray Johnston 2005-08-02 23:53:25 UTC
The action that is needed for this case (/Tx == Text Field) is:

  for each object in the Annots entry of the /Page object
    if Annot, SubType Widget has a /Parent that is a member of the Fields object
of the AcroForm object of the Catalog, then
      Display the /V (value) text using the /DA (default appearance) setup to
the graphics state

General handling of other /FT values such as /Btn == button, /Ch == Choice and
/Sig == Signature require different handling. I haven't investigates these.

This is an extension to the /drawannot procedure defined in lib/pdf_draw.ps
and probably isn't too terribly difficult for someone knowledgeable about the
PDF interpreter implementation such as myself or Alex (alexcher@coscript.com).
Comment 4 Alex Cherepanov 2005-08-14 21:38:25 UTC
Created attachment 1615 [details]
patch

Ray,
This is a 1st version of the fix. Please review the general structure of the
program, such as formatting the text in a new text rendering operator.

Although the customer's file renders identically to Adobe Acrobat,
there are many things that are not yet coded.
1. Other types of annotations
2. XML formatting
3. Multi-line text fields
4. Combed text fields
5. Right-aligned or centered text with non-0 word and character spacing
6. Automatic font size selection

Item 6 causes incorrect rendering of the sample file attached to this bug
bug 587498.
Comment 5 leonardo 2006-01-10 18:34:03 UTC
The patch mainly good except few minor things.
1. Please replace dash with underscore in names according to Ghostscript 
tradition.
2. Not clear why undef is applied to draw-terminal-field-dict and isn't applied 
to draw-form-field, draw-terminal-field.

If it doesn't cause a regression, please commit with minor changes and with 
qouting Comment #4 in the log message.

Assigning the bug to Alex since Ray passed it to me.
Comment 6 Alex Cherepanov 2007-04-23 17:06:33 UTC
An improved path that supports automatic font size selection
has been committed as rev. 7878.

The sample file now renders correctly.
Ghostscript generates many warnings that indicate real problems with the file:
- 0 text size is permitted in the AcroForm fields but not in regular
  anniotations.
- The file has unbalanced Q and q operators.