Am 17.08.2020 um 18:35 schrieb Pop, Rares:
Hi guys,

I am trying to add the color space resources from a source document to another.


PDPage spotsPage = this.spotsDocument.getPage(0); // source document
PDPage docPage = newDocument.getPage(0); // target document

// copy color space
for (COSName name: spotsPage.getResources().getColorSpaceNames()) {
     PDColorSpace pdcs = spotsPage.getResources().getColorSpace(name);
     docPage.getResources().add(pdcs);

}
newDocument.save("out1.pdf");
newDocument.close();

However, when opening the out1.pdf with Acrobat, it crashes when looking at 
Print Output Preview to see the new colours.


Don't know, the code looks OK. Please share the PDF (upload to sharehoster).

Btw "docPage.getResources().add(pdcs);" will get you the name that you shall use in the new content stream.

Tilman




What am I missing?

Thank you,
Ra



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

Reply via email to