Community

Determine PDF Page Count

I'm sending PDFs to the OCR service in order to extract the plain text to store in my db. I also want to store the page count of the PDF file. Is there a way to determine this number using the cloud-based SDK?

0

Comments

5 comments

  • Avatar
    SDK Support Team

    You can retrieve that information from server xml response with task details:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <response xmlns="@link" xmlns:xsi="@link" xsi:schemaLocation="@link" version="1.0">
        <task id=”22345200-abe8-4f60-90c8-0d43c5f6c0f6”
            registrationTime=”2001-01-01T13:18:22Z”
            statusChangeTime=”2001-01-01T13:18:22Z”
            status=”InProgress”
            error=”{An error message.}”
            filesCount=”10”
            credits=”10”
            estimatedProcessingTime=”3600”
            resultUrl=”http://<domain>/<blob ID>”
            description=”My first OCR task”/>
        <task …/>
    </response>
    

    The credits attribute contains task cost in internal units. So, to get number of pages you need to divide this number by 5. This will work for all new documents. But if you send your document more than once, you'll get free recognition and hence 0 credits for the whole document.

    This is basically a workaround. The more natural way for that information is to provide it in a separate attribute. We'll consider adding this feature in future.

    1
    Comment actions Permalink
  • Avatar
    etipaced

    Thank you for the quick reply, Vasily. This works fine for now. However, it is a little disappointing that I can't re-process a file to get its page count because the credits show up as 0. I understand why this is so, but I'm definitely casting my vote for the page count value to be returned in the XML response. Thank you again.

    0
    Comment actions Permalink
  • Avatar
    shailesh

    how to search OCR non OCR file in my folder

    -1
    Comment actions Permalink
  • Avatar
    shailesh

    please help

    0
    Comment actions Permalink
  • Avatar
    Andrey Isaev

    You should start separate topic for new question.

    0
    Comment actions Permalink

Please sign in to leave a comment.