Skip to content
Advertisement

PyMuPDF insertTextBox inserting text but in mirrored form

import fitz
text_rectangle = fitz.Rect(450,20,550,120)
file_handle = fitz.open(input_file)
first_page = file_handle[0]
text = 'SAS Automation'
first_page.insertTextbox(text_rectangle, f'{text}')
file_handle.save(output_file)

Above code adds text in pdf in mirror form why I dont know I tried insertText method, morph attribute with inserTextbox but still no solutions finds.you can see output hereOutPut PDF file image

Any help? Thanks In Advance

Advertisement

Answer

I tried updating my existing pdf file. but it wasn’t the correct solution to overcome this problem. Finally, I tried by creating new pdf file.

file_handle = fitz.open()  
first_page = file_handle.newPage() #file_handle[0] is getting issue
Advertisement