Merge branch 'idan-david/master'

This commit is contained in:
Jeremy Singer-Vine
2020-07-18 11:19:34 -04:00
2 changed files with 11 additions and 0 deletions
+5
View File
@@ -132,6 +132,11 @@ class Page(Container):
attr["object_type"] = kind
attr["page_number"] = pno
if hasattr(obj, "graphicstate"):
gs = obj.graphicstate
attr['stroking_color'] = gs.scolor
attr['non_stroking_color'] = gs.ncolor
if hasattr(obj, "get_text"):
attr["text"] = obj.get_text()
+6
View File
@@ -62,6 +62,12 @@ class Test(unittest.TestCase):
rect = pdf.pages[0].rects[0]
assert rect['non_stroking_color'] == [0.8, 1, 1]
def test_text_colors(self):
path = os.path.join(HERE, "pdfs/nics-background-checks-2015-11.pdf")
with pdfplumber.open(path) as pdf:
char = pdf.pages[0].chars[3358]
assert char['non_stroking_color'] == [1, 0, 0]
def test_load_with_custom_laparams(self):
# See https://github.com/jsvine/pdfplumber/issues/168
path = os.path.join(HERE, "pdfs/cupertino_usd_4-6-16.pdf")