You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Tilman Hausherr (JIRA)" <ji...@apache.org> on 2017/07/22 05:41:00 UTC
[jira] [Closed] (PDFBOX-3876) Setting “overprint=true” for a specific ColorSpace on PDF (not the entire PDF Page)
[ https://issues.apache.org/jira/browse/PDFBOX-3876?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Tilman Hausherr closed PDFBOX-3876.
-----------------------------------
Resolution: Not A Problem
> Setting “overprint=true” for a specific ColorSpace on PDF (not the entire PDF Page)
> -----------------------------------------------------------------------------------
>
> Key: PDFBOX-3876
> URL: https://issues.apache.org/jira/browse/PDFBOX-3876
> Project: PDFBox
> Issue Type: Bug
> Reporter: Muthukumar R
> Labels: how-to
>
> I have a requirement to set overprint=true at ColorSpace level on a "PDF" (not for the entire PDF Page). I'm trying to solve this using PDFBox.
> Again, I want to apply overprint only for a specific colorSpace (see If condition in the sample code below), but graphicsState.setStrokingOverprintControl(true); seems to be setting overprint for the entire PDF Page (all colorSpaces).
> Here's the sample code. Anyone came across this problem? Am I missing something?
> Sample code:
> {code:java}
> public static void fixPdfOverprint(String inputFilePath, String outputFilePath) throws IOException {
> final ByteArrayInputStream pdfStream = new ByteArrayInputStream(readFileIntoMemory(inputFilePath));
> try(PDDocument document = PDDocument.load(pdfStream)) {
> for (PDPage page : document.getDocumentCatalog().getPages()) {
> try(PDPageContentStream contentStream = createPageContentStream(document, page)) {
> PDExtendedGraphicsState graphicsState = new PDExtendedGraphicsState();
> PDResources pdResources = document.getDocumentCatalog().getPages().get(0).getResources();
> for (COSName cosName : pdResources.getColorSpaceNames()) {
> if(cosName.getName().equals("<my specific colorSpace>")) {
> graphicsState.setStrokingOverprintControl(true); // Why this is setting for the entire page rathen than just this colorSpace. Btw - I confirmed that this if condition is correct.
> }
> }
> contentStream.setGraphicsStateParameters(graphicsState);
> }
> }
> document.save(outputFilePath);
> }
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org