reportlab/pdfbase/pdfdoc.py
changeset 500 58d712fef651
parent 494 54257447cfe9
child 502 3a9547186146
equal deleted inserted replaced
499:2b9a27c589ba 500:58d712fef651
       
     1 
     1 #copyright ReportLab Inc. 2000
     2 #copyright ReportLab Inc. 2000
     2 #see license.txt for license details
     3 #see license.txt for license details
     3 #history http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/reportlab/pdfbase/pdfdoc.py?cvsroot=reportlab
     4 #history http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/reportlab/pdfbase/pdfdoc.py?cvsroot=reportlab
     4 #$Header: /tmp/reportlab/reportlab/pdfbase/pdfdoc.py,v 1.30 2000/10/25 08:57:45 rgbecker Exp $
     5 #$Header: /tmp/reportlab/reportlab/pdfbase/pdfdoc.py,v 1.31 2000/11/05 17:46:15 andy_robinson Exp $
     5 __version__=''' $Id: pdfdoc.py,v 1.30 2000/10/25 08:57:45 rgbecker Exp $ '''
     6 __version__=''' $Id: pdfdoc.py,v 1.31 2000/11/05 17:46:15 andy_robinson Exp $ '''
     6 __doc__=""" 
     7 __doc__=""" 
     7 PDFgen is a library to generate PDF files containing text and graphics.  It is the 
     8 PDFgen is a library to generate PDF files containing text and graphics.  It is the 
     8 foundation for a complete reporting solution in Python.  
     9 foundation for a complete reporting solution in Python.  
     9 
    10 
    10 The module pdfdoc.py handles the 'outer structure' of PDF documents, ensuring that
    11 The module pdfdoc.py handles the 'outer structure' of PDF documents, ensuring that
   746                    # "Parent": PDFObjectReference(Pages),  # no! use document.Pages
   747                    # "Parent": PDFObjectReference(Pages),  # no! use document.Pages
   747                     }
   748                     }
   748     __NoDefault__ = string.split(""" Parent
   749     __NoDefault__ = string.split(""" Parent
   749         MediaBox Resources Contents CropBox Rotate Thumb Annots B Dur Hid Trans AA
   750         MediaBox Resources Contents CropBox Rotate Thumb Annots B Dur Hid Trans AA
   750         PieceInfo LastModified SeparationInfo ArtBox TrimBox BleedBox ID PZ
   751         PieceInfo LastModified SeparationInfo ArtBox TrimBox BleedBox ID PZ
       
   752         Trans
   751     """)
   753     """)
   752     __Refs__ = string.split("""
   754     __Refs__ = string.split("""
   753         Contents Parent ID
   755         Contents Parent ID
   754     """)
   756     """)
   755     pagewidth = 595
   757     pagewidth = 595
   756     pageheight = 842
   758     pageheight = 842
   757     stream = None
   759     stream = None
   758     hasImages = 0
   760     hasImages = 0
   759     compression = 0
   761     compression = 0
   760     XObjects = None
   762     XObjects = None
       
   763     Trans = None
   761     # transitionstring?
   764     # transitionstring?
   762     # xobjects?
   765     # xobjects?
   763     # annotations
   766     # annotations
   764     def __init__(self):
   767     def __init__(self):
   765         # set all nodefaults to None
   768         # set all nodefaults to None
   772             raise ValueError, "overridden! must set stream explicitly"
   775             raise ValueError, "overridden! must set stream explicitly"
   773         from types import ListType
   776         from types import ListType
   774         if type(code) is ListType:
   777         if type(code) is ListType:
   775             code = string.join(code, LINEEND)+LINEEND
   778             code = string.join(code, LINEEND)+LINEEND
   776         self.stream = code
   779         self.stream = code
       
   780 
       
   781     def setPageTransition(self, tranDict):
       
   782         self.Trans = PDFDictionary(tranDict)
   777         
   783         
   778     def check_format(self, document):
   784     def check_format(self, document):
   779         # set up parameters unless usual behaviour is suppressed
   785         # set up parameters unless usual behaviour is suppressed
   780         if self.Override_default_compilation:
   786         if self.Override_default_compilation:
   781             return   
   787             return   
  1106     def format(self, document):
  1112     def format(self, document):
  1107         D = {}
  1113         D = {}
  1108         D["Title"] = PDFString(self.title)
  1114         D["Title"] = PDFString(self.title)
  1109         D["Author"] = PDFString(self.author)
  1115         D["Author"] = PDFString(self.author)
  1110         D["CreationDate"] = PDFDate()
  1116         D["CreationDate"] = PDFDate()
  1111         D["Producer"] = PDFString("ReporLab http://www.reportlab.com")
  1117         D["Producer"] = PDFString("ReportLab http://www.reportlab.com")
  1112         D["Subject"] = PDFString(self.subject)
  1118         D["Subject"] = PDFString(self.subject)
  1113         PD = PDFDictionary(D)
  1119         PD = PDFDictionary(D)
  1114         return PD.format(document)
  1120         return PD.format(document)
  1115 
  1121 
  1116 # skipping thumbnails, etc
  1122 # skipping thumbnails, etc