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!
ExtractPages |
Post Reply |
Author | |
GreatPyr
Beginner Joined: 09 Dec 05 Status: Offline Points: 4 |
Post Options
Thanks(0)
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) |
|
GreatPyr
Beginner Joined: 09 Dec 05 Status: Offline Points: 4 |
Post Options
Thanks(0)
|
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 |
|
chicks
Debenu Quick PDF Library Expert Joined: 29 Oct 05 Location: United States Status: Offline Points: 251 |
Post Options
Thanks(0)
|
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.
|
|
Michel_K17
Newbie www.exp-systems.com Joined: 25 Jan 03 Status: Offline Points: 297 |
Post Options
Thanks(0)
|
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 |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store