importgroupdocs.watermarkasgwimportgroupdocs.watermark.contents.pdfasgwc_pdfimportgroupdocs.watermark.watermarksasgwwfromgroupdocs.watermark.commonimportFileTypewatermark=gww.TextWatermark("This is WaterMark on Attachment",gww.Font("Arial",19.0))load_options=gw.PdfLoadOptions()withgw.Watermarker("document.pdf",load_options)aswatermarker:pdf_content=watermarker.get_content(gwc_pdf.PdfContent)forattachmentinpdf_content.attachments:info=attachment.get_document_info()ifinfo.file_type!=FileType.UNKNOWNandnotinfo.is_encrypted:withattachment.create_watermarker()asattached:attached.add(watermark)attached.save()watermarker.save("document.pdf")