You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to pdfne...@googlegroups.com
I am trying to extract the color of my text and the color of text background please check the snippet below in python. But my element.IsStroked() and element.IsFilled() are coming as false. Where I have blue color text and red color back ground in my pdf file. What is going wrong please help.
[code] print("Checking color contrast!!") doc = PDFDoc(input_path) doc.InitSecurityHandler() # Example 1. Extract all text content from the document reader = ElementReader() itr = doc.GetPageIterator() while itr.HasNext(): reader.Begin(itr.Current()) element = reader.Next() while element != None: type = element.GetType() if type == Element.e_path: gState = element.GetGState() strokeColor = None fillColor = None if element.IsStroked(): strokeColor = gState.GetStrokeColor() if element.IsFilled(): fillColor = gState.GetFillColor() if strokeColor is not None and fillColor is not None: contrast = LuminosityContrast(strokeColor, fillColor) if contrast < 3.0: print("Low contrast in Page number " + str(p+1)) element = reader.Next() reader.End() p += 1 itr.Next() [/code]
Vincent Ycasas
unread,
Aug 12, 2013, 12:36:28 PM8/12/13
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to pdfne...@googlegroups.com
Can you provide the sample document that you are having this issue with?
Sujan Dasmahapatra
unread,
Aug 13, 2013, 8:12:06 AM8/13/13
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to pdfne...@googlegroups.com
Please check the PDF file attached. Check page 3...It has 3 boxes with different background color and text on it. How can we get the background color for each box and the associated text in the box. Then I want to calculate the contrast for each box. Please help me. I am stuck
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to pdfne...@googlegroups.com
Hello,
What version of our product are you using? I have slightly modified an ElementReaderAdv sample to print path stroke/filled color and it works just fine. Please try downloading the latest version of PDFNet and see if attached script works for you.