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

ASF subversion and git services commented on PDFBOX-5627:
---------------------------------------------------------

Commit 1910743 from Tilman Hausherr in branch 'pdfbox/branches/2.0'
[ https://svn.apache.org/r1910743 ]

PDFBOX-5627: bugfix

> Fonts are not subsetted when saving incrementally
> -------------------------------------------------
>
>                 Key: PDFBOX-5627
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-5627
>             Project: PDFBox
>          Issue Type: Bug
>          Components: PDModel
>    Affects Versions: 2.0.28, 3.0.0 PDFBox
>            Reporter: DvdM
>            Assignee: Tilman Hausherr
>            Priority: Major
>             Fix For: 2.0.30, 3.0.0 PDFBox
>
>         Attachments: IncrementalSubsetFontBug1.java, 
> IncrementalSubsetFontBug2.java
>
>
> I've noticed saving documents incrementally does not trigger fonts to be 
> subsetted.
> The function {{PDDocument.save()}} contains the following code:
> {code:java}
> // subset designated fonts
> for (PDFont font : fontsToSubset)
> {
>     font.subset();
> }
> fontsToSubset.clear();
> {code}
> However, this code to subset fonts does not seem te be included in the 
> {{PDDocument.saveIncremental(...)}} and 
> {{PDDocument.saveIncrementalForExternalSigning(...)}} functions. When loading 
> a font and indicating it should be subset, the font will be used in the 
> appearance stream as if subsetted, but it won't be in the end, resulting in a 
> corrupt file.
> h3. Solution
> I propose to also call subset when signing incrementally.
> I use this for files to which I add multiple signatures. In between 
> signatures, text fields are filled in using PDFBox. Since the fields are not 
> user-editable, fonts can be subsetted since the value cannot be changed 
> afterwards.
> h3. Reproduce
> I have attached 2 files to reproduce this issue. In both files you can change 
> {{saveIncremental()}} by {{save()}} or manually call {{font.subset()}} and 
> the output will be valid.
> Note: both files are minimal reproducible files just designed to trigger this 
> issue, that's why the implementations don't make sense (especially the first 
> file).



--
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