1

I am able to read the text from pdf using code:

import pdfx
pdf = pdfx.PDFx("1951.pdf")
metadata = pdf.get_metadata()
reference_list = pdf.get_references()
reference_dict = pdf.get_references_as_dict()
pdf.download_pdfs("D:/")
pdf.get_text()

But can't convert it into json:

pdfx -d D:/Output/ -j -o output.json pdf
SyntaxError: invalid syntax

Syntax: pdfx [-h] [-d OUTPUT_DIRECTORY] [-c] [-j] [-v] [-t] [-o OUTPUT_FILE] [--version] pdf

1 Answer 1

8

I was able to convert to XML using the Pdfminer Python module.

  1. Download and unzip the module from http://pypi.python.org/pypi/pdfminer/
  2. Run on shell: python pdf2txt.py -o samples/output.xml -t xml samples/1951.pdf
  3. For text : python pdf2txt.py samples/1951.pdf
Sign up to request clarification or add additional context in comments.

3 Comments

you are using pdf2txt .py, Is this file persent in pdfminer module ?
Yes pdf2txt.py comes with pdfminer module
it comes with pdfminer but located under Scripts folder of Python

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.