[ 
https://issues.apache.org/jira/browse/PDFBOX-5583?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17706957#comment-17706957
 ] 

Michael Klink edited comment on PDFBOX-5583 at 3/30/23 4:53 PM:
----------------------------------------------------------------

{quote}I have included an example file where the field named 
`incrementalChangeField` goes from `NotoSans-Regular` to `NotoSansCJK-Regular` 
during the incremental change, but the font resource does not get added.{quote}

Indeed, the font resources of that field do not change. Most likely you forgot 
a {{setNeedToBeUpdated}} somewhere. You say you _have also tried to mark the 
document's PDResource as `setNeedToBeUpdated(true)` but to no avail._ It does 
not suffice to mark the overall *Resources* dictionary as changed, you also 
have to mark the dictionaries therein, in particular the value of *Font*.

{quote}Related-ish: a similar-ish thing happens when I add a new field to the 
document after the first signing. In this case, I can see some bits and pieces 
of the new field in the version change, but something about it is missing and 
it won't render the new field in Preview, etc.{quote}

Most likely you here also forgot to mark some objects as changed.


was (Author: mkl):
{quote}I have included an example file where the field named 
`incrementalChangeField` goes from `NotoSans-Regular` to `NotoSansCJK-Regular` 
during the incremental change, but the font resource does not get added.{quote}

Indeed, the font resources of that field do not change. Most likely you forgot 
a {{setNeedToBeUpdated}} somewhere. You say you _have also tried to mark the 
document's PDResource as `setNeedToBeUpdated(true)` but to no avail._ It does 
not suffice to mark the overall *Resources* dictionary as changed, you also 
have to mark the dictionaries therein, in particular the value of *Font*.


> Adding font (or changing font subset) not coming through in saveIncremental
> ---------------------------------------------------------------------------
>
>                 Key: PDFBOX-5583
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-5583
>             Project: PDFBox
>          Issue Type: Bug
>          Components: AcroForm, PDModel, Signing
>    Affects Versions: 2.0.24
>            Reporter: Chris Newhouse
>            Priority: Major
>         Attachments: update-after-signature-includes-font-change.pdf
>
>
> In an effort to keep file sizes small, we leverage Font Subsets in our PDFs.
> Also, we already have "incremental change and signing" (where fields are 
> changed _after_ a signature, without voiding the prior signature thanks to 
> using `saveIncremental` and signing the changes) working just fine in most 
> cases.
> However, when the Font on a field is changed or a new Font Subset must be 
> added to the document because the characters used in a field with a 
> tightly-subsetted Font, things don't work correctly:
>  * The signatures stay valid, which is great
>  * But the new Font information does not appear to get written to new version 
> appendix, so you get nonsense rendering in a PDF viewer since the field still 
> points to a Font resource that is either not there or is a subset that does 
> not contain all the necessary characters. I'm not super proficient in this so 
> I don't know exactly what's going on.
>  
> I have ensured that the fields we update are getting marked as 
> `setNeedToBeUpdated(true)` (this is, I believe, why the fields changes _do_ 
> end up in the version changes), it just seems that the Font resources are not 
> getting updated in the version.
> I have also tried to mark the document's PDResource as 
> `setNeedToBeUpdated(true)` but to no avail.
>  
> Is this behavior possible/allowed? Is it a bug or am I doing something wrong?
>  
> I have included an example file where the field named 
> `incrementalChangeField` goes from `NotoSans-Regular` to 
> `NotoSansCJK-Regular` during the incremental change, but the font resource 
> does not get added.
> Thanks for your time!



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: dev-h...@pdfbox.apache.org

Reply via email to