•  
      reusable_code_components #495698
    Python, HTML/CSS, Unicode, RTL Language Support, PDF Generation

    Demonstrates rendering and converting complex HTML content—including multilingual text, RTL languages, images, tables, emojis, and code snippets—into PDF format.

    This project showcases the capability to render and convert complex HTML content to PDF while supporting multiple languages such as Hindi, English, and Arabic. It handles Unicode symbols, right-to-left text direction for Arabic, embedded images, tables with multilingual data, nested lists, emojis, and inline code snippets. The project includes an example HTML file (sample.html) containing all test cases, required fonts for accurate multilingual rendering, and optional Python scripting (html_to_pdf.py) for automated PDF generation. The output PDF can be generated via tools like wkhtmltopdf, Puppeteer, or browser print-to-PDF functionality. This setup provides a robust foundation for testing HTML to PDF conversions with diverse content types and layouts.

    Empty
    • Preview the HTML content by opening sample.html in a modern web browser.

    • Convert the HTML to PDF using your preferred tool, for example:

      • Using wkhtmltopdf:
        wkhtmltopdf sample.html output.pdf

      • Using Python script:
        python html_to_pdf.py

    • Customize sample.html to update or add new test cases including text, images, and styles.

    • Ensure necessary fonts like NotoSansDevanagari-Regular.ttf are available and properly linked for accurate rendering of Hindi and Arabic scripts.

    Complex HTML to PDF Test

    This project demonstrates converting complex HTML content into PDF format with support for multilingual text, Unicode symbols, RTL languages, images, tables, nested lists, emojis, and code snippets.

    Features

    • Multilingual support: Hindi, English, Arabic  
    • Unicode symbols: Checkmarks, stars, recycling, fire, package icons  
    • RTL text rendering for Arabic  
    • Embedded images and tables  
    • Nested unordered lists  
    • Emoji support  
    • Inline code snippets  

    Prerequisites

    • Modern web browser (for HTML preview)  
    • HTML-to-PDF conversion tool (wkhtmltopdf, Puppeteer, or browser print-to-PDF)  

    Files Included

    • sample.html — Main HTML file with test cases  
    • fonts/NotoSansDevanagari-Regular.ttf — Font for Hindi rendering  
    • html_to_pdf.py — Optional Python script for conversion  
    • output.pdf — Sample output PDF (if generated)  

    Usage

    Preview HTML:

    open sample.html
    Convert to PDF (example with wkhtmltopdf):
    wkhtmltopdf sample.html output.pdf
    
    2025-06-02
    Active
    Sanjay Patel (sanjay_patel)
    #495698

    Follow-ups

    User avatar
    • Readme
      Something went wrong, the follow up content couldn't be loaded
      Only formatting have been changed, you should switch to markup to see the changes
    User avatar
    • Git Repository Url
      -https://openforge.gov.in/plugins/git/smartblocks/html-to-pdf.git 
      +https://openforge.gov.in/plugins/git/smartblocks/html-to-pdf