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!
ExtractFilePages resulting in corrupt output |
Post Reply |
Author | |
rrobinson@mhccom.com
Beginner Joined: 14 Nov 17 Location: Burnsville, MN Status: Offline Points: 7 |
Post Options
Thanks(0)
Posted: 14 Nov 17 at 8:36PM |
Hi all,
I have a PDF file, actually several, that are ending up as unreadable in Adobe Reader or Foxit after being split by page. The files start off as searchable and needs to be searchable at conclusion. Here is my code in VB: Dim QP As New DebenuPDFLibraryAX1411.PDFLibrary Dim SourceName As String, NumberPages As Integer, PageCounter As Integer Dim fNameNoExtension As String, FileOut as String, docID As Long SourceName = "C:\TEMP\75696\mySource.pdf" fNameNoExtension = Left(SourceName, Len(SourceName) - 4) & "_" QP.LoadFromFile SourceName, "" docID = QP.SelectedDocument() NumberPages = QP.PageCount QP.RemoveDocument docID For PageCounter = 1 To NumberPages FileOut = fNameNoExtension & CStr(PageCounter) & ".pdf" QP.ExtractFilePages SourceName, "", FileOut, PageCounter Next PageCounter Set QP = Nothing I ran one of the files through an online split program and it worked perfectly. Any input or thoughts are greatly appreciated. I also have created a service ticket for this issue. BTW, QP.SecurityInfo(0) returns 0 so it doesn't appear to be secured in any way. Thanks, Randy
|
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
Hi Randy,
please read here about the function (have an eye on RangeList and what should be inside ;-) http://www.debenu.com/docs/pdf_library_reference/ExtractFilePages.php RangeList expects a unicode string... Cheers and welcome here, Ingo |
|
Cheers,
Ingo |
|
rrobinson@mhccom.com
Beginner Joined: 14 Nov 17 Location: Burnsville, MN Status: Offline Points: 7 |
Post Options
Thanks(0)
|
Ingo,
Thanks for the response. I changed the line: QP.ExtractFilePages SourceName, "", FileOut, PageCounter to: QP.ExtractFilePages SourceName, "", FileOut, CStr(PageCounter) and it yielded the same results. Thanks, Randy
|
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
What are you doing with docid and removedocid?
Do the Load... the decryption... then the extract... Then the Free. You can catch the returning value from each function - is there any error? |
|
Cheers,
Ingo |
|
rrobinson@mhccom.com
Beginner Joined: 14 Nov 17 Location: Burnsville, MN Status: Offline Points: 7 |
Post Options
Thanks(0)
|
Thanks for your advice. It's working now.
I got the docID and RemoveDocID portion of the code from the Foxit Quick PDF Library 14 Developer Guide where it talks about PDF Splitting. I thought it seemed extraneous but are the Guides ever wrong? LOL Anyway here is my final VB Code: Dim SourceName As String, fNameNoExtension As String Dim NumberPages As Integer, PageCounter As Integer Dim DecryptedFile As String, DecryptedReturnValue As Integer, FileOut As String SourceName = txtFile.Text QP.LoadFromFile SourceName, "" fNameNoExtension = Left(SourceName, Len(SourceName) - 4) & "_" DecryptedFile = fNameNoExtension & "d.pdf" DecryptedReturnValue = QP.Decrypt() QP.SaveToFile (DecryptedFile) QP.LoadFromFile DecryptedFile, "" NumberPages = QP.PageCount For PageCounter = 1 To NumberPages FileOut = Left(DecryptedFile, Len(DecryptedFile) - 4) & "_" & CStr(PageCounter) & ".pdf" QP.ExtractFilePages DecryptedFile, "", FileOut, CStr(PageCounter) Next PageCounter Again, Thanks for your help.
|
|
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