Extraire les détails du filigrane PDF en Python
Contents
[
Hide
]
Lire le texte et le rectangle englobant des artefacts de filigrane sur la première page d’un PDF en Python.
Lire le texte et les limites du filigrane
Affichez le texte et le rectangle englobant de chaque artefact de pagination du sous-type WATERMARK.
import aspose.pdf as ap
def extract_watermark_from_pdf(infile):
with ap.Document(infile) as document:
watermarks = [
artifact
for artifact in document.pages[1].artifacts
if artifact.type == ap.Artifact.ArtifactType.PAGINATION
and artifact.subtype == ap.Artifact.ArtifactSubtype.WATERMARK
]
for watermark in watermarks:
print(f"{watermark.text} {watermark.rectangle}")