Components for Developers
© 2000-2012, Two Pilots

PDF Library Download Features Manual Tutorials FAQ Pricing HTML2PDF-X Pilot History In the Lab

PDF Creator Pilot documentation

Download CHM version of this manual.
IPDFDocument4
Collapse All

Methods and properties for modifying the content of a PDF document:

Common Common page operation methods and properties: 
Graphics Page operation graphics methods:
Text Page operation text methods and properties:

Example

How to Insert an Image as a Watermark

Delphi
[copy to clipboard]
{ PDF object is supposed to be created }
img := PDF.AddImageFromFile('watermark.jpg');

{ composing a watermark }
wtm := PDF.AddWatermark();
PDF.SwitchToWatermark(wtm);
PDF.ShowImage(img, 300, 500);
PDF.SetColorFill(0, 1, 0, 0);
PDF.ShowTextAt(330, 530, 'Watermark text');
PDF.SwitchToCurrentPage;

//composing 1st page
PDF.ShowTextAt(50, 50, 'Page1 with watermark.');
PDF.AttachWatermark(0, wtm);

//composing 2nd page
PDF.NewPage;
PDF.ShowTextAt(50, 50, 'Page2 with watermark.');
PDF.AttachWatermark(1, wtm);

//composing 3rd page
PDF.NewPage;
PDF.ShowTextAt(50, 50, 'Page3 with watermark.');
PDF.AttachWatermark(2, wtm);

PDF.SaveToFile('test.pdf', true);
C/C++
[copy to clipboard]
// PDF object is supposed to be created
long img = PDF->AddImageFromFile("watermark.jpg");

// composing a watermark
long wtm = PDF->AddWatermark();
PDF->SwitchToWatermark(wtm);
PDF->ShowImage(img, 300, 500);
PDF->SetColorFill(0f, 1f, 0f, 0f);
PDF->ShowTextAt(330, 530, "Watermark text");
PDF->SwitchToCurrentPage();

//composing 1st page
PDF->ShowTextAt(50, 50, "Page1 with watermark.");
PDF->AttachWatermark(0, wtm);

//composing 2nd page
PDF->NewPage();
PDF->ShowTextAt(50, 50, "Page2 with watermark.");
PDF->AttachWatermark(1, wtm);

//composing 3rd page
PDF->NewPage();
PDF->ShowTextAt(50, 50, "Page3 with watermark.");
PDF->AttachWatermark(2, wtm);

PDF->SaveToFile("test.pdf", true);
C#
[copy to clipboard]
// PDF object is supposed to be created
long img = PDF.AddImageFromFile("watermark.jpg");

// composing a watermark
long wtm = PDF.AddWatermark();
PDF.SwitchToWatermark(wtm);
PDF.ShowImage(img, 300, 500);
PDF.SetColorFill(0f, 1f, 0f, 0f);
PDF.ShowTextAt(330, 530, "Watermark text");
PDF.SwitchToCurrentPage();

//composing 1st page
PDF.ShowTextAt(50, 50, "Page1 with watermark.");
PDF.AttachWatermark(0, wtm);

//composing 2nd page
PDF.NewPage();
PDF.ShowTextAt(50, 50, "Page2 with watermark.");
PDF.AttachWatermark(1, wtm);

//composing 3rd page
PDF.NewPage();
PDF.ShowTextAt(50, 50, "Page3 with watermark.");
PDF.AttachWatermark(2, wtm);

PDF.SaveToFile("test.pdf", true);
Visual Basic
[copy to clipboard]
' PDF object is supposed to be created
img = PDF.AddImageFromFile("watermark.jpg")

' composing a watermark
wtm = PDF.AddWatermark
PDF.SwitchToWatermark wtm
PDF.ShowImage img, 300, 500
PDF.SetColorFill 0, 1, 0, 0
PDF.ShowTextAt 330, 530, "Watermark text"
PDF.SwitchToCurrentPage

'composing 1st page
PDF.ShowTextAt 50, 50, "Page1 with watermark."
PDF.AttachWatermark 0, wtm

'composing 2nd page
PDF.NewPage
PDF.AttachWatermark 1, wtm
PDF.ShowTextAt 50, 50, "Page2 with watermark."

'composing 3rd page
PDF.NewPage
PDF.AttachWatermark 2, wtm
PDF.ShowTextAt 50, 50, "Page3 with watermark."

PDF.SaveToFile "test.pdf", true

See Also

PDF Library Download Features Manual Tutorials FAQ Pricing HTML2PDF-X Pilot History In the Lab

 

 

PDF Library | Virtual Printer | Converters to PDF

Support | Blog | Forum | Contacts

© 2000-2012, Two Pilots