You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using the following script to add multiple XML files:
importfitzimportosimportpathlibpath=r"C:\temp"namedoc="document.pdf"pathnamedoc=os.path.join(path,namedoc)
print(pathnamedoc)
doc=fitz.open(pathnamedoc) # open main documentcount=doc.embfile_count()
print("number of embedded file:", count) # shows number of embedded filesnamedata="data.xml"pathnamedata=os.path.join(path,namedata)
print(pathnamedata)
embedded_doc=fitz.open(pathnamedata) # open document you want to embedembedded_data=pathlib.Path(pathnamedata).read_bytes() # get the document byte data as a bufferdoc.embfile_add("data.xml", embedded_data)
doc.saveIncr()
Everything worked fine until I added 5 XMLs to a PDF document. Then suddenly a few files attached to the PDF are unable to be read.
Note: I tried to attach the exact same files manually (using drag and drop from Acrobat Pro) and they worked fine, so I believe my XMLs are well built.
How to reproduce the bug
Run Python code properly (no errors)
Five (5) XMLs files are visible in the PDF attachment section. Just like we wish to happen.
When I try to open them, some of them do not open (two actually).
NO error is showed, they just not open, they can't be read in Adobe.
When I try to delete them from the PDF manually, 3 of them are deleted except of those 2 corrupted.
PyMuPDF version
1.23.8
Operating system
Windows
Python version
3.9
The text was updated successfully, but these errors were encountered:
You did not provide all mandatory data to reproduce the problem.
It could be multiple causes - among them that Acrobat accepts XML only when having a chance to confirm they don't contain security issues.
So pleas either complete this issue description or try to embed those files with a different extension or in zipped format or the like.
Hi @australgisinc, have you solved the issue somehow?
I'm having same problem - some of the attachments cannot be open in Adobe Reader (they can be saved though), the issue is not dependent on names or contents of the attachments and seems to behave randomly. Works in other PDF viewers.
Hi @australgisinc, have you solved the issue somehow? I'm having same problem - some of the attachments cannot be open in Adobe Reader (they can be saved though), the issue is not dependent on names or contents of the attachments and seems to behave randomly. Works in other PDF viewers.
Hi @BohdanMaslowski, No, I didn't. I didn't solve this issue because we had a major project architecture change then the PDF development approach ended.
Description of the bug
I am using the following script to add multiple XML files:
Everything worked fine until I added 5 XMLs to a PDF document. Then suddenly a few files attached to the PDF are unable to be read.
Note: I tried to attach the exact same files manually (using drag and drop from Acrobat Pro) and they worked fine, so I believe my XMLs are well built.
How to reproduce the bug
PyMuPDF version
1.23.8
Operating system
Windows
Python version
3.9
The text was updated successfully, but these errors were encountered: