Insert_text and and Adobe Acrobat DC has encountered an unknown error. #2121
|
With PyMuPDF I add text to pdf, but then if open output file with Adobe Acrobat and try to edit this file, it massage error. This is input file. Input file from Autodesk Autocad (dwg to pdf.pc3) |
Replies: 12 comments 5 replies
|
You did not mention your PyMuPDF version. |
|
I also encountered this problem in version 1.24.11, python3.8.10 |
|
I updated python to 3.13.2 and pymupdf to the latest version, but this problem still exists. It is present in all pdf files that have inserted text using pymupdf. Before the text was inserted, acrobat could edit normally. I have also tried editing with other versions of acrobat. But the same problem exists........ Very strange. Is this a problem of the computer environment? @JorjMcKie |
|
Most PDF editors have no problem opening PDF files with text inserted using pymupdf, except Acrobat. Could it be that the PDF standards used are inconsistent? I tried adding text using PDF-xchange and then opening it with Acrobat, but this issue did not occur. |
|
I conducted many tests and found that this problem would not occur if the default helv was used instead of using insert_font to insert the font. But when I output files using cjk, acrobat will go wrong. The following are my files and code segments. import fitz # PyMuPDF
#
doc = fitz.open('1.pdf')
page = doc.load_page(0)
font = fitz.Font(fontname="cjk")
page.insert_font(fontname="cjk", fontbuffer=font.buffer)
page.insert_text((50, 50),
"text1",
fontsize=20,
fontname="cjk",
)
doc.save('3.pdf',garbage=3,deflate=True)1 is the original file, 2 is the file using helv, and 3 is the file using cjk. 3 will cause acrobat to report an error, but 2 won't |
|
And when the PDF output using the morph parameter is converted using Ghostscript, such an error will occur |
|
So, perhaps the inserted text does have problems indeed |
|
The fourth file was not uploaded successfully,This is the file after adding the morph parameter. |
|
However, when this parameter uses the helv font and inserts text without using insert_font, there will be no error. So, could it be a problem with insert_font? |
|
@yang-521 @Bkhxq Python version: 3.11 The same code was executed under the above environment on both macOS and Linux, producing identical results:
|





You did not mention your PyMuPDF version.
Presumably your problem has to do with an issue fixed in the most current release 1.21.1rc1.
I checked your script and reproducer PDF and no problem occurred.