pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Lehmkuehler <andr...@lehmi.de>
Subject Re: Flattening a Form
Date Mon, 27 Feb 2017 07:06:56 GMT
Hi,

I'm not a form expert, but how about using PDAcroForm#flatten? AFAIK this should 
do the trick.

BR
Andreas

Am 27.02.2017 um 03:52 schrieb Aaron Mulder:
> Right now I have an "original" PDF document with blank form fields.
>
> I've appended to the end a document revision that includes a set of
> overrides to specify values for those form fields.  However, for a
> variety of reasons I've ended up specifying appearance streams and
> setting /NeedAppearances true as well.
>
> I thought this was working pretty well, but I've run into two problems:
>
> 1. I have a printer you can send a PDF to, but it prints all form
> fields blank (I guess, ignores appearance streams).  I believe I tried
> the PrintPDF command line tool and it worked OK, but I'd rather just
> send the PDF via lpr, for instance.
>
> 2. macOS Sierra in Preview (and thus Safari) no longer renders my
> appearance streams, but uses some kind of default appearance instead
> (default font size, positioning, checkbox icons, etc.).  Up to El
> Capitan it worked fine.
>
> For both these reasons I would prefer to eliminate the form fields
> when I append to the original document, and make my appearance streams
> just be content on the page, if possible.  I gather this is called
> "flattening" and I saw something that said I should just remove the
> AcroForm fields and the annotations would remain, or something like
> that.
>
> But my override goes in an element like this:
>
> 21 0 obj
> << /Type /Annot /T (SomeLabel) /DV () /Rect [ 383.519 702.104 473.519 717.761
> ] /FT /Tx /DA (/Helvetica 12 Tf 0 g) /F 4 /MK 2560 0 R /V (SomeValue)
> /AP << /N 123 0 R >>
> /Subtype /Widget >>
>
> Now the AcroForm list of Fields includes 21 0 R, and object 21 0 is
> also an annotation -- so I'm confused about how to remove the form
> field but leave the annotation (aren't they the same?).  Other than
> the AcroForm list, I don't see any other way that object 21 0 is
> included in the document, and I know my appearance stream is not
> included any way other than the reference in 21 0, so if I take out
> the AcroForm fields won't the whole thing disappear?
>
> Any tips on how to properly "flatten" this?
>
> And any idea whether this is a likely way to solve the two problems
> I've had?  Or is there some other mistake I'm making?
>
> Thanks,
>        Aaron
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


Mime
View raw message