Python Forum
PDF properties doesn't show created or modified date
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PDF properties doesn't show created or modified date
#1
I had a lot of small pdfs, which I merged to 1 big pdf using PyPDF2, a great tool! Works perfectly!

When I open the big pdf, and go to File Options -> Properties I can see most of the info I set, but CREATED and MODIFIED just show None

Do I have to put in the dates in a special format? I was hoping I could just put text!

Here is the meta data:

# Add the metadata
    writer.add_metadata(
        {
            "/Author": "Roy Rodgers",
            "/Producer": "PyPDF2",
            "/Created": "Wednesday May 17 2023",        
            "/Modified": "Regularly",
            "/Date": "Wednesday May 17 2023",
            "/Place": "中国江苏南京市",
            "/Title": "An Alternative",
            "/Pages": "287",
            "/Words": "101765",
            "/Python": "pdfs merged and pages and words counted with Python PyPDF2"
        }
    )
Reply
#2
The DocumentInformation Class says dates are datetime objects..

https://pypdf2.readthedocs.io/en/3.0.0/m...ation.html

Though getDocumentationInfo is depreciated, I wonder if the structure is the same?
Pedroski55 likes this post
Reply
#3
Thanks for your reply!

I set /CREATED and /MODIFIED like this, but didn't work, still get None.

"/Created": "2023 05 17",
"/Modified": "2023 06 18",

After I make the pdf, I save it then read it again in Python, then check the metadata, which shows just as I set it. It is just a dictionary.

reader = PdfReader(path2output + outputName)
# show the new metadata
print('Showing the new metadata ... ')
meta = reader.metadata    
for item in meta.items():
    print(item)
But apparently the Evince Document Viewer 42.3 can't read the dates like above either.

Not very important!
Reply
#4
(Jun-18-2023, 10:43 PM)Pedroski55 Wrote: the Evince Document Viewer 42.3 can't read the dates like above
What does pdfinfo say ?

You could perhaps try the pdf date format described in qpdf. By the way the Python bindings for this is called pikepdf. Could be worth exploring.

I see the place is 中国江苏南京市. Is this where you are?
Reply
#5
(Jun-19-2023, 05:51 AM)Gribouillis Wrote:
(Jun-18-2023, 10:43 PM)Pedroski55 Wrote: the Evince Document Viewer 42.3 can't read the dates like above
What does pdfinfo say ?

You could perhaps try the pdf date format described in qpdf. By the way the Python bindings for this is called pikepdf. Could be worth exploring.

I see the place is 中国江苏南京市. Is this where you are?

Yeah, I'm in Nanjing right now, but not much longer, going back to England soon!

I'll check the links out, see if I can get it to work. Thanks!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Compare current date on calendar with date format file name Fioravanti 1 249 Mar-26-2024, 08:23 AM
Last Post: Pedroski55
  Python date format changes to date & time 1418 4 621 Jan-20-2024, 04:45 AM
Last Post: 1418
  Why doesn't it show me anything in print? Melcu54 2 929 Oct-01-2022, 12:07 AM
Last Post: snippsat
  PIL Image im.show() no show! Pedroski55 2 976 Sep-12-2022, 10:19 PM
Last Post: Pedroski55
  How do I list properties quarinteen 0 1,060 May-01-2022, 04:15 PM
Last Post: quarinteen
  PIL Image im.show() no show! Pedroski55 6 4,945 Feb-08-2022, 06:32 AM
Last Post: Pedroski55
  Date format and past date check function Turtle 5 4,281 Oct-22-2021, 09:45 PM
Last Post: deanhystad
  append a string to a modified line Mr_Blue 10 3,875 Sep-16-2021, 07:24 PM
Last Post: Mr_Blue
  How to add previous date infront of every unique customer id's invoice date ur_enegmatic 1 2,244 Feb-06-2021, 10:48 PM
Last Post: eddywinch82
  How to rename a CSV file by adding MODIFIED in the filename? Python_User 25 8,170 Dec-13-2020, 12:35 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020