Overview¶
Squish does not offer direct support for working with PDF files themselves. However, several options are available, for example for checking how a PDF is being shown on the screen or for extracting the text contents of it.
Comparing PDF documents¶
The following workflows may be possible.
Option #1 - Automate internal PDF viewer and use Screenshot Verification Point¶
Let test script open the PDF file in a viewer inside of your application.
Use a screenshot verification point on the internal PDF viewer tool to verify the contents.
Option #2 (Windows only) - Automate external PDF viewer and use Screenshot Verification Point¶
Let test script open the PDF file in an external PDF viewer tool (Adobe Reader).
Let Squish hook into the external PDF viewer tool (see Hooking arbitrary Windows applications ).
Use a screenshot verification point to verify the contents.
Option #3 - Use external tool for PDF comparison¶
- Use an external (third party) tool that allows to perform PDF comparison (or other tasks) and call it from the test script (see Executing external applications ).
Extracting text from PDF documents¶
The following workflows may be possible.
Option #1 - Automate internal PDF viewer to copy and paste the PDF contents to clipboard¶
Let test script open the PDF file in a viewer inside of your application.
"Select all" in the internal PDF viewer, copy to clipboard and extract from clipboard.
Compare extracted contents.
Option #2 (Windows only) - Automate external PDF viewer to copy and paste the PDF contents to clipboard¶
Let test script open the PDF file in an external PDF viewer tool (Adobe Reader).
Let Squish hook into the external PDF viewer tool (see Hooking arbitrary Windows applications ).
"Select all" in the internal PDF viewer, copy to clipboard and extract from clipboard.
Compare extracted contents.
Option #3 - Use external tool for converting PDF to text or for text extraction¶
- Use an external (third party) tool that converts the PDF file to text or extracts the desired parts (or other tasks) and call it from the test script (see Executing external applications ).