You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Esteban R <er...@hotmail.com> on 2025/07/04 13:08:54 UTC

Rendering issue with type 2 shading: vertical expansion

Hello. For the following pdf (which is a simplification of a real life example) the shading is expanded vertically all the page. Other viewers show a rectangle.
https://drive.google.com/file/d/1bocFsJbOFAlRijKnBUfSBdQ_GVX3oSUQ/view?usp=drive_link

 Is it an issue from pdfbox or maybe it is a problem with the document itself?

Content stream:
q
  0.5 0.5 0.5 rg
  396 615 171 28 re
  W
  f
  /SHQZavYQee sh
Q


Esteban Ruiz



Re: Rendering issue with type 2 shading: vertical expansion

Posted by Tilman Hausherr <TH...@t-online.de>.
On 7/4/2025 4:37 PM, Esteban R wrote:
> I can create a bug report if you want.

Yes please do

Tilman


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


Re: Rendering issue with type 2 shading: vertical expansion

Posted by Mark de Does <ma...@mdedoes.xs4all.nl>.
for me it is strange that the expansion is only in the vertical axis (and not in the horizontal axis).

A PDF axial gradient defines a band with gradually changing colors 
across the band. If your shading does not extrapolate outside its band, 
nothing is drawn at either side of the band. The band is not constrained 
in the direction along its direction. So you must use clipping if you 
want to constrain it in that direction.

It is common practice to use a shading color derived from the shading. 
If you do so, the fill operator takes care of everything.

-- 
Mark de Does, Magdalenastraat 6, 3512 NH Utrecht, the Netherlands,
e: mark@mdedoes.xs4all.nl

On 04-07-2025 16:37, Esteban R wrote:
> Thanks for your answer. I confirm: if I replace "W f" by "W n" in the original document then the rendering is OK.
> Anyway, for me it is strange that the expansion is only in the vertical axis (and not in the horizontal axis).
>
> I can create a bug report if you want. For my use case I can solve the issue with a workaround.
>
> ________________________________
> De: Tilman Hausherr <TH...@t-online.de>
> Enviado: viernes, 4 de julio de 2025 13:36
> Para: users@pdfbox.apache.org <us...@pdfbox.apache.org>
> Asunto: Re: Rendering issue with type 2 shading: vertical expansion
>
> Hi,
>
> It is related to having "W f" instead of "W n" (it works the expected
> way when having "W n"). I think we're not fully correct when handling
> the "n" operator, that one does the handling of the clipping path which
> (maybe) should have been done earlier when handling the "W" operator.
> (Usually "W n" come together) My understanding of the "n" description is
> that it should consume the path.
>
> Tilman
>
> On 7/4/2025 3:08 PM, Esteban R wrote:
>> Hello. For the following pdf (which is a simplification of a real life example) the shading is expanded vertically all the page. Other viewers show a rectangle.
>> https://drive.google.com/file/d/1bocFsJbOFAlRijKnBUfSBdQ_GVX3oSUQ/view?usp=drive_link
>>
>>    Is it an issue from pdfbox or maybe it is a problem with the document itself?
>>
>> Content stream:
>> q
>>     0.5 0.5 0.5 rg
>>     396 615 171 28 re
>>     W
>>     f
>>     /SHQZavYQee sh
>> Q
>>
>>
>> Esteban Ruiz
>>
>>
>>
>
> ---------------------------------------------------------------------
> 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


Re: Rendering issue with type 2 shading: vertical expansion

Posted by Tilman Hausherr <TH...@t-online.de>.
Hi,
this is weird, there were two applications on 4.7, but both were from 
Chinese sounding names. One was approved, one was denied.
Tilman

On 7/10/2025 6:04 AM, Esteban R wrote:
> Thank you!
>
> FYI: I tried to create my user for Jira last Friday to report the bug, but I have not received any news about that yet (and I tried to create a new user but the service says that there is a pending request for my e-mail).
> ________________________________
> De: Tilman Hausherr <TH...@t-online.de>
> Enviado: miércoles, 9 de julio de 2025 11:34
> Para: users@pdfbox.apache.org <us...@pdfbox.apache.org>
> Asunto: Re: Rendering issue with type 2 shading: vertical expansion
>
> Fixed in https://issues.apache.org/jira/browse/PDFBOX-6033
>
> ---------------------------------------------------------------------
> 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


RE: Rendering issue with type 2 shading: vertical expansion

Posted by Esteban R <er...@hotmail.com>.
Thank you!

FYI: I tried to create my user for Jira last Friday to report the bug, but I have not received any news about that yet (and I tried to create a new user but the service says that there is a pending request for my e-mail).
________________________________
De: Tilman Hausherr <TH...@t-online.de>
Enviado: miércoles, 9 de julio de 2025 11:34
Para: users@pdfbox.apache.org <us...@pdfbox.apache.org>
Asunto: Re: Rendering issue with type 2 shading: vertical expansion

Fixed in https://issues.apache.org/jira/browse/PDFBOX-6033

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


Re: Rendering issue with type 2 shading: vertical expansion

Posted by Tilman Hausherr <TH...@t-online.de>.
Fixed in https://issues.apache.org/jira/browse/PDFBOX-6033

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


Re: Rendering issue with type 2 shading: vertical expansion

Posted by Tilman Hausherr <TH...@t-online.de>.
On 7/4/2025 4:37 PM, Esteban R wrote:
> Anyway, for me it is strange that the expansion is only in the vertical axis (and not in the horizontal axis).

I'm too lazy to investigate why it goes wrong the way it does, I'm 
satisfied that it works properly with a small code segment move 😂

Tilman


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


RE: Rendering issue with type 2 shading: vertical expansion

Posted by Esteban R <er...@hotmail.com>.
Thanks for your answer. I confirm: if I replace "W f" by "W n" in the original document then the rendering is OK.
Anyway, for me it is strange that the expansion is only in the vertical axis (and not in the horizontal axis).

I can create a bug report if you want. For my use case I can solve the issue with a workaround.

________________________________
De: Tilman Hausherr <TH...@t-online.de>
Enviado: viernes, 4 de julio de 2025 13:36
Para: users@pdfbox.apache.org <us...@pdfbox.apache.org>
Asunto: Re: Rendering issue with type 2 shading: vertical expansion

Hi,

It is related to having "W f" instead of "W n" (it works the expected
way when having "W n"). I think we're not fully correct when handling
the "n" operator, that one does the handling of the clipping path which
(maybe) should have been done earlier when handling the "W" operator.
(Usually "W n" come together) My understanding of the "n" description is
that it should consume the path.

Tilman

On 7/4/2025 3:08 PM, Esteban R wrote:
> Hello. For the following pdf (which is a simplification of a real life example) the shading is expanded vertically all the page. Other viewers show a rectangle.
> https://drive.google.com/file/d/1bocFsJbOFAlRijKnBUfSBdQ_GVX3oSUQ/view?usp=drive_link
>
>   Is it an issue from pdfbox or maybe it is a problem with the document itself?
>
> Content stream:
> q
>    0.5 0.5 0.5 rg
>    396 615 171 28 re
>    W
>    f
>    /SHQZavYQee sh
> Q
>
>
> Esteban Ruiz
>
>
>


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


Re: Rendering issue with type 2 shading: vertical expansion

Posted by Tilman Hausherr <TH...@t-online.de>.
Hi,

It is related to having "W f" instead of "W n" (it works the expected 
way when having "W n"). I think we're not fully correct when handling 
the "n" operator, that one does the handling of the clipping path which 
(maybe) should have been done earlier when handling the "W" operator. 
(Usually "W n" come together) My understanding of the "n" description is 
that it should consume the path.

Tilman

On 7/4/2025 3:08 PM, Esteban R wrote:
> Hello. For the following pdf (which is a simplification of a real life example) the shading is expanded vertically all the page. Other viewers show a rectangle.
> https://drive.google.com/file/d/1bocFsJbOFAlRijKnBUfSBdQ_GVX3oSUQ/view?usp=drive_link
>
>   Is it an issue from pdfbox or maybe it is a problem with the document itself?
>
> Content stream:
> q
>    0.5 0.5 0.5 rg
>    396 615 171 28 re
>    W
>    f
>    /SHQZavYQee sh
> Q
>
>
> Esteban Ruiz
>
>
>


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