Metadata-Version: 2.4
Name: PySnapCode
Version: 0.1.0
Summary: Convert source code into beautiful syntax-highlighted and auto-cropped images
Author: Free Python Code
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pdfkit
Requires-Dist: pdf2image
Requires-Dist: Pillow
Dynamic: author
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: license-file
Dynamic: requires-dist
Dynamic: summary

# PySnapCode ًں“¸ًںگچ

**PySnapCode** is a lightweight Python library designed to transform your source code into beautiful, syntax-highlighted, and auto-cropped images. Perfect for sharing code snippets on social media, blogs, or documentation.

---

## âڑ ï¸ڈ Prerequisites (Mandatory)

To use this library, you **must** install two external tools. Without them, the library will not function correctly.

### ًںژ¥ Installation Guide
If you are unsure how to set up the dependencies, watch this step-by-step video tutorial:
ًں‘‰ **[Watch the Tutorial on YouTube](https://youtu.be/PyF1Vh9040Y)**

### 1. Poppler (For Image Generation)
- **Windows:** Download the latest version from [Poppler for Windows](https://github.com/oschwartz10612/poppler-windows/releases/).
- **Setup:** Extract the ZIP file and provide the path to the `bin` folder in the code (see Usage below).

### 2. wkhtmltopdf (For PDF Rendering)
- **Download:** Get the installer from the [official wkhtmltopdf website](https://wkhtmltopdf.org/downloads.html).
- **Setup:** Run the installer and ensure it is added to your System PATH during installation.

---

## ًںڑ€ Installation

Install the library using pip:
```bash
pip install PySnapCode


ًں›  Usage
Basic Example
Python
from py_snap_code import CodeConverter

# Initialize the converter with your Poppler path
conv = CodeConverter(poppler_path=r'C:\path\to\your\poppler\bin')

# Convert your python file to a cropped image
conv.convert('main.py', output_name='my_code_snap')
Advanced Customization (Custom Colors & Font Size)
Python
from py_snap_code import CodeConverter

# Define a custom theme
my_theme = {
    'bg': '#282a36',        # Background color
    'text': '#f8f8f2',      # Normal text color
    'keywords': '#ff79c6',  # Python keywords
    'numbers': '#bd93f9',   # Numbers
    'line_num': '#6272a4'   # Line numbers color
}

conv = CodeConverter(
    poppler_path=r'C:\poppler\bin',
    custom_colors=my_theme,
    font_size="18px"
)

conv.convert('script.py', output_name='pro_snippet')
ًں“‌ Features
Auto-Crop: Automatically trims the white space around your code.

Syntax Highlighting: Supports all standard Python keywords and operators.

Custom Themes: Full control over background, text, and highlight colors.

Clean Output: Generates high-resolution images with professional padding.
