Perhaps this could be added to the migration guide <https://pdfbox.apache.org/3.0/migration.html>?
On Tue, Jun 17, 2025 at 11:47 AM Jan Luehe <janlu...@gmail.com> wrote: > Thank you, Tilman, for your quick response! > > Jan > > On Tue, Jun 17, 2025 at 11:38 AM Tilman Hausherr <thaush...@t-online.de> > wrote: > >> I didn't find anything at first, but then I remembered that >> the WriteDecodedDoc utility looked at all objects... >> >> old: >> >> for (COSObject cosObject : doc.getDocument().getObjects()) >> >> new: >> >> COSDocument cosDocument = doc.getDocument(); >> cosDocument.getXrefTable().keySet().stream().forEach(o -> >> processObject(cosDocument.getObjectFromPool(o), skipImages)); >> >> So you use the keys from >> cosDocument.getXrefTable().keySet() >> and pass these to >> cosDocument.getObjectFromPool() >> >> Tilman >> >> On 6/17/2025 8:27 PM, Jan Luehe wrote: >> > What is the replacement of org.apache.pdfbox.cos.COSDocument.getObjects >> ( >> > >> https://javadoc.io/static/org.apache.pdfbox/pdfbox/2.0.34/org/apache/pdfbox/cos/COSDocument.html#getObjects-- >> ) >> > in 3.x? >> > >> > We have the following code which works with 2.x that we need to port to >> 3.x: >> > >> > org.apache.pdfbox.pdmodel.PDDocument doc = ...; >> > for (Iterator<COSObject> i = doc.getDocument().getObjects().iterator(); >> > i.hasNext();) { >> > COSBase base = i.next().getObject(); >> > if (base instanceof COSStream) { >> > COSStream cosStream = (COSStream)base; >> > ... >> > } >> > } >> > >> > In 3.x, I only see >> > org.apache.pdfbox.cos.COSDocument.getObject.getObjectsByType. >> > >> > How would we rewrite the above code to make it compile with 3.x? I don't >> > see anything mentioned in https://pdfbox.apache.org/3.0/migration.html >> > >> > Apologies if I am asking something very obvious, but I have never >> worked on >> > org.apache.pdfbox before ... >> > >> > Thanks! >> > >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org >> For additional commands, e-mail: users-h...@pdfbox.apache.org >> >>