Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - Get page count without open file
  FAQ FAQ  Forum Search   Register Register  Login Login

Get page count without open file

 Post Reply Post Reply
Author
Message
ergadita View Drop Down
Beginner
Beginner


Joined: 15 Feb 21
Location: Spain
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote ergadita Quote  Post ReplyReply Direct Link To This Post Topic: Get page count without open file
    Posted: 15 Feb 21 at 6:11PM
Hi, i need to know how much pages has a file without open it.
To extract a page without open the file is the function ExtractFilePages.
The function PageCount needs to open the file previously.
is there any function that returns the pages number of a file without open it?

Thanks & Best regards.
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3296
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 15 Feb 21 at 6:59PM
Hi Juan :)

for some functions there are versions without have to load the pdf but regarding PageCount this isn't so. I understand that you want to know before really opening a file how large it is.
An experimental idea:
The pagecount is directly visible in the pdf-content. You can try it even with Notepad ;-)
Below i've made few samples to show you how to detect these data.
You'll find this data after:
/N
/Count
and /Type/Catalog/Pages

Cheers and welcome here,
Ingo

// here it's 5432 pages...
%PDF-1.6
%âãÏÓ
55528 0 obj
<</Linearized 1/L 110150031/O 55530/E 491335/N 5432/T 110109414/H [ 529 55325]>>
endobj
55547 0 obj


//here it's 5 pages...
5 0 obj
<<
/Count 5
/Kids [ 9 0 R 19 0 R 25 0 R 37 0 R 50 0 R ]
/Type /Pages
>>
endobj


//here it's 2 pages...
1 0 obj
<</Type/Catalog/Pages 2 0 R /AcroForm<</Fields[]>>>>
endobj


//here it's 2 pagesas well...
1 0 obj
<< /Type /Pages
/Count 2
/Kids [72 0 R 83 0 R ] >>
endobj


//here it's 64 pages...
974 0 obj
<<
/Linearized 1
/O 976
/H [ 931 1410 ]
/L 5645529
/E 31260
/N 64
/T 5625930
>>
endobj





Edited by Ingo - 15 Feb 21 at 7:02PM
Cheers,
Ingo

Back to Top
ergadita View Drop Down
Beginner
Beginner


Joined: 15 Feb 21
Location: Spain
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote ergadita Quote  Post ReplyReply Direct Link To This Post Posted: 15 Feb 21 at 7:17PM
Hi Ingo, thank you so much for answer as soon. 
If not exists any function that returns the pages number without open the file, i will use LoadFromFile function and then the PageCount function.

i will buy this sdk and i hope that in the next release comes with this function.

Best regards

Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3296
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 15 Feb 21 at 7:33PM
Hi Juan :)


uuuups... I'm wrong. Never used it but here's the function you're asking for:
https://www.debenu.com/docs/pdf_library_reference/DAGetPageCount.php
This will feed your needs.
DA means direct access without loading.
What you really should avoid is mixing direct access with normal functions - this won't work.

Cheers,
Ingo

Back to Top
ergadita View Drop Down
Beginner
Beginner


Joined: 15 Feb 21
Location: Spain
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote ergadita Quote  Post ReplyReply Direct Link To This Post Posted: 15 Feb 21 at 7:56PM
Oleeeeeeeeee

Then i must use first DaOpenFile, this function returns a file handled than i can use with DaPageCount. 

Can i do so?

        QP = New PDFLibrary("DebenuPDFLibraryDLL1811.dll")

        If QP.UnlockKey(LicenseKey) <> 0 Then

        Dim fileHandle As Integer = QP.DAOpenFile(fileName, password)
        Dim pageCount As Integer = QP.DAPagecount(fileHandle)

        QP.DACloseFile(fileHandle)
        For Page As Integer = 1 To pageCount 
Dim Texts As String = QP.ExtractFilePageText(fileName, password, Page, 8) 
If Texts.Contains(searchvalue) Then 
QP.ExtractFilePages(fileName, "", OutputFileName, Page) 
 End If 
 Next
endif

Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3296
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 15 Feb 21 at 8:28PM
Hi Juan,

never mix DA and non-DA in one thread.
After QP.DAClose...
you should insert a QP.Free.
Then a new QP = New...
Then Unlock and then Extract and then Free again.

Here'sa sample about using DA-functionality:
https://www.debenu.com/kb/programmatically-render-pdf-files-in-windows-forms-with-net-and-c/


Cheers,
Ingo

Back to Top
ergadita View Drop Down
Beginner
Beginner


Joined: 15 Feb 21
Location: Spain
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote ergadita Quote  Post ReplyReply Direct Link To This Post Posted: 16 Feb 21 at 9:37AM
Hi Ingo, 

I will do that.

Thanks & Best Regards
Back to Top
ergadita View Drop Down
Beginner
Beginner


Joined: 15 Feb 21
Location: Spain
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote ergadita Quote  Post ReplyReply Direct Link To This Post Posted: 25 Feb 21 at 9:57AM
Hi Ingo, i have finished the app, and runs ok in my computer in a executable file, but i need to put in our server like a webservice in IIS into a DLL, but the license not run in the DLL, UnlockKey function returns 0, where is the problem. I need to test in the server before i purchase it.

Thanks & Best Regards
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3296
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 01 Mar 21 at 10:36PM
What is LastErrorCode telling after UnlockKey?

Cheers,
Ingo

Back to Top
ergadita View Drop Down
Beginner
Beginner


Joined: 15 Feb 21
Location: Spain
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote ergadita Quote  Post ReplyReply Direct Link To This Post Posted: 02 Mar 21 at 3:01PM
Hi Ingo, 

UnlockKey returns 0
LastErrorCode returns 0

Now, i´m thinking, is possible that may be any problem with firewall?
The unlockey connects to any of your server to check licensekey?

Thanks & Best Regards
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3296
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 02 Mar 21 at 8:55PM
Hi,

i'm working with a source version (so i need no unlock-function).
I don't know how the server access willbe processed.
Sorry... Perhaps here's another one knowing something about these procedures.
This is only a forum from users and for users.
BTW: Are you sure that your license key is still valid (30 days is the limit)?
Did you get any textfiles with the key included?
Cheers,
Ingo

Back to Top
tfrost View Drop Down
Senior Member
Senior Member


Joined: 06 Sep 10
Location: UK
Status: Offline
Points: 341
Post Options Post Options   Thanks (0) Thanks(0)   Quote tfrost Quote  Post ReplyReply Direct Link To This Post Posted: 02 Mar 21 at 10:27PM
I don't think that internet access is needed to validate the key.  We use a license key in lots of different EXE and DLL files at many customer sites, some of them tightly secured. and nobody has reported any block or asked for how to get past a firewall.  But I have never used a trial version; it might be different.
Back to Top
ergadita View Drop Down
Beginner
Beginner


Joined: 15 Feb 21
Location: Spain
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote ergadita Quote  Post ReplyReply Direct Link To This Post Posted: 03 Mar 21 at 11:12AM
Hi, 
The license key is good because if i execute the executable file the unlock function returns 1, is the same code for dll and for exe. is there any possibility to get a temporary license key for pro version, not for trial?
I sent an email to support, do you know other way to arrive to technical support?
I attach a screen capture of licence key

Thanks for your answers and best regards

Back to Top
ergadita View Drop Down
Beginner
Beginner


Joined: 15 Feb 21
Location: Spain
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote ergadita Quote  Post ReplyReply Direct Link To This Post Posted: 03 Mar 21 at 11:14AM
the image not is, i can´t attach, but says this:

Trial period : Evaluation license valid until 14 March 2021.

Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3296
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 03 Mar 21 at 10:17PM
the trial version IS the pro-version... working with a testkey.
If the unlock function returns with 1 using an exe-file (don't know what exe you're meaning) then the license key is valid.
If your test app doesn't work and unlock returns with 0 then there's something wrong in your sample code or the installation?
There are several versions of the library... 32 and 64 bit... where is the library-dll?
Perhaps you should post the code?
Cheers,
Ingo

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store