PDFSplitMergeLib is
a freeware ActiveX dll library for merging and splitting PDF document
files
See also:
PDFSplitMergeLib is a freeware ActiveX dll library
for merging and splitting PDF document files
Requires .NET Framework 2.00 installed to operate
- IPDFSplitMerge ( PDFSplitMergeLib.PDFSplitMerge
object) interface methods
- Sample Code - how to use code
- How to install library on target computer
- Download
IPDFSplitMerge
( PDFSplitMergeLib.PDFSplitMerge object) interface methods
| Methods of IPDFSplitMerge interface ( PDFSplitMergeLib.PDFSplitMerge
object) |
Description |
| AddPDFFromFileName(PDFFileName
as String) as Integer |
Add PDF document to the internal list of files to process.
Returns index of PDF document in internal list. This index
is intended to use with other methods like GetPagesCount,
SplitPagesToFolder etc. |
| GetPagesCount(PDFIndex as
Integer) as Integer |
Returns number of pages in PDF document referenced by PDF
document index in internal list of PDF documents. Add PDF
document into list using .AddPDFFromFileName method |
| SplitPagesToFolder(Path as
String, BaseFileName as String, PDFIndex as Integer, Pages
as String) as Boolean |
Extracts pages from PDF document referenced by PDFIndex
(index of PDF document in internal list) into given folder
and creates PDF document for every single extracted page.
Path - path to folder to store PDF documents with
extracted pages
BaseFileName - base filename for generated PDF
documents
PDFIndex - index of PDF document in internal collection
of documents (add to collectionusing .AddPDFFromFileName
method)
Pages - string containing comma-separated
page numbers of pages to extract. Use "-" to define
range of pages, for example: "1,3-5,7" will extract
1,3,4,5,7 pages
Generated filenames for pages are generated using the rule:
Path/BaseFileName - XXXXX.pdf
where XXXXX is the page number
Method returns True if extraction was successfull or False
otherwise.
Also check SelectPagesToExtract and SaveToFile method for
extracting pages and saving them into single PDF document |
MergeToFile(FileName as String,
FileList as String) as Boolean
|
Method merges selected PDF documents previously added
into internal collection using .AddPDFFromFileName method
into single PDF document.
Filename - filename of single PDF document containing
merged PDF documents
FileList - string containg comma-separated
indexes of PDF documents to merge. For example: "1,3-6"
will merge PDF document number 1,3,4,5,6 into single final
PDF document.
Index of PDF document is returned by .AddPDFFromFileName
method.
|
| SelectPagesToExtract (PDFIndex
as Integer, Pages as String) as Boolean |
Selects pages from PDF document for further extraction
and merging into single PDF document. This can be used for
purpose of extracting given pages from 2 or more documents
to merger them into 1 single PDF document.
PDFIndex - index of PDF document to select pages
in. Index of PDF document is returned by .AddPDFFromFileName
method
Pages - comma-separated numbers of pages to extract
from PDF document. For example: "1,3-5" will select
pages #1,3,4,5 for further extraction and saving into PDF
document using .SaveToFile method |
| SaveToFile (FileName as String)
as Boolean |
Merges selected pages (see .SelectPagesToExtract method)
and saves into PDF document (FileName parameter) |
Sample Code - How To Use
(1) SelectPagesFromDocumentAndSaveToFile.vbs
- sample demonstrating how to extract selected pages from
PDF document (sample1.pdf) and then merge and save them into new
PDF document file. You can find this sample and sample PDF documents
in /examples/ sub-folder.
Dim PdfSpliter
Set PdfSpliter = CreateObject("PDFSplitMergeLib.PDFSplitMerge")
' adding PDF document and get its index in internal collection
Sample1Index = PdfSpliter.AddPDFFromFileName ( "Sample1.pdf"
)
' selecting pages 1,3,4,5 to extract
PdfSpliter.SelectPagesToExtract Sample1Index,"1,3-5"
' now save extracted pages into single PDF document
PdfSpliter.SaveToFile("SelectPagesFromDocumentAndSaveToFile.pdf")
(2) SelectPagesFromTwoDocumentAndSaveIntoSingleFile.vbs
- sample demonstrating how to extract selected pages from
two different PDF document (sample1.pdf and sample2.pdf) and then
merge extracted pages into new single PDF document file. You can
find this sample and sample PDF documents in /examples/ sub-folder.
Dim PdfSpliter
Set PdfSpliter = CreateObject("PDFSplitMergeLib.PDFSplitMerge")
' extracting pages from Sample1.pdf
Sample1Index = PdfSpliter.AddPDFFromFileName ("Sample1.pdf")
' select pages 1,3,4,5 from sample.pdf
PdfSpliter.SelectPagesToExtract Sample1Index,"1,3-5"
' extracting pages from Sample2.pdf
Sample2Index = PdfSpliter.AddPDFFromFileName ("Sample2.pdf")
' select pages 2,3,4 from sample2.pdf
PdfSpliter.SelectPagesToExtract Sample2Index,"2-4"
' saving extracted pages into sinlge PDF document
PdfSpliter.SaveToFile("SelectPagesFromTwoDocumentAndSaveIntoSingleFile.pdf")
How To Install Library on target computer
Library requires .NET framework 2 installed on computer
to operate. Download .NET 2 framework for free from this page:
http://www.microsoft.com/downloads/details.aspx?familyid=0856eacb-4362-4b0d-8edd-aab15c5e04f5&displaylang=en
- Installation
- Copy PDFSplitMergeLib.dll into \Windows\System32\
folder and mark as shared file (recommended)
- Register library using command line:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\regasm.exe
PDFSplitMergeLib.dll /tlb:PDFSplitMergeLib.tlb
- Uninstallation
- Unregister library using command line:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\regasm.exe
PDFSplitMergeLib.dll /tlb:PDFSplitMergeLib.tlb /unregister
- Remove PDFSplitMergeLib.dll from \Windows\System32\
folder