pdf_adaptor [TAST DokuWiki ]

User Tools

Site Tools


Sidebar

First steps in TAST

What is UML

Computer setup for TAST use

FAQ

Recognized Issues

TAST tool Menu

TAST Adaptors

Adaptors examples

TAST Integrations

Interesting features

Documentation of technical administration

Modeling recommendations

Training in the TAST tool

pdf_adaptor

This is an old revision of the document!


PDF Adaptor

Introduction

PDF adaptor allow you to interact with a .pdf file, so that you can check if it has been generated properly and contains the information it is supossed to. It will be useful for you to test all those procesess where the generation of a .pdf file is implied.

Initialization Parameters

  • FilePath: complete path of the file

Predefined Functions (PF):

  • checkTextInSlide(Page, Occurrences, Search Text, ExactSearch): Looks for a given text on a specific Page of the document. Checks if it is present the number of times expressed in “Occurences” and returns “true” or “false” accordingly. “Exact Search” allows you to tell the function if you are looking for an exact match or if the number of spaces between each part of the Search String is variable.

    IMPORTANT: Please be aware of the “Occurrences” behaviour:
    1. When Occurrences is “empty”, it will check that the string exists, no matter the number of times.
    2. When Occurrences is different to “0”, it will check that the Search String exists the indicated number of times.
    3. When Occurrences is “0”, it will check that the Search String does not exist, returning “true” if so, “false” if it is found any number of times.
  • checkTextOnDocument(Page Area, Search Text): Looks for a given text on a specific area of the document (whole Page, Header, Body, Footer). This function looks for an exact match of the search text.
  • checkTextOnPageArea(Page, CoordinateX, CoordinateY, Width, Height, Text): This function return true if the parameter text exists inside the page area defined by the parameters. Page parameter indicates the page number to transform. Coordinate X parameter, indicates the position x where the area starts. Coordinate Y parameter, indicates the position y where the area starts. Width and height parameters indicates the area and the text parameter, it’s the text to check on the defined area. The measure unit is 72 dpi.
  • getNumPages(): Returns the number of pages in the document.
  • getNumWhitePages(): Returns the number of white pages in the document.
  • getPageAsImage(Page,File): This function transform a PDF Page into a jpg image file with a resolution of 72 dpi. About the input parameters, the Page parameter indicates the page number to transform, The File parameter indicates the path and the file name where the image will be generated. The file extension is .jpg.
    The purpose of this image is to allow the user to load it into any application that helps him to identify the coordinates where a piece of text appears.
    Besides that, if Get Evidences is checked, the function generates the image file in the log directory as the step evidence.
  • getTextByPageArea(Page, CoordinateX, CoordinateY, Width, Height): This function extract and return the text that its contained inside the page area defined by the parameters. Page parameter indicates the page number to transform. Coordinate X parameter, indicates the position x where the area starts. Coordinate Y parameter, indicates the position y where the area starts. Width and height parameters indicates the area. The measure unit is 72 dpi.
  • getTextCountOnPage(Page, Search Text, Page Area): Counts the number of times the Search Text is present on a specific area (Page, Header, Body, Footer) of a given page. The function looks for exact matches of the given Search Text.
  • getTextCountOnDocument(Search Text): Counts the number of times the Search Text is present on the document.
  • isPageWhite(Page): Returns “true” if the specified page is white, “false” otherwise.
pdf_adaptor.1621578372.txt.gz · Last modified: 2021/05/21 06:26 by montse