Play Space Invaders in a PDF File!
Ever thought of playing a classic arcade game directly within a PDF
document? Inspired by innovative projects like DoomPDF, I decided to
take on the challenge of creating a fully playable **Space Invaders**
clone, powered entirely by
PDF form fields and
JavaScript embedded inside the PDF!
This project demonstrates the surprising capabilities of the PDF
format beyond static documents, turning it into an interactive game
canvas.
(Works best in modern PDF viewers like Adobe Acrobat Reader or browser's built-in PDF viewer)
How to Build It Yourself
You can generate this interactive PDF game yourself! The project is
built using
Python to programmatically create the PDF structure
and JavaScript.
Prerequisites: Ensure you have
Python 3 installed on your system.
1. Clone the Repository
git clone https://github.com/Harshit-Dhanwalkar/pdf-spaceinvader
cd pdf-spaceinvader
2. Generate the PDF Game
Run the Python script to generate the PDF file.
python3 generate.py
This will create a file named movable_square.pdf in the
current directory.
3. Open the PDF
Open the generated movable_square.pdf in your preferred
PDF viewer. For the best interactive experience, use a modern PDF
viewer or open it directly in your browser (e.g., Chrome, Edge,
Firefox).
⚠️ Note: While the game uses standard PDF features, performance and full interactivity may vary across different PDF viewers. Adobe Acrobat Reader and modern browser PDF viewers offer the best experience.