rdkit.sping.PDF.pidPDF module

This is the PIDDLE back end for PDF. It acts as a wrapper over the pdfgen.Canvas class, and translates between the PIDDLE graphics state and the PDF/PostScript one. It only exposes PIDDLE methods; however, it has an attribute self.pdf which offers numerous lower-level drawing routines.

class rdkit.sping.PDF.pidPDF.PDFCanvas(size=None, name='pidPDF.pdf', pagesize=(595.275590551181, 841.8897637795275))

Bases: rdkit.sping.pid.Canvas

This works by accumulating a list of strings containing PDF page marking operators, as you call its methods. We could use a big string but this is more efficient - only concatenate it once, with control over line ends. When done, it hands off the stream to a PDFPage object.

canUpdate()
clear()

Not wll defined for file formats, use same as ShowPage

drawArc(x1, y1, x2, y2, startAng=0, extent=90, edgeColor=None, edgeWidth=None, fillColor=None, dash=None, **kwargs)

This draws a PacMan-type shape connected to the centre. One idiosyncracy - if you specify an edge color, it apples to the outer curved rim but not the radial edges.

drawCurve(x1, y1, x2, y2, x3, y3, x4, y4, edgeColor=None, edgeWidth=None, fillColor=None, closed=0, dash=None, **kwargs)

This could do two totally different things. If not closed, just does a bezier curve so fill is irrelevant. If closed, it is actually a filled shape.

drawEllipse(x1, y1, x2, y2, edgeColor=None, edgeWidth=None, fillColor=None, dash=None, **kwargs)
drawImage(image, x1, y1, x2=None, y2=None, **kwargs)

Draw a PIL Image or image filename into the specified rectangle. If x2 and y2 are omitted, they are calculated from the image size.

drawLine(x1, y1, x2, y2, color=None, width=None, dash=None, **kwargs)

Calls the underlying methods in pdfgen.canvas. For the highest performance, use canvas.setDefaultFont and canvas.setLineWidth, and draw batches of similar lines together.

drawLines(lineList, color=None, width=None, dash=None, **kwargs)

Draws several distinct lines, all with same color and width, efficiently

drawLiteral(literal)
drawPolygon(pointlist, edgeColor=None, edgeWidth=None, fillColor=None, closed=0, dash=None, **kwargs)

As it says. Easy with paths!

drawRect(x1, y1, x2, y2, edgeColor=None, edgeWidth=None, fillColor=None, dash=None, **kwargs)
drawString(s, x, y, font=None, color=None, angle=0, **kwargs)

As it says, but many options to process. It translates user space rather than text space, in case underlining is needed on rotated text. It cheats and does literals for efficiency, avoiding changing the python graphics state.

flush()
fontAscent(font=None)
fontDescent(font=None)
fontHeight(font=None)
isInteractive()
resetDefaults()

If you drop down to a lower level, PIDDLE can lose track of the current graphics state. Calling this after wards ensures that the canvas is updated to the same defaults as PIDDLE thinks they should be.

save(file=None, format=None)

Saves the file. If holding data, do a showPage() to save them having to.

setInfoLine(s)
showPage()

ensure basic settings are the same after a page break

stringWidth(s, font=None)

Return the logical width of the string if it were drawn in the current font (defaults to self.font).

rdkit.sping.PDF.pidPDF.test()