Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 118353
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T03:28:53+00:00 2026-05-11T03:28:53+00:00

Following this example, I can list all elements into a pdf file import pyPdf

  • 0

Following this example, I can list all elements into a pdf file

import pyPdf pdf = pyPdf.PdfFileReader(open('pdffile.pdf')) list(pdf.pages) # Process all the objects. print pdf.resolvedObjects 

now, I need to extract a non-standard object from the pdf file.

My object is the one named MYOBJECT and it is a string.

The piece printed by the python script that concernes me is:

{'/MYOBJECT': IndirectObject(584, 0)} 

The pdf file is this:

558 0 obj <</Contents 583 0 R/CropBox[0 0 595.22 842]/MediaBox[0 0 595.22 842]/Parent 29 0 R/Resources   <</ColorSpace <</CS0 563 0 R>>     /ExtGState <</GS0 568 0 R>>     /Font<</TT0 559 0 R/TT1 560 0 R/TT2 561 0 R/TT3 562 0 R>>     /ProcSet[/PDF/Text/ImageC]     /Properties<</MC0<</MYOBJECT 584 0 R>>/MC1<</SubKey 582 0 R>> >>     /XObject<</Im0 578 0 R>>>>   /Rotate 0/StructParents 0/Type/Page>> endobj ... ... ... 584 0 obj <</Length 8>>stream  1_22_4_1     --->>>>  this is the string I need to extract from the object  endstream endobj 

How can I follow the 584 value in order to refer to my string (under pyPdf of course)??

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T03:28:53+00:00Added an answer on May 11, 2026 at 3:28 am

    each element in pdf.pages is a dictionary, so assuming it’s on page 1, pdf.pages[0]['/MYOBJECT'] should be the element you want.

    You can try to print that individually or poke at it with help and dir in a python prompt for more about how to get the string you want

    Edit:

    after receiving a copy of the pdf, i found the object at pdf.resolvedObjects[0][558]['/Resources']['/Properties']['/MC0']['/MYOBJECT'] and the value can be retrieved via getData()

    the following function gives a more generic way to solve this by recursively looking for the key in question

    import types import pyPdf pdf = pyPdf.PdfFileReader(open('file.pdf')) pages = list(pdf.pages)  def findInDict(needle,haystack):     for key in haystack.keys():         try:             value = haystack[key]         except:             continue         if key == needle:             return value         if type(value) == types.DictType or isinstance(value,pyPdf.generic.DictionaryObject):               x = findInDict(needle,value)             if x is not None:                 return x  answer = findInDict('/MYOBJECT',pdf.resolvedObjects).getData() 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 145k
  • Answers 145k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You'd either have to use HTML, or a format like:… May 12, 2026 at 8:48 am
  • Editorial Team
    Editorial Team added an answer Allright, I figured it out. beforeShow: function(){ $('#ui-datepicker-div').css('z-index', 2005); } May 12, 2026 at 8:48 am
  • Editorial Team
    Editorial Team added an answer Typically, you don't do that : you access the underlying… May 12, 2026 at 8:48 am

Related Questions

I have the following: <ul id=list> <li>item1 <ul> <li>sub1</li> <li>sub2</li> </ul> </li> </ul> I'd
I need to design a data structure that supports the following operations: search element
I have a query request-uri in the form of /node/143 (just an example of
I need to extract the src element from all image tags in an HTML

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.