rdkit.sping.PDF.pdfdoc module¶
PDFgen is a library to generate PDF files containing text and graphics. It is the foundation for a complete reporting solution in Python.
The module pdfdoc.py handles the ‘outer structure’ of PDF documents, ensuring that all objects are properly cross-referenced and indexed to the nearest byte. The ‘inner structure’ - the page descriptions - are presumed to be generated before each page is saved. pdfgen.py calls this and provides a ‘canvas’ object to handle page marking operators. piddlePDF calls pdfgen and offers a high-level interface.
- Copyright Andy Robinson 1998-1999
-
rdkit.sping.PDF.pdfdoc.MakeFontDictionary(startpos, count)¶ returns a font dictionary assuming they are all in the file from startpos
-
rdkit.sping.PDF.pdfdoc.MakeType1Fonts()¶ returns a list of all the standard font objects
-
class
rdkit.sping.PDF.pdfdoc.OutputGrabber¶ Bases:
objectAt times we need to put something in the place of standard output. This grabs stdout, keeps the data, and releases stdout when done.
NOT working well enough!
-
close()¶
-
getData()¶
-
write(x)¶
-
-
class
rdkit.sping.PDF.pdfdoc.PDFCatalog¶ Bases:
rdkit.sping.PDF.pdfdoc.PDFObjectrequires RefPages and RefOutlines set
-
save(file)¶
-
-
class
rdkit.sping.PDF.pdfdoc.PDFDocument¶ Bases:
objectResponsible for linking and writing out the whole document. Builds up a list of objects using add(key, object). Each of these must inherit from PDFObject and be able to write itself into the file. For cross-linking, it provides getPosition(key) which tells you where another object is, or raises a KeyError if not found. The rule is that objects should only refer ones previously written to file.
-
SaveToFile(filename)¶
-
SaveToFileObject(fileobj)¶ Open a file, and ask each object in turn to write itself to the file. Keep track of the file position at each point for use in the index at the end
-
add(key, obj)¶
-
addPage(page)¶ adds page and stream at end. Maintains pages list
-
getAvailableFonts()¶
-
getInternalFontName(psfontname)¶
-
getPosition(key)¶ Tell you where the given object is in the file - used for cross-linking; an object can call self.doc.getPosition(“Page001”) to find out where the object keyed under “Page001” is stored.
-
hasFont(psfontname)¶
-
printPDF()¶ prints it to standard output. Logs positions for doing trailer
-
printTrailer()¶
-
printXref()¶
-
setAuthor(author)¶ embedded in PDF file
-
setSubject(subject)¶ embeds in PDF file
-
setTitle(title)¶ embeds in PDF file
-
writeTrailer(f)¶
-
writeXref(f)¶
-
-
class
rdkit.sping.PDF.pdfdoc.PDFImage¶ Bases:
rdkit.sping.PDF.pdfdoc.PDFObject-
save(file)¶
-
-
class
rdkit.sping.PDF.pdfdoc.PDFInfo¶ Bases:
rdkit.sping.PDF.pdfdoc.PDFObjectPDF documents can have basic information embedded, viewable from File | Document Info in Acrobat Reader. If this is wrong, you get Postscript errors while printing, even though it does not print.
-
save(file)¶
-
-
class
rdkit.sping.PDF.pdfdoc.PDFLiteral(text)¶ Bases:
rdkit.sping.PDF.pdfdoc.PDFObjecta ready-made one you wish to quote
-
save(file)¶
-
-
class
rdkit.sping.PDF.pdfdoc.PDFObject¶ Bases:
objectBase class for all PDF objects. In PDF, precise measurement of file offsets is essential, so the usual trick of just printing and redirecting output has proved to give different behaviour on Mac and Windows. While it might be soluble, I’m taking charge of line ends at the binary level and explicitly writing to a file. The LINEEND constant lets me try CR, LF and CRLF easily to help pin down the problem.
-
printPDF()¶
-
save(file)¶ Save its content to an open file
-
-
class
rdkit.sping.PDF.pdfdoc.PDFOutline¶ Bases:
rdkit.sping.PDF.pdfdoc.PDFObjectnull outline, does nothing yet
-
save(file)¶
-
-
class
rdkit.sping.PDF.pdfdoc.PDFPage¶ Bases:
rdkit.sping.PDF.pdfdoc.PDFObjectThe Bastard. Needs list of Resources etc. Use a standard one for now. It manages a PDFStream object which must be added to the document’s list of objects as well.
-
clear()¶
-
save(file)¶
-
setCompression(onoff=0)¶ Turns page compression on or off
-
setStream(data)¶
-
-
class
rdkit.sping.PDF.pdfdoc.PDFPageCollection¶ Bases:
rdkit.sping.PDF.pdfdoc.PDFObjectpresumes PageList attribute set (list of integers)
-
save(file)¶
-
-
class
rdkit.sping.PDF.pdfdoc.PDFStream¶ Bases:
rdkit.sping.PDF.pdfdoc.PDFObjectUsed for the contents of a page
-
save(file)¶
-
setStream(data)¶
-
-
class
rdkit.sping.PDF.pdfdoc.PDFType1Font(key, font)¶ Bases:
rdkit.sping.PDF.pdfdoc.PDFObject-
save(file)¶
-
-
rdkit.sping.PDF.pdfdoc.testOutputGrabber()¶