Append PDF API
The Append PDF API automates the process of appending multiple PDF files together. You can append to a new pdf file, an existing pdf file or append a list of files together. The result file is optimized for space.
To be able to evaluate the functions below a valid license key is required. Please request one from aloaha@wrocklage.de
Please try out the following code sample:
dim pdf
dim file1
dim file2
dim file3
file1="d:\new.pdf"
file2="d:\newpdf.pdf"
file3="d:\out.pdf"
set pdf = createobject("aloahapdf.edit")
'seal all formfields when merging
pdf.SealWhenAppend=true
call pdf.appendpdf(cstr(file1),cstr(file2))
call pdf.appendpdf(cstr(file1),cstr(file3))
pdf.SealWhenAppend=false
set pdf = nothing
Merge PDF in Memory
In some cases the documents to be merged exist already in memory. Saving them first to disk would loose some performance. If every millisecond is essential it is advised to use the function MergePDFFilesInMEM.
The example below demonstrates how:
dim pdf
dim InputFile
Dim AppendFile
Dim ResultFile
set pdf = createobject("aloahapdf.edit")
Inputfile = pdf.ReadBytesFromFile(cstr("c:\1.pdf"))
AppendFile = pdf.ReadBytesFromFile(cstr("c:\2.pdf"))
ResultFile = pdf.MergePDFFilesInMEM(Inputfile, AppendFile, "")
msgbox pdf.WriteBytesToFile(cstr("c:\3.pdf"), ResultFile, false)
set pdf = nothing
Append blank page
In some cases it might be required to append a blank page to your PDF document. For example to render later on some text, images or PDF on it.
dim pdf
dim newpdf
dim oldpdf
oldpdf = "c:\document.pdf"
newpdf = "c:\newdocument.pdf"
set pdf = createobject("aloahapdf.edit")
If pdf.load_pdf_to_mem(CStr(oldpdf)) = true Then
Call pdf.append_blank
Call pdf.save_pdf_to_file(CStr(newpdf))
end if
set pdf = nothing
Please ask...
Although we really tried hard, there are always questions left open. But perhaps somebody else had already put the same question?
Please check!
I test the sample code, but "pdf.MergePDFFilesInMEM" doesn't work.
It always return Empty.
You would need an evaluation key. Please request it from info@aloaha.com
Answered 23.04.2010
If not, please do not hesitate to send us your question.
We would be glad to answer it.
Home / Knowledge Base / PDF SDK / Append PDF