Append
IPDFDocument4 :: General document management :: Common

See Also Example
Collapse All

This method appends the contents of a previously saved PDF file (not a BLOB) to a newly created (or opened) PDF document.

Syntax

HRESULT Append (
BSTR fileName,
BSTR password
)
Parameters
fileName
Path to the PDF document to be opened

password
String containing the password for the PDF document (if needed)

Return value
If successful, this method returns S_OK. If it fails, this method should return one of the error values.

Remarks

The newly opened document appends to the existing one (in memory) like this:

  • All pages are appended to the end of the document.
  • All outlines are appended as the sibling node of the last high-level node of an existing outline tree.
  • If both documents contain forms, then they are merged. If both forms have controls with the same name, then the name of the control appended changes to "ControlN" (where N is a control's number: Control1, Control2, ...).
  • If both documents have an open document action, then the appended one is ignored.

When the document is appended, it loses all its metadata properties (Author, Producer, Creator, Title, Subject and Keywords).

Example

Appending a Document

Delphi
[copy to clipboard]
{ PDF object is supposed to be created }
font := PDF.AddFont('Arial', false, false, false, false, fcDefault);
PDF.UseFont(font, 10);
PDF.ShowTextAt(10, 10, 'This is a page in a newly created document.');
PDF.ShowTextAt(10, 20, 'Now we append another document.');
PDF.Append('one.pdf', '');
PDF.SaveToFile('test.pdf', true);
C/C++
[copy to clipboard]
// PDF object is supposed to be created
long font = PDF->AddFont("Arial", false, false, false, false, fcDefault);
PDF->UseFont(font, 10);
PDF->ShowTextAt(10, 10, "This is a page in a newly created document.");
PDF->ShowTextAt(10, 20, "Now we append another document.");
PDF->Append("one.pdf", "");
PDF->SaveToFile("test.pdf", true);
C#
[copy to clipboard]
// PDF object is supposed to be created
long font = PDF.AddFont("Arial", false, false, false, false, FontCharset.fcDefault);
PDF.UseFont(font, 10);
PDF.ShowTextAt(10, 10, "This is a page in a newly created document.");
PDF.ShowTextAt(10, 20, "Now we append another document.");
PDF.Append("one.pdf", "");
PDF.SaveToFile("test.pdf", true);
Visual Basic
[copy to clipboard]
' PDF object is supposed to be created
font = PDF.AddFont("Arial", False, False, False, False, 1) 'fcDefault
PDF.UseFont font, 10
PDF.ShowTextAt 10, 10, "This is a page in a newly created document."
PDF.ShowTextAt 10, 20, "Now we append another document."
PDF.Append "one.pdf", ""
PDF.SaveToFile "test.pdf", true
Set PDF = nothing

See Also

Reference