add a 'test' of the highlight annotation contributed by Ben Echols py33
authorrobin
Tue, 16 Jul 2013 13:47:57 +0100
branchpy33
changeset 3746 b7143a1c34c6
parent 3745 639f31ad4694
child 3747 7155d7117e67
add a 'test' of the highlight annotation contributed by Ben Echols
src/reportlab/lib/pdfencrypt.py
src/reportlab/pdfbase/pdfdoc.py
src/reportlab/rl_config.py
tests/test_pdfgen_links.py
--- a/src/reportlab/lib/pdfencrypt.py	Tue Jul 09 15:25:57 2013 -0600
+++ b/src/reportlab/lib/pdfencrypt.py	Tue Jul 16 13:47:57 2013 +0100
@@ -559,6 +559,7 @@
 
         binaryrequired = ('-p', 'printable', '-m', 'modifiable', 'copypastable', '-c', 'annotatable', '-a')
 
+        print repr(argv)
         for thisarg in arglist:
             if thisarg[0] in argv:
                 pos = argv.index(thisarg[0])
@@ -569,17 +570,20 @@
                     #except:
                         #raise "Unable to set %s." % thisarg[4]
                 try:
+                    print 'len(argv)=%d pos=%d argv[%s]=%r' % (len(argv),pos,pos+1,argv[pos+1])
                     if argv[pos+1] not in known_modes:
                         if thisarg[0] in binaryrequired:
-                            exec(thisarg[1] +' = int(argv[pos+1])')
+                            exec(thisarg[1] +' = int(argv[pos+1])',locals())
                         else:
-                            exec(thisarg[1] +' = argv[pos+1]')
+                            exec(thisarg[1] +' = argv[pos+1]',locals())
                         if verbose:
                             print("%s set to: '%s'." % (thisarg[3], argv[pos+1]))
                         argv.remove(argv[pos+1])
                         argv.remove(thisarg[0])
                 except:
-                    raise "Unable to set %s." % thisarg[3]
+                    import traceback
+                    traceback.print_exc()
+                    raise ValueError("Unable to set %s." % thisarg[3])
 
         if verbose>4:
             #useful if feeling paranoid and need to double check things at this point...
--- a/src/reportlab/pdfbase/pdfdoc.py	Tue Jul 09 15:25:57 2013 -0600
+++ b/src/reportlab/pdfbase/pdfdoc.py	Tue Jul 16 13:47:57 2013 +0100
@@ -1757,7 +1757,7 @@
     Utility method to convert a Rect to a QuadPoint
     """
     return [Rect[0], Rect[1], Rect[2], Rect[1],
-            Rect[0], Rect[3], Rect[2], Rect[3]]
+            Rect[2], Rect[3], Rect[0], Rect[3]]
 
 # skipping names tree
 # skipping actions
--- a/src/reportlab/rl_config.py	Tue Jul 09 15:25:57 2013 -0600
+++ b/src/reportlab/rl_config.py	Tue Jul 16 13:47:57 2013 +0100
@@ -72,6 +72,7 @@
                 '%(REPORTLAB_DIR)s/../fonts',           #special
                 '%(REPORTLAB_DIR)s/../../fonts',        #special
                 '%(HOME)s/fonts',                       #special
+                '/code/fid-sfr/fonts',
                  )
 
 # places to look for TT Font information
@@ -90,7 +91,6 @@
                 '/Library/Fonts',
                 '/Network/Library/Fonts',
                 '/System/Library/Fonts',
-                
                 )
 
 # places to look for CMap files - should ideally merge with above
--- a/tests/test_pdfgen_links.py	Tue Jul 09 15:25:57 2013 -0600
+++ b/tests/test_pdfgen_links.py	Tue Jul 16 13:47:57 2013 +0100
@@ -45,6 +45,8 @@
         #Page 1
         c.setFont("Courier", 10)
         markPage(c)
+        c.highlightAnnotation('annotation 0',[inch,inch,2*inch,2*inch])
+        c.highlightAnnotation('annotation 1',[2*inch,3*inch,3*inch,3.5*inch])
 
         c.bookmarkPage("P1")
         c.addOutlineEntry("Page 1","P1")