importgroupdocs.watermarkasgwfromgroupdocs.watermark.options.pdfimportPdfLoadOptionsimportgroupdocs.watermark.contents.pdfasgwc_pdfimportgroupdocs.watermark.watermarksasgwwfromgroupdocs.watermark.commonimportFileTypewatermark=gww.TextWatermark("This is WaterMark on Attachment",gww.Font("Arial",19.0))load_options=PdfLoadOptions()withgw.Watermarker("document.pdf",load_options)aswatermarker:pdf_content=watermarker.get_content()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("output.pdf")