WPCubed GmbH
Wordprocessing and PDF components 

Convert PDF into watermark for other PDF files

With WPViewPDF PLUS it is possible to load PDF and convert selected or all PDF into a watermarks for other PDF files. The PDF to Watermark feature preserves the original PDF data of the watermark PDF file, this is important to keep the PDF size small and the quality at the best.

Once the destination PDF file was loaded, the source PDF file has to be loaded and a certain page can be converted into a watermark:

a := pdf.CommandStrEx( COMPDF_LoadFileAsWatermark, PDFFileName, 0);

will load a PDF file and convert the first poge into a watermark. If the PDF file was loaded already, it will not loaded again, so COMPDF_LoadFileAsWatermark can be used for the same PDF file if necessary.

Once a PDF file was loaded and the watermark ID has been retrieved, COMPDF_ApplyWatermark can be used.
The command COMPDF_ApplyWatermark requires the ID of a watermark and the range of pages the watermark should be applied to:

if a>0 then pdf.CommandStrEx( COMPDF_ApplyWatermark, '1', a);
var a,b,c : Integer;


 if OpenDialog1.Execute then


   a := pdf.CommandStrEx( COMPDF_LoadFileAsWatermark, OpenDialog1.FileName, 0);

   b := pdf.CommandStrEx( COMPDF_LoadFileAsWatermark, OpenDialog1.FileName, 1);

   c := pdf.CommandStrEx( COMPDF_LoadFileAsWatermark, OpenDialog1.FileName, 4);

   if a<=0 then

      ShowMessage('The PDF file cannot be loaded as watermark - Code=' + IntToStr(a))



      pdf.CommandStrEx( COMPDF_ApplyWatermark, '1', a);

      if b>0 then pdf.CommandStrEx( COMPDF_ApplyWatermark, '2-4', b);

      if c>0 then pdf.CommandStrEx( COMPDF_ApplyWatermark, '2-4', c);



As page range you can also specify "all", odd" and "even" as range, or for multiple pages "2-4".

With WPViewPDF Standard the PDF watermark can be printed, with WPViewPDF PLUS it is also possible to save the destination PDF file to a new PDF file with the watermarks being applied. Such a file can be printed with WPViewPDF or other PDF reader in high quality.