Print Page | Close Window

Get page count without open file

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=3893
Printed Date: 22 Nov 24 at 6:56PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Get page count without open file
Posted By: ergadita
Subject: Get page count without open file
Date 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.



Replies:
Posted By: Ingo
Date 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





-------------
Cheers,
Ingo



Posted By: ergadita
Date 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



Posted By: Ingo
Date 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



Posted By: ergadita
Date 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



Posted By: Ingo
Date 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



Posted By: ergadita
Date Posted: 16 Feb 21 at 9:37AM
Hi Ingo, 

I will do that.

Thanks & Best Regards


Posted By: ergadita
Date 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


Posted By: Ingo
Date Posted: 01 Mar 21 at 10:36PM
What is LastErrorCode telling after UnlockKey?



-------------
Cheers,
Ingo



Posted By: ergadita
Date 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


Posted By: Ingo
Date 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



Posted By: tfrost
Date 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.


Posted By: ergadita
Date 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



Posted By: ergadita
Date 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.



Posted By: Ingo
Date 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



Posted By: ergadita
Date Posted: 09 Mar 21 at 12:16PM
HI ingo,

We are trying to create an asp webservice project with vs2017 and dll unmanaged, but we have problems with iis and unmanaged dll. You can see this problem in
https://stackoverflow.com/questions/44455559/iis-and-external-unmanaged-dll
https://amithegde.com/2015/06/fixing-unmanaged-dll-not-found-exception-on-asp-net-app.html

then we try with activex dll, we register the 64bits activex dll, but vs2017 cant load in com references, but if we register 32bits we can load at com references. Then we try without load com, and importing the file in imports folder, "DebenuPDFLibraryAX1811.cs". The function Type.GetTypeFromProgID("DebenuPDFLibrary64AX1811.PDFLibrary") returns the type but when we call Activator.CreateInstance(comType) returns :

No se pudo recuperar el generador de clases COM para el componente con CLSID {480150A0-2BD1-4C97-820B-009527B9E883} debido al siguiente error: 80040154 Clase no registrada (Excepction HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
Thanks & Best regards.



Posted By: ergadita
Date Posted: 09 Mar 21 at 12:37PM
HI,
The real problem is with activex 64bits dll, there is a problem registering, because neither VS2017 nor IIS recognize the dll and gives an clsid error. We can`t do the project with 32bits because IIS works with 64bits.

When we register the 64 bits activex dll, the administrador window of cmd returns "Dllregisterserver runs ok in DebenuPDFLibrary64AX1811.dll" but the activex object is not installed in windows.

Thanks & Best Regards.


Posted By: Ingo
Date Posted: 09 Mar 21 at 5:53PM
Did you already search through forum and www.quickpdf.org?

I did it:

Helpful posts from the community here:
http://www.quickpdf.org/forum/using-the-activex-version-with-asp_topic1209.html
http://www.quickpdf.org/forum/activex-to-new-activex_topic2413.html

A short guide from a user long ago:
Hey,
I have quick PDF running on Windows Server 2008 without issue, using the the standard 32bit activeX DLL
Here is how:
- Open IIS Manager
- Click on "Application Pools"
- Click on the name of the application pool that is running the quick PDF website
- Click "Advanced Settings"
- Set "Enable 32-bit applications" to True
Done!
If you are not doing so already I find its best to run all sites under there own application pool.

And at least: Getting started ActiveX Edition:
http://www.debenu.com/wp-content/uploads/Foxit_Quick_PDF_Library_15_ActiveX_GettingStarted.pdf


BTW: Each prob should have an own thread. Who shall find your actual prob at a thread with the title "...page count..."? ;-)




-------------
Cheers,
Ingo



Posted By: ergadita
Date Posted: 09 Mar 21 at 6:16PM
hi Ingo,

i didn´t search because i didn´t know how do it.

changing application pools to 32bits solve the problem. But which is the reason that the activex 64bits is not recognized by VS2017 or by IIS? but 32 bits is recognized. I want work with 64bits. There is a problem with 64bits activex dll.


I will search for a thread about "problems registering 64bits activex dll", if i don´t found i will open it

Thank you so much.



Posted By: Ingo
Date Posted: 09 Mar 21 at 7:16PM
"a short guide from a user" doesn't help?
See "enable application"...

windows wants 64 bit in a special directory and 32 bit in another special directory.
I think in VS you can do the settings for 64 and 32 bit as well.
Think your settings aren't clear but mixed?
If you put the 32-bit-dll and it works it won't be enough to replace the 32-bit-dll with the 64-bit-dll...

Starting point for all QuickPDF-ressources:
www.QuickPDF.org

Search in the whole forum:
At the top, right "search -> advanced search".

Search in the whole ressources:
https://www.debenu.com/docs/pdf_library_reference/Search.php




-------------
Cheers,
Ingo




Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk