Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python3
- # -*- coding: utf-8 -*-
- # Filename: pdf2bin.py
- # Version: 1.0.0
- # Author: Jeoi Reqi
- """
- Description:
- This script converts a PDF file (.pdf) to a binary file (.bin).
- It reads the PDF content and writes it directly to the binary file.
- Requirements:
- - Python 3.x
- Usage:
- 1. Save this script as 'pdf2bin.py'.
- 2. Ensure your PDF file ('example.pdf') is in the same directory as the script.
- 3. Run the script.
- Note: Adjust the 'pdf_filename' and 'bin_filename' variables in the script as needed.
- """
- def pdf_to_bin(pdf_filename, bin_filename):
- with open(pdf_filename, 'rb') as pdf_file, open(bin_filename, 'wb') as bin_file:
- bin_file.write(pdf_file.read())
- if __name__ == "__main__":
- # Set the filenames for the PDF and binary files
- pdf_filename = 'example.pdf'
- bin_filename = 'pdf2bin.bin'
- # Convert the PDF to a binary file
- pdf_to_bin(pdf_filename, bin_filename)
- print(f"Converted '{pdf_filename}' to '{bin_filename}'.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement