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 - ExtractPages
  FAQ FAQ  Forum Search   Register Register  Login Login

ExtractPages

 Post Reply Post Reply
Author
Message
GreatPyr View Drop Down
Beginner
Beginner
Avatar

Joined: 09 Dec 05
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote GreatPyr Quote  Post ReplyReply Direct Link To This Post Topic: ExtractPages
    Posted: 22 Dec 05 at 4:54PM
Everytime I execute the VB code below, ExtractPages always returns 1 in lngDoc2. The documentation said it would return the ID of the new document containing the extracted pages. Any ideas what I'm doing wrong?

Thanks.

        WorkingPDF.LoadFromFile ("MainDoc.pdf")
        lngDoc1 = WorkingPDF.SelectedDocument
        WorkingPDF.LoadFromFile ("IA-004405.pdf")
        lngDoc3 = WorkingPDF.SelectedDocument
        lngDoc2 = WorkingPDF.ExtractPages(1, 4)
        WorkingPDF.SelectDocument (lngDoc1)
        WorkingPDF.MergeDocument (lngDoc2)
Back to Top
GreatPyr View Drop Down
Beginner
Beginner
Avatar

Joined: 09 Dec 05
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote GreatPyr Quote  Post ReplyReply Direct Link To This Post Posted: 22 Dec 05 at 5:39PM
Do I need to merge the extracted pages? If I take the last two lines off the code, it seems to work. Somehow the extracted pages find their way to lngDoc1, even though it's not the selected document. I'm just not comfortable with it until I know why it's working.

I wish there was some documentation for this stuff.

Edited by GreatPyr
Back to Top
chicks View Drop Down
Debenu Quick PDF Library Expert
Debenu Quick PDF Library Expert


Joined: 29 Oct 05
Location: United States
Status: Offline
Points: 251
Post Options Post Options   Thanks (0) Thanks(0)   Quote chicks Quote  Post ReplyReply Direct Link To This Post Posted: 22 Dec 05 at 6:32PM
Haven't tested it, and the doc does say that SelectDocument() returns an ID, but maybe it's returning the doc's index instead? Put some debug code in to print out exactly what it's returning. If it's 1 or 2 or 3, it's the index, and you'll need to use DocumentID() to get the actual ID, which is usually a multi-digit number.
Back to Top
Michel_K17 View Drop Down
Newbie
Newbie
Avatar
www.exp-systems.com

Joined: 25 Jan 03
Status: Offline
Points: 297
Post Options Post Options   Thanks (0) Thanks(0)   Quote Michel_K17 Quote  Post ReplyReply Direct Link To This Post Posted: 22 Dec 05 at 11:02PM
I used the ExtractPages for nearly 2 years without any problems. I think you are correct: the documentation is wrong. Here is my code but note that I use "SelectedDocument" to get the Doc ID.

Private Function PDF_Extract_Page(InFile As String, OutFile As String, page As String) As Long
    Dim hDoc1Page As Long
    
    ' Trap Errors
    On Error GoTo Error_Handler
    
    
    ' Get rid of ".pdf"
    If Len(OutFile) > 4 Then
        OutFile = Left$(OutFile, Len(OutFile) - 4) & "_"
    Else
        Exit Function
    End If

    ' Create a new single page document
    rtn = oPDF.SelectDocument(hDoc)
    hDoc1Page = oPDF.ExtractPages(Val(page), 1)
    hDoc1Page = oPDF.SelectedDocument()

    ' Save it
    rtn = oPDF.SaveToFile(OutFile & Format$(Val(page), "0000") & PDF)

    ' Get rid of single page doc
    rtn = oPDF.RemoveDocument(hDoc1Page)

    ' Job Complete
    PDF_Extract_Page = True
    Exit Function
    
Error_Handler:
    olog.LogError False, Err.Number, Err.Description, Err.LastDllError, "PDF_Extract_Page"
End Function


Edited by Michel_K17
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