CARVIEW |
Select Language
HTTP/2 200
date: Sun, 12 Oct 2025 05:11:40 GMT
content-type: text/html; charset=UTF-8
server: cloudflare
x-frame-options: DENY
x-content-type-options: nosniff
x-xss-protection: 1;mode=block
vary: accept-encoding
cf-cache-status: DYNAMIC
content-encoding: gzip
set-cookie: _csrf-frontend=13414baf6d0952443b506f13c9224db7140e1f33c4a2974f25ecbc856121fd60a%3A2%3A%7Bi%3A0%3Bs%3A14%3A%22_csrf-frontend%22%3Bi%3A1%3Bs%3A32%3A%22zo0at2GeGGjNlTeXGYjZXBUUPCHdN5Th%22%3B%7D; HttpOnly; Path=/
cf-ray: 98d4190d1eaae9c3-BLR
pdf2json - Pastebin.com
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python3
- # -*- coding: utf-8 -*-
- # Filename: pdf2json.py
- # Version: 1.0.0
- # Author: Jeoi Reqi
- """
- Description:
- This script converts a PDF file (.pdf) to a JSON file (.json).
- It extracts text from each page of the PDF and saves the data as a JSON file with page-wise content.
- Requirements:
- - Python 3.x
- - PyMuPDF library (install using: pip install PyMuPDF)
- Usage:
- 1. Save this script as 'pdf2json.py'.
- 2. Ensure your PDF file ('example.pdf') is in the same directory as the script.
- 3. Install the PyMuPDF library using the command: 'pip install PyMuPDF'
- 4. Run the script.
- Note: Adjust the 'pdf_filename' and 'json_filename' variables in the script as needed.
- """
- import fitz # PyMuPDF
- import json
- def pdf_to_json(pdf_filename, json_filename):
- pdf_document = fitz.open(pdf_filename)
- json_data = {"pdf_content": []}
- for page_num in range(pdf_document.page_count):
- page = pdf_document[page_num]
- json_data["pdf_content"].append({"page": page_num + 1, "text": page.get_text()})
- with open(json_filename, 'w', encoding='utf-8') as json_file:
- json.dump(json_data, json_file, indent=2)
- if __name__ == "__main__":
- # Set the filenames for the PDF and JSON files
- pdf_filename = 'example.pdf'
- json_filename = 'pdf2json.json'
- # Convert the PDF to a JSON file
- pdf_to_json(pdf_filename, json_filename)
- print(f"Converted '{pdf_filename}' to '{json_filename}'.")
Advertisement
Add Comment
Please, Sign In to add comment
-
⭐✅ Swapzone Glitch ✅ Working ⭐⭐ 9
JavaScript | 3 sec ago | 0.25 KB
-
📌 ChangeNOW Exploit
JavaScript | 5 sec ago | 0.24 KB
-
✅ Make $2500 in 20 minutes⭐⭐⭐ D
JavaScript | 12 sec ago | 0.25 KB
-
⭐✅ Marketplace Glitch ✅ Working ✅ NEVER SEEN...
JavaScript | 13 sec ago | 0.25 KB
-
⭐ Free Crypto Method ⭐
JavaScript | 16 sec ago | 0.24 KB
-
📌 Swapzone +37% glitch ⭐ 2
JavaScript | 20 sec ago | 0.25 KB
-
✅⭐ Make huge profits on trading ⭐⭐ 9
JavaScript | 29 sec ago | 0.25 KB
-
oneshot
Bash | 32 sec ago | 55.79 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand