JavaScript
x
8
1
import fitz
2
text_rectangle = fitz.Rect(450,20,550,120)
3
file_handle = fitz.open(input_file)
4
first_page = file_handle[0]
5
text = 'SAS Automation'
6
first_page.insertTextbox(text_rectangle, f'{text}')
7
file_handle.save(output_file)
8
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.
JavaScript
1
3
1
file_handle = fitz.open()
2
first_page = file_handle.newPage() #file_handle[0] is getting issue
3