find_images method
Leave feedback
On this page
Finds images according to the specified search criteria.
The search is conducted in the objects specified in Watermarker.SearchableObjects.
def find_images(self, search_criteria):
...
| Parameter | Type | Description |
|---|---|---|
| search_criteria | ImageSearchCriteria |
The search criteria to use. |
Returns: An iterable collection of the found images.
import groupdocs.watermark as gw
import groupdocs.watermark.watermarks as gww
import groupdocs.watermark.common as gwc
import groupdocs.watermark.contents.pdf as gwc_pdf
load_options = gw.PdfLoadOptions()
with gw.Watermarker("document.pdf", load_options) as watermarker:
watermark = gww.TextWatermark("Protected image", gww.Font("Arial", 8.0))
watermark.horizontal_alignment = gwc.HorizontalAlignment.CENTER
watermark.vertical_alignment = gwc.VerticalAlignment.CENTER
watermark.rotate_angle = 45
watermark.sizing_type = gww.SizingType.SCALE_TO_PARENT_DIMENSIONS
watermark.scale_factor = 1.0
pdf_content = watermarker.get_content(gwc_pdf.PdfContent)
images = pdf_content.pages[0].find_images()
for image in images:
image.add(watermark)
watermarker.save("document.pdf")
Finds all images in the content.
The search is performed on the objects specified in Watermarker.SearchableObjects.
def find_images(self):
...
Returns: Collection of the found images.
import groupdocs.watermark as gw
import groupdocs.watermark.watermarks as gww
import groupdocs.watermark.common as gwc
import groupdocs.watermark.contents.pdf as gwc_pdf
load_options = gw.PdfLoadOptions()
with gw.Watermarker("document.pdf", load_options) as watermarker:
watermark = gww.TextWatermark("Protected image", gww.Font("Arial", 8.0))
watermark.horizontal_alignment = gwc.HorizontalAlignment.CENTER
watermark.vertical_alignment = gwc.VerticalAlignment.CENTER
watermark.rotate_angle = 45
watermark.sizing_type = gww.SizingType.SCALE_TO_PARENT_DIMENSIONS
watermark.scale_factor = 1.0
pdf_content = watermarker.get_content(gwc_pdf.PdfContent)
images = pdf_content.pages[0].find_images()
for image in images:
image.add(watermark)
watermarker.save("document.pdf")
- class
ContentPart
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.