I am doing POC on PDF content validation which will basically validate the content of PDF files. But I didn't find any solutions.

Solution which I am looking for:

  1. Read the PDF file from a specific location
  2. Extract PDF content and maybe put it in some structured format
  3. Validate actual extracted content against a expected values
  • 3
    "I am doing POC on PDF Content validation in selenium automation". Selenium is a browser controller library. What is the relation between it and PDFs do you see? Jan 28, 2020 at 14:27
  • I would like to use PDF library functions , which I am trying to embed in my selenium test suite where I need to validate each content , i can check with assert Feb 11, 2020 at 7:16
  • 1
    Why are you trying to embed a PDF validation in your Selenium test suite? What part of this test or validation is related to a browser?
    – Blub
    Feb 11, 2020 at 15:48
  • yes Selenium won't be required , only libraries which will validate Content from PDF @Blub Feb 12, 2020 at 7:57
  • If selenium won't be required, can you remove it from your description? I feel that will be misleading.
    – Lee Jensen
    Feb 14, 2020 at 0:28

1 Answer 1


First of all, you mentioned a few different tags like Python and Java. You need to make it clear what language you want to use. I'd suggest using a language that you already know and/or your colleagues know, a language that's already used on your project(s), and a language that's generally used in your company. What you do in this example should be consistent with other projects and situations.

In Python, there're a few ways, one of them is MyPDF2, more precisely method extractText(). Read the documentation and try it out in your example, it might not work well in all cases. It also depends on what examply you want to check, text might be a bit more difficult than e.g. title, number of pages, author etc.

However, Selenium will not be the solution here, it's a framework for testing web applications, not a tool/framework/library for reading data/text from PDF files. Some basic information could be found here on Wikipedia.

  • Thanks for correcting me . But What I am expecting here is anyone who has done any POC either in Java/Python language using any library to extract data from PDF . PDF more context with Invoice of Telecom User . so this will contains no , title , Table format etc . Why I have mentioned selenium is because i will be writing some Tests which will compare PDF text with existing given value. so That I can validate It & Can say PDF validation is working properly @pavelsaman. Thanks Feb 11, 2020 at 12:25
  • @pavelsaman gave you a valid answer, you should really try it out yourself since PDFs widely varies between documents.
    – Rsf
    Feb 12, 2020 at 8:27
  • Sure , I will try and update on same thread @Rsf Feb 12, 2020 at 10:18

Not the answer you're looking for? Browse other questions tagged or ask your own question.