You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Emmeran Seehuber (Jira)" <ji...@apache.org> on 2023/08/21 20:44:00 UTC

[jira] [Reopened] (PDFBOX-5149) 3.0.0-RC1: PDFCloneUtility is no longer accessible

     [ https://issues.apache.org/jira/browse/PDFBOX-5149?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Emmeran Seehuber reopened PDFBOX-5149:
--------------------------------------

Sorry, we are not done here :(

The constructor of PDFCloneUtility is package private. I did not have a problem with this, because I did an ugly workaround in my pdfbox-graphics2d 3.0.0 branch. I created a derived class InternalDeprecatedCOSCloner in the org.apache.pdfbox.multipdf package inside my project. And could access the constructor.

This works fine as long as you don't plan to use the JPMS modules introduced with Java 9. Which I personally don't plan every to do.

But it seems Apache POI is going to use those JPMS modules, at least [~fanningpj] is trying to get POI working with PDFBox 3.0.0 and my pdfbox-graphics2d with version 3.0.0. And now he gets a not so nice 
 
{{/Users/pj.fanning/svn/poi/poi-ooxml/src/main/java9/module-info.java:18: error: module org.apache.poi.ooxml reads package org.apache.pdfbox.multipdf from both de.rototor.pdfbox.graphics2d and org.apache.pdfbox}}

As the - to be honest rather dirty - workaround done be me no longer works with JPMS...

You can find the concrete usage for the cloner here [https://github.com/rototor/pdfbox-graphics2d/blob/master/graphics2d/src/main/java/de/rototor/pdfbox/graphics2d/PdfBoxGraphics2DPaintApplier.java]. Just search for PDFCloneUtility. I use it to clone PDShading when I'm "rewriting" PDFs. I.e. I use PDFBox to draw on my Graphics2D adapter to create new PDFs and filter / change stuff in the PDF on the fly. Mostly to split PDFs for Seperation colors and such stuff.

Just making the PDFClonerUtility constructor public again would of course work. But I'm not sure that this is the right solution. AFAIR it was made package private because of many problems of users which did not really understand what this class was for.

The "downstream" bug is here: https://github.com/rototor/pdfbox-graphics2d/issues/56 

> 3.0.0-RC1: PDFCloneUtility is no longer accessible
> --------------------------------------------------
>
>                 Key: PDFBOX-5149
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-5149
>             Project: PDFBox
>          Issue Type: Bug
>    Affects Versions: 3.0.0 PDFBox
>            Reporter: Emmeran Seehuber
>            Assignee: Andreas Lehmkühler
>            Priority: Major
>             Fix For: 3.0.0 PDFBox
>
>
> PDFCloneUtility is no longer accessible by default. This is low level functionality, which is sometimes required and useful. PDFBox itself is low level, so I don't see why you would restrict access to this. Also this API is not really complicated nor unstable.
> For now I did a dirty workaround to access it (see [here|https://github.com/rototor/pdfbox-graphics2d/commit/5986bc653f83b2c06e5218ac906b9a9bc75f724e#diff-2113e77a03390c0cf920587a642fe7693e5b3c8402de783223035a79e13c2209R1]). I would rather like to get rid of this workaround soon.
> Other than that, PDFBox-Graphics2d seems to work fine with PDFBox 3.0.0-RC1. I just released a 3.0.0-RC1 version of it.



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

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