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 - ExtractFilePages resulting in corrupt output
  FAQ FAQ  Forum Search   Register Register  Login Login

ExtractFilePages resulting in corrupt output

 Post Reply Post Reply
Author
Message
rrobinson@mhccom.com View Drop Down
Beginner
Beginner


Joined: 14 Nov 17
Location: Burnsville, MN
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote rrobinson@mhccom.com Quote  Post ReplyReply Direct Link To This Post Topic: ExtractFilePages resulting in corrupt output
    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
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 2630
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 15 Nov 17 at 8:31PM
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

Back to Top
rrobinson@mhccom.com View Drop Down
Beginner
Beginner


Joined: 14 Nov 17
Location: Burnsville, MN
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote rrobinson@mhccom.com Quote  Post ReplyReply Direct Link To This Post Posted: 15 Nov 17 at 8:46PM
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
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 2630
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 15 Nov 17 at 10:49PM
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

Back to Top
rrobinson@mhccom.com View Drop Down
Beginner
Beginner


Joined: 14 Nov 17
Location: Burnsville, MN
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote rrobinson@mhccom.com Quote  Post ReplyReply Direct Link To This Post Posted: 17 Nov 17 at 2:57PM
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.
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