Skip to content

JaidevSK/Harappan-Script-PDF-Maker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Harappan Script PDF Generator πŸ“„πŸΊ

This Streamlit application provides a user-friendly interface to dynamically generate PDF documents from a sequence of image-based Harappan script characters. Users can input a custom string of numeric indices, and the app will compile the corresponding images into a properly formatted, downloadable PDF.

Overview

The application takes an input string formatted with underscores (e.g., _1_2_3_4) and maps each number to an image file (e.g., 1.png, 2.png) stored in a designated local folder. It dynamically calculates aspect ratios to maintain image proportions, auto-wraps "text" to the next line when it reaches the page width, and generates new pages automatically.

Features

  • Dynamic PDF Generation: Compiles a sequence of images into a single PDF based on user input.
  • Customizable Page Layout: Adjust maximum writable page width/height, and starting X/Y margins (in mm).
  • Adjustable Character Sizing: Set the exact font width (image width) and fine-tune horizontal and vertical gaps between characters.
  • Smart Wrapping: Automatically detects page boundaries to wrap characters to the next line or create a new page.
  • Visual Reference: Displays a master reference grid (all_images.png) at the bottom of the app to help users identify the correct character indices.

Directory Structure

For the application to work correctly, ensure your project directory is set up as follows:

your_project_folder/
β”‚
β”œβ”€β”€ app.py                # The main Streamlit script
β”œβ”€β”€ all_images.png        # (Optional) Reference image showing all characters
└── final/                # Folder containing the individual character images
    β”œβ”€β”€ 1.png
    β”œβ”€β”€ 2.png
    β”œβ”€β”€ 3.png
    └── ...

Requirements

Ensure you have Python installed along with the following dependencies. You can install them using pip:

pip install streamlit opencv-python fpdf

(Note: opencv-python provides the cv2 module used for calculating image aspect ratios).

How to Run

  1. Save the provided code as app.py.
  2. Ensure your final/ folder is populated with the correctly numbered .png images.
  3. Open your terminal or command prompt, navigate to the project directory, and run:
streamlit run app.py
  1. The application will automatically open in your default web browser.

Usage Guide

  1. Configure Parameters: Use the sidebar on the left to set your desired output filename, page layout, and spacing metrics.
  2. Enter Indices: In the main text area, enter your sequence of character indices. Ensure they are separated by underscores (e.g., _12_45_8_112).
  3. Generate: Click the πŸš€ Generate PDF button.
  4. Download: Once the processing is complete, click the πŸ“₯ Download PDF button to save the generated file to your local machine.

About

Streamlit application to provide a user-friendly interface to dynamically generate PDF documents from a sequence of image-based Harappan script characters.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages