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!
![]() |
split large PDF file |
Post Reply ![]() |
Author | |
DrCizor ![]() Beginner ![]() Joined: 13 Apr 15 Status: Offline Points: 7 |
![]() ![]() ![]() ![]() ![]() Posted: 13 Apr 15 at 1:54PM |
hi everyone,
I am working with Delphi and wish to quickly split a PDF file into several other files. I have a PDF source file containing a minimum of 5000 pages and a table describing how to group the documents. Ths table contains the informations : - Document name (string) - First page of the document, from the begining ( Integer) - Number of pages ( Integer) The number of pages per document varies from 1 to 12. What I want to output is 12 files each containing all the documents with the same number of pages : -> one file with all the "one page" -> one file with all the "two pages" -> one file with all the "three page" etc... -> and one file with all the "twelve pages". How to proceed with QuickPDF to get prompt treatment and which methods to use ? Thank you |
|
![]() |
|
mLipok ![]() Senior Member ![]() ![]() Joined: 23 Apr 14 Location: Poland, Zabrze Status: Offline Points: 453 |
![]() ![]() ![]() ![]() ![]() |
@DrCizor
First what You need is to use http://www.debenu.com/docs/pdf_library_reference/ExtractFilePages.php or http://www.debenu.com/docs/pdf_library_reference/ExtractFilePagesEx.php ps. I'am using AutoIt (this is similar to VBScript) and here you have some concept how to split file in separate page Func _QPDF_FileSplitEachPage($sPDF_FileFullPath, $sPDF_Password = '', $sDestinationDir = Default, $iNumberOfDigits = 3) If $sDestinationDir = Default Then $sDestinationDir = @ScriptDir & '\Extracted' Local $oQP If _QPDF_CreateObjectAndUnlock($oQP) = 1 Then $oQP.LoadFromFile($sPDF_FileFullPath, $sPDF_Password) ; _QPDF_LastErrorCode($oQP) Local $iTotalPages = _QPDF_FileGetPageCount($sPDF_FileFullPath, '') Local $sPDF_Destination = '' If Not FileExists($sDestinationDir) Then DirCreate($sDestinationDir) Local $aPageFileList[$iTotalPages + 1] $aPageFileList[0] = $iTotalPages For $n = 1 To $iTotalPages $sPDF_Destination = $sDestinationDir & '\' & StringRegExp($sPDF_FileFullPath, '(?i).*\\(.*?)\.pdf', 3)[0] & '_p' & __QPDF_AddLeadingZeros(String($n), $iNumberOfDigits) & ".pdf" $aPageFileList[$n] = $sPDF_Destination $oQP.ExtractFilePages($sPDF_FileFullPath, '', $sPDF_Destination, $n) Next Return SetError(0, 0, $aPageFileList) Else Return SetError($__eQPDF_ERROR_DEBENULICENCE, 0, 0) EndIf EndFunc ;==>_QPDF_FileSplitEachPage Then you can use your TABLE and use http://www.debenu.com/docs/pdf_library_reference/AddToFileList.php http://www.debenu.com/docs/pdf_library_reference/FileListCount.php http://www.debenu.com/docs/pdf_library_reference/ClearFileList.php and finally http://www.debenu.com/docs/pdf_library_reference/MergeFileList.php http://www.debenu.com/docs/pdf_library_reference/MergeFileListFast.php or http://www.debenu.com/docs/pdf_library_reference/MergeFiles.php Regards, mLipok |
|
Here you can find description how to test my examples:
http://www.quickpdf.org/forum/forum_posts.asp?TID=2932&PID=12600&title=drawcapturedpagematrix-matrix-howto#12600 |
|
![]() |
|
DrCizor ![]() Beginner ![]() Joined: 13 Apr 15 Status: Offline Points: 7 |
![]() ![]() ![]() ![]() ![]() |
Thank you mLipok,
I adapted your code in Delphi language and it works well ! Merci |
|
![]() |
|
mLipok ![]() Senior Member ![]() ![]() Joined: 23 Apr 14 Location: Poland, Zabrze Status: Offline Points: 453 |
![]() ![]() ![]() ![]() ![]() |
Do it mean my coding style is transparent and clear (at least for you) ?
|
|
Here you can find description how to test my examples:
http://www.quickpdf.org/forum/forum_posts.asp?TID=2932&PID=12600&title=drawcapturedpagematrix-matrix-howto#12600 |
|
![]() |
|
mLipok ![]() Senior Member ![]() ![]() Joined: 23 Apr 14 Location: Poland, Zabrze Status: Offline Points: 453 |
![]() ![]() ![]() ![]() ![]() |
btw.
Can you share here your Delphi solution ? I would also learn something. Cheers, mLipok |
|
Here you can find description how to test my examples:
http://www.quickpdf.org/forum/forum_posts.asp?TID=2932&PID=12600&title=drawcapturedpagematrix-matrix-howto#12600 |
|
![]() |
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