allow setting producer; version --> 3.5.19
authorrobin <robin@reportlab.com>
Mon, 15 Apr 2019 12:09:01 +0100
changeset 4498 fe619935e3ea
parent 4497 e6dd0a654c94
child 4499 219e715b4a0f
allow setting producer; version --> 3.5.19
src/reportlab/__init__.py
src/reportlab/pdfbase/pdfdoc.py
src/reportlab/pdfgen/canvas.py
src/reportlab/platypus/doctemplate.py
--- a/src/reportlab/__init__.py	Mon Apr 15 12:08:35 2019 +0100
+++ b/src/reportlab/__init__.py	Mon Apr 15 12:09:01 2019 +0100
@@ -1,9 +1,9 @@
 #Copyright ReportLab Europe Ltd. 2000-2018
 #see license.txt for license details
 __doc__="""The Reportlab PDF generation library."""
-Version = "3.5.18"
+Version = "3.5.19"
 __version__=Version
-__date__='20190404'
+__date__='20190415'
 
 import sys, os
 
--- a/src/reportlab/pdfbase/pdfdoc.py	Mon Apr 15 12:08:35 2019 +0100
+++ b/src/reportlab/pdfbase/pdfdoc.py	Mon Apr 15 12:09:01 2019 +0100
@@ -354,13 +354,18 @@
 
     def setCreator(self, creator):
         "embeds in PDF file"
-
-        #allow resetting to clear it
-        if creator is None:
+        if creator is None: #allow resetting to clear it
             self.info.creator = '(unspecified)'
         else:
             self.info.creator = creator
 
+    def setProducer(self, producer):
+        "embeds in PDF file"
+        if producer is None:
+            self.info.producer = _default_producer
+        else:
+            self.info.producer = producer
+
     def setKeywords(self, keywords):
         "embeds a string containing keywords in PDF file"
 
@@ -1519,11 +1524,12 @@
         return sum(counts)  #used to be: return reduce(add, counts)
     return 1
 
+_default_producer = "ReportLab PDF Library - www.reportlab.com"
 class PDFInfo(PDFObject):
     """PDF 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."""
-    producer = "ReportLab PDF Library - www.reportlab.com"
+    producer = _default_producer
     creator = "ReportLab PDF Library - www.reportlab.com"
     title = "untitled"
     author = "anonymous"
--- a/src/reportlab/pdfgen/canvas.py	Mon Apr 15 12:08:35 2019 +0100
+++ b/src/reportlab/pdfgen/canvas.py	Mon Apr 15 12:09:01 2019 +0100
@@ -520,6 +520,10 @@
            which is passing data into ReportLab, if you wish to name it."""
         self._doc.setCreator(creator)
 
+    def setProducer(self, producer):
+        """change the default producer value"""
+        self._doc.setProducer(producer)
+
     def setKeywords(self, keywords):
         """write a list of keywords into the PDF file which shows in document properties.
         Either submit a single string or a list/tuple"""
--- a/src/reportlab/platypus/doctemplate.py	Mon Apr 15 12:08:35 2019 +0100
+++ b/src/reportlab/platypus/doctemplate.py	Mon Apr 15 12:09:01 2019 +0100
@@ -468,6 +468,7 @@
                     'author':None,
                     'subject':None,
                     'creator':None,
+                    'producer':None,
                     'keywords':[],
                     'invariant':None,
                     'pageCompression':None,
@@ -971,6 +972,7 @@
         canv.setTitle(self.title)
         canv.setSubject(self.subject)
         canv.setCreator(self.creator)
+        canv.setProducer(self.producer)
         canv.setKeywords(self.keywords)
         if self.displayDocTitle is not None:
             canv.setViewerPreference('DisplayDocTitle',['false','true'][self.displayDocTitle])