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!
![]() |
CopyPageRanges Results in blank page |
Post Reply
|
| Author | |
bwolfe
Beginner
Joined: 23 Aug 12 Status: Offline Points: 2 |
Post Options
Thanks(0)
Quote Reply
Topic: CopyPageRanges Results in blank pagePosted: 23 Aug 12 at 5:14PM |
|
I am attempting to loop thru a PDF document and create multiple pages per PDF. My original PDF is 409 pages and has security on Document Assembly. My loop reports successful (1) on page 1 and unsuccessful (0) on subsequent pages with an error code of 412. I took an unsecured PDF with 1 page and attempted and CopyPageRanges reports successful. No matter what I try, I get a PDF with a blank page. I am fairly certain, after reviewing the forums, that I have the correct PDF selected at the time of extraction. It seems pretty straightforward.
Sub ConvertQuickPDF(ByVal oFile As IO.FileInfo, ByVal oFolder As IO.DirectoryInfo) Dim oQP As QuickPDFAX0814.PDFLibrary = Nothing Dim lID As Integer = 0 Dim lNewID As Integer = 0 Dim oNewFile As IO.FileInfo = Nothing Dim lPageCount As Integer = 0 Dim i As Integer = 0 Const SPK As String = "***********" Try oQP = New QuickPDFAX0814.PDFLibrary oQP.UnlockKey(SPK) lID = oQP.LoadFromFile(oFile.FullName, "") lPageCount = oQP.PageCount 'Get First Document ID lID = oQP.GetDocumentID(1) For i = 1 To lPageCount oQP.SelectDocument(lID) oQP.SelectPage(i) 'Get New Document lNewID = oQP.NewDocument() 'Select New Document oQP.SelectDocument(lNewID) 'Copy a page by number from original PDF to new pdf oQP.CopyPageRanges(lID, i.ToString) 'Delete blank initial page oQP.DeletePages(1, 1) oNewFile = New IO.FileInfo(oFolder.FullName & "\" & Format(i, "00000000") & ".pdf") IO.Directory.CreateDirectory(oNewFile.DirectoryName) 'Save new PDF - always a blank page oQP.SaveToFile(oNewFile.FullName) 'Remove the New PDF from collection oQP.RemoveDocument(lNewID) Next oQP.RemoveDocument(lID) Catch ex As Exception End Try
End Sub |
|
![]() |
|
Wheeley
Senior Member
Joined: 30 Oct 05 Location: United States Status: Offline Points: 146 |
Post Options
Thanks(0)
Quote Reply
Posted: 23 Aug 12 at 9:02PM |
|
What you are not understanding is even before you load the file QuickPDF already has a blank document in memory. This is by default and intentional. So your line GetDocumentID (1) is in fact selecting the default blank document which is why CopyPageRanges is failing. So, what you should do is GetDocumentID (DocumentCount()) and it should work.
Wheeley |
|
![]() |
|
bwolfe
Beginner
Joined: 23 Aug 12 Status: Offline Points: 2 |
Post Options
Thanks(0)
Quote Reply
Posted: 23 Aug 12 at 9:25PM |
|
That did the trick. Thanks so much.
Can you tell me why CopyPageRanges takes so long on larger files? I have a PDF that has 1715 pages. When I open it, it is fine. When execute CopyPageRanges and specifiy a single page, it takes quite a while. For each page, to copy to, the CopyPageRanges takes an inordinate amount of time to execute. It doesn't take a long time for 400 pages, but once you get to 1000 or so, it crawls.
|
|
![]() |
|
Wheeley
Senior Member
Joined: 30 Oct 05 Location: United States Status: Offline Points: 146 |
Post Options
Thanks(0)
Quote Reply
Posted: 23 Aug 12 at 11:44PM |
|
You will have to get official support to answer that question. There were known performance issues when dealing with large files that the previous owner didn't address. I don't know if Debenu has fixed them or not. I do know they are a much better company at responding to issues in the library. So put in an official support ticket and see what they say. Go here:
http://www.debenu.com/support/contact/ Wheeley |
|
![]() |
|
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