It seems there are requests for printing envelopes from the bottom side.
Is it because the envelope’s flap catches and makes it hard to print, or that it becomes too thick when left closed?
That’s why you open the flap and print from the bottom.
However, even if you think that way, there’s nothing you can do if the printer doesn’t have a 180-degree rotation option.
This can be easily solved by using Python with PDFs.
First, create a PDF for printing, and then rotate it 180 degrees using a simple script.
After that, print it.
Below, I have provided the source and an executable created with PyInstaller.
There might be cases where the executable is flagged as a virus.
For those who prefer using the executable but are concerned, you can create the executable yourself from the source using PyInstaller.
Usage: RotatePDF input.pdf output.pdf
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
import argparse
from PyPDF2 import PdfReader, PdfWriter
from pathlib import Path
def rotate_pdf(input_path: Path, output_path: Path):
# Check if the file exists
if input_path.exists():
# Read the input PDF file
reader = PdfReader(input_path) # Read the file correctly
writer = PdfWriter() # Create a PdfWriter
# Rotate each page 180 degrees
for page in reader.pages:
page.rotate(180) # Rotate the page
writer.add_page(page)
# Save the rotated PDF as a new file
with open(output_path, "wb") as output_file:
writer.write(output_file) # Close the file at the end
else:
raise FileNotFoundError(f"{input_path} cannot be found")
def main():
# Set up argument parsing
parser = argparse.ArgumentParser(description="Rotate a PDF by 180 degrees.")
parser.add_argument("input", type=str, help="Path to the input PDF file")
parser.add_argument("output", type=str, help="Path to the output PDF file")
args = parser.parse_args()
# Convert string paths to Path objects
input_path = Path(args.input).resolve()
output_path = Path(args.output).resolve()
# Rotate the PDF
rotate_pdf(input_path, output_path)
if __name__ == "__main__":
main()


Commnts