Search code examples
pdfacrobat

Fill and sign for PDF file not working using Acrobat Reader DC


I'm asking this here because given the searches I've done, it appears Adobe's support is next to non-existent. I have, according to this online validation tool:

https://www.pdf-online.com/osa/validate.aspx

A perfectly valid PDF, which is generated from code. However, when using Acrobat Reader DC I am unable to use Fill And Sign - when attempting to sign, it throws this error:

The operation failed because Adobe Acrobat encountered an unknown error

This is the offending PDF:

https://github.com/DelphiWorlds/MiscStuff/blob/master/Test/PDF/SigningNoWork.pdf

This is one which is very similar, where Fill and Sign works:

https://github.com/DelphiWorlds/MiscStuff/blob/master/Test/PDF/SigningWorks.pdf

Foxit Reader has no issue with either of them - Fill and Sign works without fail.

I would post the source of the files, however because they have binary data, I figure links to them is better.

The question is: why does the first one fail to work, but not the second?


Solution

  • In your non-working file all the fonts are defined with

    /FirstChar 30
    /LastChar 255
    

    i.e. having 226 glyphs. Their respective Widths arrays only have 224 entries, though, so they are incomplete.

    After adding two entries to each Widths array, Adobe Reader here does not run into that unknown error anymore during Fill And Sign.


    As the OP inquired how exactly I changed those widths arrays:

    I wanted the change to have as few side effects as possible, so I was glad to see that there was some empty space in the font dictionaries in question, so a trivial hex editing sufficed, no need to shift indirect objects and update cross references:

    In each of those font definitions in the objects 5, 7, 9, and 11 the Widths array is the last dictionary entry value and ends with some white space, after the last width we have these bytes:

    20 0D 0A 5D 0D 0A 3E 3E --- space CR NL ']' CR NL '>' '>'
    

    I added two 0 values using the white space:

    20 30 20 30 20 5D 3E 3E --- space '0' space '0' space ']' '>' '>'