LinkedIn
Copied!

Implementing the Advanced PDF Search component in your application

You can add PDF search capability to Pega Customer Service™ and Pega Sales Automation™ applications by implementing the Advanced PDF Search component. The PDF search functionality is an independent component that you can implement in your application to enable searching for any text, special characters, or numbers within a PDF file. For example, in a Customer Service application, during a billing inquiry call a customer service representative can search a customer's previous bills for a word or a date that is related to the customer's inquiry. From the search results, the customer service representative can select and display a bill, and use the navigation controls to advance through multiple search results in a bill.

Before implementing the search component, ensure that:

  • Source documents are accessible
  • PDF files are not password-protected
The Advanced PDF Search component will not find text or numbers that break or wrap across multiple lines in a document, or text in documents that contain graphics.

You can use the default layout (see Example) or customize the layout to create the look that you want. The search result PDF includes the following features: 

  • Auto-scrolling to the first occurrence of the search text
  • Highlighted search text
  • Navigation controls to move to the next and previous occurrences of the search text

Using the default layout

To implement the default search component layout, directly embed the AdvancedPdfSearch rule in the section where you want the search text box to appear.

  1. In the left navigation pane, click Records > User interface > section.
  2. Open the section in which you want to embed the AdvancedPDFSearch section.
  3. Create a new Dynamic Layout section.
  4. Click Structural > Embedded section.
  5. Drag the embedded section onto the new Dynamic Layout section.
  6. In the Section Include dialog box, enter AdvancedPDFSearch in the Section field as shown in the following example: 
     
  7. Click Submit. The section is embedded in the dynamic layout, as shown in the following example:
     
  8. Save, and then check in your changes.

Customizing the layout

You can customize the search component layout to change the location of the PDF navigation controls or the Search text box. To customize the layout, create a new Dynamic Layout section and then embed the following rules in the appropriate sections to create the look that you want.

  1. In the left navigation pane, click Records > User interface > section.
  2. Open the section in which you want to include the AdvancedPDFSearch control.
  3. Click Structural > Dynamic layout.
  4. In the dynamic layout, embed the following rules as required to create the look that you want:
Rule name Purpose
SearchPDF Includes script files for searching text across multiple documents.
DocumentSearchOccurrences Contains the search component that takes search text as input and displays the search results.
PDFControls Contains the additional document controls such as navigation buttons.
PDFViewer Displays the PDF document that the user selects from the search results.

Populating the D_PDFDocument datapage

Populate the D_PDFDocument datapage with the document details from the system or database that contains the data that you want to search. To do this, you must override the data source of the D_PDFDocument datapage. You can fetch the document details by using a REST call or by fetching the records from the database.  

Perform the following steps to override the data source for the D_PDFDocument datapage: 

  1. In the left navigation pane, select Data model > data transform.
  2. Open the SourcePDF data transform. This data transform is called from the activity that shows the properties that you need to set. 
  3. In the Activity name field, enter SourcePDF.
     
  4. Open the SourcePDF activity.
  5. Set the following properties by using the document details, as shown in the following example:
     
  6. Save your changes.

Configuring the search results display

By default, when you perform a search, the search component displays the first three search results in the drop-down list. Any additional search results are displayed, a maximum of nine items at a time, when you click Show More, as shown in the following example:

You can change the number of documents displayed in the initial search results and the number of documents displayed when you click the Show More link by configuring the following dynamic system settings:

  • MinimumRecords – Use this setting to set the number of documents displayed in the initial search results.
  • AdditionalRecords  – Use this setting to set the number of additional documents displayed by clicking the Show more link.

Example: Advanced PDF search component default layout 

The following example shows the result of a PDF search displayed in the user interface. The PDF document uses the default component layout.

    Have a question? Get answers now.

    Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.