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) |
Beta Was this translation helpful? Give feedback.
Replies: 10 comments 5 replies
-
You did not mention your PyMuPDF version. |
Beta Was this translation helpful? Give feedback.
-
I also encountered this problem in version 1.24.11, python3.8.10 |
Beta Was this translation helpful? Give feedback.
-
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 |
Beta Was this translation helpful? Give feedback.
-
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. |
Beta Was this translation helpful? Give feedback.
-
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 |
Beta Was this translation helpful? Give feedback.
-
And when the PDF output using the morph parameter is converted using Ghostscript, such an error will occur |
Beta Was this translation helpful? Give feedback.
-
So, perhaps the inserted text does have problems indeed |
Beta Was this translation helpful? Give feedback.
-
The fourth file was not uploaded successfully,This is the file after adding the morph parameter. |
Beta Was this translation helpful? Give feedback.
-
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? |
Beta Was this translation helpful? Give feedback.
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.