An online PDF file compression tool to reduce the size of a .pdf file. Python Flask is used to upload the file to a temporary location on the server.
In the backend, using the PDFNetPython library that file gets reduced and saved to its final location. After download, the files are automatically deleted from the server after 1 hour. Technologies used in this project: Python3, Flask, C, Shell, Nix, Replit, Git, HTML, CSS, JavaScript.
In HTML form, the enctype property is set to "multipart/form-data" to publish the file to the URL.The URL handler extracts the file from the request.files [] object and saves it to the required location. The path to the upload folder is defined as app.config['UPLOAD_FOLDER'] and maximum size (in bytes) as
maximum size (in bytes).
The server-side flask script fetches the file from the request object using name = request.files['file'].filename.
On successfully uploading the file, it is saved to the desired location on the server.
Here’s the Python code for the Flask application.