Print Page | Close Window

[SOLVED] ExtractFilePages

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=1662
Printed Date: 18 May 24 at 1:10PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: [SOLVED] ExtractFilePages
Posted By: PolderBoy
Subject: [SOLVED] ExtractFilePages
Date Posted: 30 Nov 10 at 12:10PM
Hello All,

Question: I would like to use in VB6 the function:
ExtractFilePages(
  InputFileName As String, OutputFileName As String,
  RangeList As String) As Long

But I keep getting the 412 error which means 'Invalid page range list'
strRangeList = "1"
strRangeList = "1-2"
strRangeList = "1,2"
lngResult = ExtractFilePages(strInputFileName, strOutputFileName, strRangeList)
I have tried to put it directly into the function call:
lngResult = ExtractFilePages(strInputFileName, strOutputFileName, "1")

But in all casses we are getting a result of 412.

Could it be that we are using the demo version?

Thanks in advance.
PolderBoy



Replies:
Posted By: PolderBoy
Date Posted: 30 Nov 10 at 1:18PM
Dear All,

I have tried the function in the 'Quick PDF Library Console' and it doesn't work there either.

PolderBoy


Posted By: Ingo
Date Posted: 30 Nov 10 at 2:43PM
Originally posted by PolderBoy PolderBoy wrote:


Could it be that we are using the demo version?


This could be ... use the testregkey to unlock the library ...
and then ExtractFilePages.

If this won't work you should post all relevant code
from create ... load ... extractfilepages ... free

Cheers, Ingo



Posted By: PolderBoy
Date Posted: 30 Nov 10 at 4:48PM
Dear All,

Thank you for the reply.

But we are using the testkey, that is something we need to supply otherwise it won't work at all.
Here is our code:

Private Function PDFPaginaSamenvoegen(InputFileName As String, OutputFileName, RangeList) As Integer

Dim ClassName As String
Dim intResultaat As Integer

ClassName = "QuickPDFAX0721.PDFLibrary"

Dim QP
Dim Result
Set QP = CreateObject(ClassName)
Result = QP.UnlockKey(LicenseKey)
    
If Result = 1 Then
   
    intResultaat = QP.ExtractFilePages(InputFileName, OutputFileName, RangeList)
   
    If intResultaat = 1 Then
        PDFPaginaSamenvoegen = 1
    Else
        PDFPaginaSamenvoegen = 0
        Call MsgBox("De fout code is: " & QP.LastErrorCode, vbOKOnly)
    End If

Else
    MsgBox "Invalid license key. Please set your license key by editing this file."
    PDFPaginaSamenvoegen = "ERROR"
End If

Set QP = Nothing

End Function

The variable LicenseKey is filled when the program is loaded.
The variable InputFileName is filled correct, the file exist, and has 32 pages (QP.pagecount).
The variable OutputFileName is a correct adres and file name, doesn't exist. Tried it with an existing file. Same error number (412)
RangeList has been tested with all sort of possibilitys.
As mentioned in other post.

We also use part of the code(the setting of QP) for QP.pagecount
So we are sure that some functions work, and part of our code is correct.

You said that we should give all the code but this is all the code.
Do we need to create the pdf first?
Do we need ro load the pdf first?
We (I) couldn't find any clear answer to that.
I just downloaded the VB6 example and worked from there.

Thanks in advance.

PolderBoy



Posted By: Ingo
Date Posted: 30 Nov 10 at 6:05PM
Hi!

ExtractFilePages works on PDF-documents whithout loading ...
Good for the memory-usage ;-)
This function is already a very old one - so it should be work stable...
If you get always an error the questions could be:
With each file or only few?
Are the files write protected?
EBook-files or something like that?
Is there a user password on the file?
Where are the files... which path... what about the security settings for this path?

Cheers, Ingo
 


Posted By: PolderBoy
Date Posted: 30 Nov 10 at 6:19PM
Hello,

Thanks for the reply.

Good question:
As I have only one file tested (for opening) that could be the case.
But Adobe Acrobat reader can open the file, no password, the file is on the same harddisk as the VB6 program.
Folderpath is correct.
The pdf are scans made by a canon scanner of about 32 pages.
They are placed, by the canon machine, in the folder. I have moved the files to another folder. No luck.

When I make a error bij changing the path to a non existing pdf file we get another error: "Can't find file". That makes me believe that it hasn't anything to do with the files or folders.

Could I sent you the pdf file?
And could you test it there with you?
And, most important, would you?

PolderBoy



Posted By: PolderBoy
Date Posted: 05 Dec 10 at 11:48AM
Dear All,

I have been testing the VB6 code and found out the fact that I can only use the function if page 1 is included:
These are the strings that I 'give' into the function:
(Private Function PDFPaginaSamenvoegen(InputFileName As String, OutputFileName as String, RangeList as String) As Integer)

1,2,3,4 -->works
5,7,9 --> gives error 412
5 --> gives error 412
1 -->works
1,2,3 -->works
2,3,4,5 --> gives error 412

I don't always want to include the first page.
I could and after succesful making the file, remove the first page if needed. But that is not the way I would like to make the program.

I hope somebody can help me further.
PolderBoy



Posted By: PolderBoy
Date Posted: 07 Dec 10 at 8:10PM
Hello All,

Just to let you all know we/I have solved it.
Well not really we just tried something else:

ExtractPageRanges


First load the file then extractpageranges and put the in another pdf file.

Thanks for all the help.

POlderBoy


Posted By: markc
Date Posted: 10 Jan 11 at 4:47PM
We had identical problem with DELPHI
I will try using the PageRange function.
 
But still the function EXTRACTFILEPAGES needs to be fixed.



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