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 3809706
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T15:20:49+00:00 2026-05-19T15:20:49+00:00

Has anyone used a CGPDFScanner to parse the ToUnicode CMap stream entry of a

  • 0

Has anyone used a CGPDFScanner to parse the ToUnicode CMap stream entry of a font dictionary? I’m encountering some troubles.

I obtain the CGPDFStream reference from the dictionary and try to build a CGPDFScanner with it. The problem is that CGPDFScanner take a CGPDFContentStream as argument, not a CGPDFStream.

When I parse a CGPDFPage for text operator I can easily get the CGPDFContentStream with CGPDFContentStreamCreateWithPage, but the sister function CGPDFContentStreamCreateWithStream – which is said that “You can use this function to get access to the contents of a form, pattern, Type3 font, or any PDF stream” – is somewhat muddy in the CGPDFContentStream Reference and I’m unable to find sample code.

Anyway, I pass the CMap stream as the stream argument, the resource CGPDFDictionary obtained from the stream with CGPDFStreamGetDictionary as the streamResources parameter and the page content stream as the parent. The resource dictionary can be obtained easy from the stream itself, so why bother to ask it in the first place? On top of that, passing NULL as the parameters but the first seems to have no effect whatsoever.

The result is always the same: when I try to scan the content stream with a scanner set up with a few callbacks I get the following messages

`begincodespacerange' isn't an operator.
`beginbfrange' isn't an operator.
...
`endbfrange' isn't an operator.

for every operator set up in the callback table. This for every CMap encountered.

So, I’m unsure if the content stream is set up the wrong way, if the operators are invalid or if the CGPDFScanner cannot be used to parse the CMap, even if it is a regular pdf stream object, and have to resort to write my own scanner to parse the stream data.

  • 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-19T15:20:50+00:00Added an answer on May 19, 2026 at 3:20 pm

    CGPDFScanner can parse only PDF content streams, streams that contain content for display. Page content, form XObjects, pattern, Type3 fonts share the same stream format. The ToUnicode CMap is a totally different stream, it uses a different syntax from content streams. You need to write you own scanner for parsing the CMap. The ToUnicode CMap format is documented in Adobe PDF specification, section 5.9.2 of PDF reference 1.7, Adobe Technical Notes #5014 and #5411.

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

Sidebar

Related Questions

Has anyone used XHTML Doclet , and can you provide some hints as to
Has anyone used PennySMS's web services? ( https://www.pennysms.com/docs ) I'm having some difficulty doing
Has anyone used the lockfile utility that ships with procmail in conjunction with NFS
Has anyone used Lucene.NET rather than using the full text search that comes with
Has anyone used Mono, the open source .NET implementation on a large or medium
Has anyone used Rhino igloo in a non-trivial project? I am curious if it's
Has anyone used C# with a Sales Logix database?
Has anyone used Ruby/Rails with a Sales Logix database?
Has anyone used CSLA in an application that has a WPF front end and
Has anyone used Pear: Spreadsheet_Excel_Writer ? The Formatting Tutorial lists a script similar to

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.