After rotate scanned pdf using python it works just fine but after sending the pdf to third party the third party still detect the pdf as a 90 deg pdf is there any way to fix rotation and this problem
import PyPDF2
with open('input.pdf', 'rb') as file:
# Create a PDF reader object
reader = PyPDF2.PdfReader(file)
# Create a PDF writer object
writer = PyPDF2.PdfWriter()
# Rotate each page by 90 degrees and add it to the writer object
for page_num in range(len(reader.pages)):
page = reader.pages[page_num]
page.rotate(90) # Rotate clockwise with negative angle
writer.add_metadata({
'/Rotate': '0' # Set the desired rotation value (adjust as needed)
})
writer.add_page(page)
# Write the rotated pages to a new PDF file
with open('offffutput.pdf', 'wb') as output_file:
writer.write(output_file)