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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T16:55:27+00:00 2026-06-01T16:55:27+00:00

I try to read pdf file. I want to use this function databuffer =

  • 0

I try to read pdf file. I want to use this function

databuffer = [file readDataOfLength : 7] but i want read all the byte in the line .

It mean I use seekToFileOffset to find the byte but I want read the line.

NSMutableArray      *nameArray = [[NSMutableArray alloc] initWithObjects:nil];

NSMutableArray      *nameArrayDict = [[NSMutableArray alloc] initWithObjects:nil];
NSString            *path          = [[NSBundle  mainBundle] pathForResource:@"testpdf" ofType:@"pdf"];
NSString            *contents      = [NSString   stringWithContentsOfFile:path encoding:NSASCIIStringEncoding error:nil];


    int var=[[nameArray objectAtIndex:[nameArray count]-2] intValue];

     NSFileHandle *file;
     NSData *databuffer;
     file = [NSFileHandle fileHandleForReadingAtPath: appFile];

     int i=0;
     while (file!=nil ) {
        [file seekToFileOffset: var+i];

        databuffer = [file readDataOfLength : 7];
        NSString* aStr;
        aStr = [[NSString alloc] initWithData: databuffer encoding:NSASCIIStringEncoding];

        NSLog(@"%@",aStr);

        i=i+[databuffer length];
    }

now i try your solution but i can’t show nothing!!!

CGPDFPageRef page = CGPDFDocumentGetPage (myDocument, 1);// 2

CGPDFDictionaryRef d;

d = CGPDFPageGetDictionary(page);


CGPDFScannerRef myScanner; 

CGPDFOperatorTableRef myTable;
myTable = CGPDFOperatorTableCreate();



CGPDFContentStreamRef myContentStream = CGPDFContentStreamCreateWithPage (page);// 3




myScanner = CGPDFScannerCreate (myContentStream, myTable, NULL);// 4





CGPDFScannerScan (myScanner);// 5


CGPDFOperatorTableSetCallback(myTable,  "BT", &op_BT);//Begin text object
CGPDFOperatorTableSetCallback(myTable,  "ET", &op_ET);//End text object
CGPDFOperatorTableSetCallback (myTable, "MP", &op_MP);
CGPDFOperatorTableSetCallback (myTable, "DP", &op_DP);
CGPDFOperatorTableSetCallback (myTable, "BMC", &op_BMC);
CGPDFOperatorTableSetCallback (myTable, "BDC", &op_BDC);
CGPDFOperatorTableSetCallback (myTable, "EMC", &op_EMC);
  • 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-06-01T16:55:28+00:00Added an answer on June 1, 2026 at 4:55 pm

    I recommend not to parse your pdf in a way you like to do it.

    Try to use CGPDFScanner (docs here)

    As JeremyP says: lot’s of zlib compressed stuff is in a PDF file. Do search for end of lines.
    Use CGPDFScanner to extract font maps, images, etc.

    But is not that easy. I can tell you. 🙂

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

Sidebar

Related Questions

I want to read pdf file from url in the android emulator. I have
I want to read a PDF file in android. I placed my PDF files
When I try to read an HTML file (using HTMLWorker.parseToList) and create a PDF
I've created this code to save a pdf file in sd card, but I
I try to read file /proc/'pid'/status, using c program. The code is as follows,
I'm using opencsv in my application but whenever I try to read my csv
I have a PHP program that encrypts a PDF file into .xxx file this
In my ASP.NET application,When I try to open PDF file by using the below
I'm trying to digitally sign a PDF file using THIS project as an example.
I get an UnauthorizedAccessException everytime I try to access (just read ) a file

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.