LONG AddWatermark () |
The return value is a watermark identifier in the document's watermarks collection and can be used in SwitchToWatermark and AttachWatermark.
When you use Watermark functions, you must set the watermark to the page before all other output functions.
{ 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);
// 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);
// 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);
' 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