GetPagesCount Error

This Forum is for the use of Software Developers requiring help and assistance for Tracker Software's PDF-Tools SDK of Library DLL functions(only) - Please use the PDF-XChange Drivers API SDK Forum for assistance with all PDF Print Driver related topics or PDF-XChange Viewer SDK if appropriate.

Moderators: TrackerSupp-Daniel, Tracker Support, Chris - Tracker Supp, Vasyl-Tracker Dev Team, Sean - Tracker, Tracker Supp-Stefan

Post Reply
glima
User
Posts: 82
Joined: Mon Sep 20, 2004 4:27 pm
Location: Phoenix, AZ

GetPagesCount Error

Post by glima » Mon Oct 24, 2011 7:03 pm

I am using the PXCp_GetPagesCount function and on some PDF's it returns an error PS_ERR_REQUIRED_PROP_NOT_SET.

If I let the process continue I get DPro_Err_WrongPageNumber from the PXCp_PageGetBox for the MediaBox ID.

John - Tracker Supp
Site Admin
Posts: 8196
Joined: Tue Jun 29, 2004 10:34 am
Location: Vancouver Island - Canada
Contact:

Re: GetPagesCount Error

Post by John - Tracker Supp » Mon Oct 24, 2011 7:50 pm

Hi - can you post a couple of example files and sample code snippet used so we can check please?

Thanks
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.

Best regards
Tracker Support
http://www.tracker-software.com

glima
User
Posts: 82
Joined: Mon Sep 20, 2004 4:27 pm
Location: Phoenix, AZ

Re: GetPagesCount Error

Post by glima » Sat Oct 29, 2011 2:23 am

The code does this.

if (PXCp_Init(&hFileHandle, PFXGLO_SerialKey4, PFXGLO_DevCode4) == 0)
{
if (PXCp_ReadDocumentW(hFileHandle, FileNameW, 0) == 0)
{
if ((err = PXCp_GetPagesCount(hFileHandle, &lDocumentPages)) != 0 )
printf("ProcessFiles - Get Pages Count = %d",&err);


I have attached a test_a.zip file that returns an error.
Attachments
test_a.zip
(250.51 KiB) Downloaded 124 times

Lzcat - Tracker Supp
Site Admin
Posts: 710
Joined: Thu Jun 28, 2007 8:42 am

Re: GetPagesCount Error

Post by Lzcat - Tracker Supp » Mon Oct 31, 2011 9:40 am

Hi,

This file is broken (the xref table is incorrect) and I am afraid that the xcpro40.dll library can work only with in tact files - correctly formatted.

I assume this is a one of file - if you have multiple files such as this you may want to contact the source and advise them - also opening in our Viewer 'may' allow in some cases such files to be re-saved and the issue corrected - the next major releases of our libraries will also include similar functionality - though it is far from possible to correct all problems in all files - so please dont expect a 'panacea' for all problem files.
Victor
Tracker Software
Project manager

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.

igor_p
User
Posts: 24
Joined: Wed Oct 02, 2013 7:18 am

Re: GetPagesCount Error

Post by igor_p » Thu Oct 04, 2018 1:29 pm

Hello,

I have exactly the same problem as described in this topic. Could you, please, check attached PDF file and tell me what is wrong with it? I thought that it simply does not contain a "/Count" property, but it is available:

Code: Select all

<<
/Type /Pages
/Kids [ 3 0 R 7 0 R 10 0 R 13 0 R 16 0 R]
/Count 5
>>
I'm trying to set up a document scanner which will produce PDF documents compatible with your software, but without success so far. Any suggestions will be much appreciated.

Regards,
Igor Paszewski
Attachments
test_file.zip
(2.45 MiB) Downloaded 9 times

Lzcat - Tracker Supp
Site Admin
Posts: 710
Joined: Thu Jun 28, 2007 8:42 am

Re: GetPagesCount Error

Post by Lzcat - Tracker Supp » Thu Oct 04, 2018 3:12 pm

Hi Igor.
Yes, this file contains exactly same error - Incorrect XRef table.

Code: Select all

xref
1 19
0000000000 65535 f 
0000000009 00000 n 
0000450623 00000 n 
0000450720 00000 n 
0002714178 00000 n 
0000450907 00000 n 
0000984635 00000 n 
0000984732 00000 n 
0000984919 00000 n 
0001503370 00000 n 
0001503467 00000 n 
0001503655 00000 n 
0002018134 00000 n 
0002018232 00000 n 
0002018422 00000 n 
0002713890 00000 n 
0002713988 00000 n 
0002714263 00000 n 
0002714315 00000 n 
trailer
<<
/Size 19
/Root 17 0 R
/Info 18 0 R
>>
Error is in string

Code: Select all

1 19
- it should be

Code: Select all

0 19
If you read PDF specification you will see that objects numbers in xref are shifted by 1 regarding to real. This is known issue of some software that scan to PDF.
All we can help with this is advise to switch from old SDK to new one - Core API SDK or Editor SDK, depending on you needs. Both of them are more powerful and handle most kinds of broken files, same as end user Editor.
HTH.
Victor
Tracker Software
Project manager

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.

Post Reply