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

Andreas Lehmkühler commented on PDFBOX-5149:
--------------------------------------------

After doing some basic refactoring I've realised that we need to overhaul the 
code to clear up things:
* the cloning is limited to COSBase objects. The former code accepted 
PD-objects as well but cloned the underlying COSBase object and returned that 
clone. The input type didn't match the output type which is kind of disturbing. 
But IMHO the most important point is, now it should be clear that one can't 
simply clone a PD-object such as a PDFont, a PDPage or a whole PDDocument by 
calling {{cloneForNewDocument}}. It is limited to COSBase objects. Hopefully 
something which indicates that cloning is expert stuff
* merging is limited to COSArray and COSDictionary. The former code for merging 
COSStreams was buggy and more important is doesn't make sense to merge 
COSStreams in a simple way. Things like fonts, images can't be merged. 
Contentstreams can be merged by creating an array of streams. Compressed object 
stream can be theretically "merged" by decompressing the single COSStreams and 
repacking them. But that doesn't make sense.

Maybe the usecase for {{PDFCloneUtility}} is clearer now and it is (safer!?!?) 
to make in public again. And, yes we should add some javadoc comment. WDYT?

> 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
>
> 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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to