| .gitignore | ||
| Dockerfile | ||
| main.py | ||
| README.md | ||
LaTeX-to-PDF Conversion Service
This service provides an API endpoint to convert LaTeX documents into PDF format. It supports .zip file uploads containing the LaTeX source file (main.tex) and any associated files (e.g., images or additional .tex files).
Getting Started
Building the Docker Image
To build the Docker image for the conversion service, navigate to the project directory and run:
docker build -t rbehzadan/tex2pdf .
Running the Service
After building the image, you can start the service with the following command:
docker run -d -p 8000:8000 rbehzadan/tex2pdf
This command runs the Docker container in the background (-d) and maps port 8000 of the container to port 8000 on the host, making the service accessible at http://localhost:8000.
API Endpoint
The service exposes a single POST endpoint at /tex2pdf for converting LaTeX to PDF.
Uploading a .zip File
The .zip file should contain a main.tex file and can include additional resources such as images or other .tex files used by main.tex.
Manual Testing
Testing with curl
To test the conversion service with curl, use the following command:
curl -X POST -F "zip_file=@path/to/your/file.zip" http://localhost:8000/tex2pdf -o output.pdf
Replace path/to/your/file.zip with the actual path to your .zip file. The resulting PDF will be saved as output.pdf in the current directory.
Testing with HTTPie
HTTPie offers a more user-friendly way to test the service. Use the following command for testing:
http -f POST http://localhost:8000/tex2pdf zip_file@path/to/your/file.zip > output.pdf
As with curl, replace path/to/your/file.zip with the path to your .zip file. The output will be redirected to output.pdf in the current directory.
Troubleshooting
If you encounter any issues with the conversion process, ensure that your .zip file is structured correctly, with a main.tex file at the root. For more detailed error information, consult the service logs.