Skip to content

GRV96/PyPDF2_Fields

Repository files navigation

PyPDF2_Fields

Français

La bibliothèque PyPDF2_Fields est un complément à PyPDF2. Elle aide à l’utilisation des champs d’un fichier PDF en facilitant les tâches suivantes.

  • Lire la valeur des champs
  • Modifier la valeur des champs
  • Identifier le type d’un champ
  • Assurer la visibilité du contenu des champs
  • Déterminer si les champs d’un fichier PDF généré par une application seront modifiables

À cette fin, PyPDF2_Fields fournit les fonctions ci-dessous.

  • get_field_type

Identifie le type d’un champ d’un fichier PDF. La valeur renvoyée est un membre de l’énumeration PdfFieldType, aussi incluse dans cette bibliothèque.

  • make_writer_from_reader

Crée un objet PdfFileWriter dont le contenu est identique à celui de l’objet PdfFileReader donné. Selon le choix de l’appelant, les champs du fichier produit par cet écriveur seront modifiables ou non.

  • pair_fields_name_and_val

Constitue un dictionnaire associant le nom des champs à leur valeur.

  • set_need_appearances

Assure qu’un PdfFileWriter produira un fichier dont le contenu des champs sera visible.

  • update_page_fields

Définit la valeur des champs de texte, des boîtes à cocher et des groupes de boutons radio. Cette fonction utilise des instances de la classe RadioBtnGroup, aussi incluse dans cette bibliothèque.

Voyez les exemples d'utilisation demo_field_names_vals.py et demo_update_fields.py dans le dépôt de code source.

English

Library PyPDF2_Fields is a complement to PyPDF2. It helps using a PDF file’s fields by facilitating the following tasks.

  • Reading the fields' value
  • Setting the fields' value
  • Identifying a field’s type
  • Ensuring the visibility of the fields’ content
  • Determining whether the fields of a PDF file generated by an application will be editable

For this purpose, PyPDF2 provides the functions below.

  • get_field_type

Identifies the type of a PDF file's field. The returned value is a member of enumeration PdfFieldType, which is also included in this library.

  • make_writer_from_reader

Creates a PdfFileWriter object whose content is identical to that of the given PdfFileReader object. Depending on the caller’s choice, the fields of the file produced by that writer will be editable or not.

  • pair_fields_name_and_val

Creates a dictionary that maps the fields’ name to their value.

  • set_need_appearances

Ensures that a PdfFileWriter will produce a file with fields whose content will be visible.

  • update_page_fields

Sets the value of text fields, checkboxes and radio button groups. This function uses instances of class RadioBtnGroup, which is also included in this library.

See usage examples demo_field_names_vals.py and demo_update_fields.py in the source code repository.

About

Library PyPDF2_Fields is a complement to PyPDF2. It helps reading and setting a PDF file’s fields, knowing their type and controlling their editability.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages