Search code examples
pythonpdfpdf-generationreportlabcmyk

CMYK overprinting (colour-separated PDF output) with Reportlab


is it possible to use CMYK overprinting without using the CMYKColorSep class, which always generates a new seperate color in the printer settings, i just want to use overprinting with the standard 4 CMYK inks (colour-separated PDF output, as stated in the 2.4 changelog)

here my example code (reportlab 2.4 needed):

from reportlab.graphics.shapes import Rect
from reportlab.lib.colors import PCMYKColor, PCMYKColorSep
from reportlab.pdfgen.canvas import Canvas

black = PCMYKColor(0, 0, 0, 100)
blue  = PCMYKColor(91.0,  43.0,  0.0, 0.0)
red   = PCMYKColorSep( 0.0, 100.0, 91.0, 0.0, spotName='PANTONE 485 CV',density=100)
red2   = PCMYKColor( 0.0, 100.0, 91.0, 0.0, knockout=0) #knockout does nothing?

c = Canvas('test.pdf', (420,200))
c.setFillColor(black)
c.setFont('Helvetica', 10)
c.drawString(25,180, 'overprint w. CMYKColorSep')
c.setFillOverprint(True)
c.setFillColor(blue)
c.rect(25,25,100,100, fill=True, stroke=False)
c.setFillColor(red)
c.rect(100,75,100,100, fill=True, stroke=False)
c.setFillColor(black)
c.drawString(225,180, 'overprint w. plain CMYKColor (does not work)')
c.setFillColor(blue)
c.rect(225,25,100,100, fill=True, stroke=False)
c.setFillColor(red2)
c.rect(300,75,100,100, fill=True, stroke=False)
c.save()

note: you need to enable the overprinting preview in acrobat reader pro to correctly view this.

if this does not work with reportlab, do you know any other server-side alternative to generate pdf, where overprinting does work?

thank you very much


Solution

  • this feature is not implemented in Reportlab 2.4. But they will do it with their next major release.