Hierarchy

  • Watermarks

Methods

applyToFile

  • Add a watermark to a file.

    The method doesn’t change the source file whose ID is passed in the fileId parameter. It creates a temporary file with a watermark. Adding watermarks is available for files of the following formats: .xls, .xlsx, . doc, .docx, and .pdf. Read more about using watermarks in the Print form article.

    Parameters

    • fileId: string

      ID of the file that a watermark will be added to.

    • watermarks: Watermark[]

      An array of watermarks added to the file. Example:

      //  Create a list of watermarks 
      const watermarks: Watermark[] = [{ 
       template:  '<div style='border:2px solid coral; max-width: 62px;'>In Progress</div>', 
        position: WatermarkPosition.Center, 
       pages: WatermarkPages.All, 
       scale:  0.5, 
       opacity: 0.75 
       }]; 
      // Get the ID of the file that the watermark  will be added to 
      const fileId = Context.data.file.id; 
      // Add the watermark  
      const tmpFile = await System.watermark.applyToFile(fileId, watermarks); 
      

    Returns Promise<FileItemRef>

    The instance of FileItemRef referencing a temporary file with a watermark.