whenever I used references = pdf.get_references_as_dict(sort=True) it would fail saying:
File "C:\Users\user\Scripts\PDFx\test.py", line 9, in <module>
references = pdf.get_references_as_dict(sort=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\users\user\scripts\pdfx\pdfx\pdfx\__init__.py", line 168, in get_references_as_dict
return self.reader.get_references_as_dict(reftype=reftype, sort=sort)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\users\user\scripts\pdfx\pdfx\pdfx\backends.py", line 177, in get_references_as_dict
for r in sorted(refs) if sort else refs:
This makes sense because you can't sort a set. However you can ensure that the data is sorted by using a list from the beginning. Thus I am a parameter in the PDFx called that allows you to select if you want to use a set or a list. The backends.py has been updated to handle if its a set or list.
Also the sort param from the get_references_as_dict and get_references function has been removed.
It can be used like this pdf = pdfx.PDFx("test.pdf", references_data_structure="list") or like this pdf = pdfx.PDFx("test.pdf", references_data_structure="list")
whenever I used
references = pdf.get_references_as_dict(sort=True)
it would fail saying:This makes sense because you can't sort a set. However you can ensure that the data is sorted by using a list from the beginning. Thus I am a parameter in the PDFx called that allows you to select if you want to use a set or a list. The backends.py has been updated to handle if its a set or list. Also the sort param from the
get_references_as_dict
andget_references
function has been removed.It can be used like this
pdf = pdfx.PDFx("test.pdf", references_data_structure="list")
or like thispdf = pdfx.PDFx("test.pdf", references_data_structure="list")