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

  • SEARCH
  • Home
  • 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 6631059
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:29:41+00:00 2026-05-25T22:29:41+00:00

I am working on a piece of software that analyses PDF files and generates

  • 0

I am working on a piece of software that analyses PDF files and generates HTML based on them. There are a number of things out there that already do this so I know it is possible, I have to write my own for business reasons.

I have managed to get all the text information, positions, fonts out of the PDF but I am struggling to read out the colour of the text. I am currently using PDFMiner to analyse the PDF but am beginning to think I will need to write my own PDFReader, even so, I can’t figure out where in the document the Colour information for text is even kept! I have even read the PDF spec but cannot find the information I need.

I have scoured google, with no joy.

Thanks in advance!

  • 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. Editorial Team
    Editorial Team
    2026-05-25T22:29:41+00:00Added an answer on May 25, 2026 at 10:29 pm

    The colour for text and other filled graphics is set using one of the g, rg or k operators in the content stream object in the PDF file, as described in section 4.5.7 Color Operators in the PDF reference manual.

    The example G.3 Simple Graphics Example in the reference manual shows these operators being used to stroke and fill some shapes (but not text).

    http://www.adobe.com/devnet/pdf/pdf_reference.html

    When parsing a PDF file yourself you start by reading the trailer
    at the end of the file which contains the file offset of the
    cross reference table. This table contains the file offset of
    each object in the PDF file. The objects are in a tree structure with references
    to other objects. One of the objects will be
    the content stream. This is described in sections 3.4 File Structure
    and 3.6 Document Structure in the PDF reference manual.

    It is possible to parse the PDF file yourself but this is
    quite a lot of work. The content
    stream may be compressed, contain references to other objects,
    contain comments, etc. and you must handle all of these cases.

    The PDFMiner software is already reading the content stream. Perhaps it
    would be easier to extend PDFMiner to report the colour
    of the text too?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a piece of software that would work well with an iTunes
I am working on a piece of 3D software that has sometimes has to
I'm working on a piece of software that creates a contract and captures the
I'm working on a piece of scientific software that is very cpu-intensive (its proc
I'm working on a piece of software which generates assembler code at runtime. For
I'm currently working on a piece of software designed in WPF that connects to
I am working on a piece of software that effectively needs to talk to
Scenario: There is a complex piece of software that is annoying to launch by
Folks, I'm working on a little piece of rich client software that I'd like
I'm working on a piece of software that monitors other processes' system calls using

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.