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

Tilman Hausherr edited comment on PDFBOX-6223 at 7/25/26 9:24 AM:
------------------------------------------------------------------

I have a better idea that I'll commit next week: pass the rectangle to 
isValidAppearanceStream() and check whether the width / height difference isn't 
larger than 1.
{code:java}
    private static boolean isValidAppearanceStream(PDRectangle rect, 
PDAppearanceEntry appearance)
    {
        if (appearance == null)
        {
            return false;
        }
        if (!appearance.isStream())
        {
            return false;
        }
        PDRectangle bbox = appearance.getAppearanceStream().getBBox();
        if (bbox == null)
        {
            return false;
        }
        if (Math.abs(rect.getWidth() - bbox.getWidth()) > 1 || 
Math.abs(rect.getHeight() - bbox.getHeight()) > 1)
        {
            // PDFBOX-6223: don't like it if bbox and rectangle are of very 
different sizes
            return false;
        }
        return Math.abs(bbox.getWidth()) > 0 && Math.abs(bbox.getHeight()) > 0;
    }
{code}
The logic of checking if an appearance already exists has been there since at 
least 2014, although there have been changes to check that it is valid, so this 
change keeps the spirit of the implementation.

 !image-2026-07-25-11-24-48-730.png! 


was (Author: tilman):
I have a better idea that I'll commit next week: pass the rectangle to 
isValidAppearanceStream() and check whether the width / height difference isn't 
larger than 1.
{code:java}
    private static boolean isValidAppearanceStream(PDRectangle rect, 
PDAppearanceEntry appearance)
    {
        if (appearance == null)
        {
            return false;
        }
        if (!appearance.isStream())
        {
            return false;
        }
        PDRectangle bbox = appearance.getAppearanceStream().getBBox();
        if (bbox == null)
        {
            return false;
        }
        if (Math.abs(rect.getWidth() - bbox.getWidth()) > 1 || 
Math.abs(rect.getHeight() - bbox.getHeight()) > 1)
        {
            // PDFBOX-6223: don't like it if bbox and rectangle are of very 
different sizes
            return false;
        }
        return Math.abs(bbox.getWidth()) > 0 && Math.abs(bbox.getHeight()) > 0;
    }
{code}
The logic of checking if an appearance already exists has been there since at 
least 2014, although there have been changes to check that it is valid, so this 
change keeps the spirit of the implementation.

> Text areas completely missing on print
> --------------------------------------
>
>                 Key: PDFBOX-6223
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-6223
>             Project: PDFBox
>          Issue Type: Bug
>    Affects Versions: 2.0.37, 3.0.8 PDFBox
>         Environment: Windows 11, macOS 26, Java 11, Java 25
>            Reporter: Tres Finocchiaro
>            Priority: Major
>         Attachments: PDFBOX-6223-missing-AP saved with Adobe.pdf, 
> PDFBOX-6223-missing-AP saved with PDFBox.pdf, 
> image-2026-07-24-11-12-45-327.png, image-2026-07-24-11-12-45-340.png, 
> image-2026-07-25-11-24-48-730.png, missing-text.pdf, screenshot-1.png, 
> screenshot-2.png, screenshot-3.png, screenshot-4.png
>
>
> When printing the attached document, the blocks of text containing the 
> address information are missing.  PDFDebugger does not draw these sections 
> either.
> The attached document was edited with Adobe to remove sensitive information.  
> The original document's metadata says that it was created using cairo 1.17.7 
> / Inkscape 1.3.
> The issue does NOT occur with Google Chrome, macOS Preview or Adobe Acrobat.
>  
> !image-2026-07-24-11-12-45-327.png!!image-2026-07-24-11-12-45-340.png!
>  
>  
> {code:java}
> java -jar $HOME/Downloads/pdfbox-app-3.0.8.jar print 
> --input=$HOME/Downloads/missing-text.pdf{code}
>  
>  



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to