Making PDAbstractContentStream public seems to be the easier solution, but:
It was created package-private. I don't know if (1) John had a specific reason for it or (2) this was just "best practice" to make stuff restricted until somebody requests it to be accessible. However he wrote "unless we want users to subclass PDAbstractContentStream" so he wanted to prevent that, so it would be (1). That makes me undecided.

See here: https://issues.apache.org/jira/browse/PDFBOX-4068

Amusingly not only this is still open but it was me who created it 🤦‍♂️

Tilman

On 28.02.2025 14:22, Mark de Does wrote:
In one of my projects, I convert (a subset of) SVG to PDF, using PdfBox.

In SVG, the contents of the main <svg> element, the <marker>, <symbol> and <pattern> definitions have the same syntax and structure. With PdfBox 2, I use a PDPageContentStream to record the content of all three. With PdfBox 3, that no longer works because I must use a PDPatternContentStream to record a pattern. Because the different kinds of content stream do not share a visible (public) ancestor, I cannot use the same code to record SVG content to a content stream.

This morning, I captured the public methods of PDAbstractContentStream in an interface and declared PDAbstractContentStream to implement that interface. I adapted my code to use the interface and everything works fine. (As expected).

Before I make a PR, I need some guidance.

 * Do you think introducing an interface is overkill? Simply making
   PDAbstractContentStream public would achieve the same thing for me.
   (The class, not the constructor)
 * I chose the name PDContentStream for the interface. Later on, I
   discovered that is an infortunate name: A different interface with
   that name already exists. What would be a better name?
 * I moved the JavaDoc comments from the abstract class to the
   interface. You agree? Or shall I also leave them in place?
 * On which branch must I base my PR? (I see that the trunk already has
   a 4.0 version number)

Thanks and Greetings.. Mark



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

Reply via email to