Skip to main content

This content has been archived and is no longer being updated.

Links may not function; however, this content may be relevant to outdated versions of the product.

Making a PDF file available for offline viewing

Suggest edit Updated on July 24, 2017

At design time, you can make a PDF file available for offline viewing by associating the PDF file (which has already been uploaded to the Pega 7 Platform instance) with a button, link, or icon in the Pega Mobile Client app. To view the PDF file at run time, the offline user taps the button, link, or icon in the app.

Upload the PDF file to a Rule-File-Binary rule

Make sure that the name of the PDF file to be uploaded is saved in lowercase.

  1. If you are not already logged in to the Pega 7 Platform, log in.
  2. From the header, click Create > Technical > Binary File.
  3. Enter the name of the PDF file (without the .pdf extension) in the Label field.
  4. Enter the app name in the App Name (Directory) field.
  5. Enter pdf in the File Type field.
    Creating a binary file
    Creating a binary file
  6. Click Create and open.
  7. Click Upload file and select the PDF file from your local directory that you want to make available in the Pega Mobile Client app, for example: vwgti.pdf
  8. Click Save.

Invoke the view() JavaScript function in the application

After you save the PDF file to a Rule-File-Binary rule, you can associate it with a button, link, or an icon in your application's user interface. When a user clicks the button, link, or icon at run time, the pega.ui.pdf.view() JavaScript function is invoked, with two parameters specifying the application name and the PDF file name, so that the PDF file opens. You must create a Run Script action for the button, link, or icon.

  1. Open the section of the user interface with the button, link, or icon and click View Properties for the control.
  2. From the Actions tab, click Create an action set.
  3. Click Add an action, and then click All actions and choose the Run script action from the list.
  4. In the Function Name field, enter the name of the JavaScript function that enables the display of a PDF file: "pega.ui.pdf.view". Make sure that you include the name within quotation marks.
  5. In the Parameters section, add the first parameter.
  6. Enter applicationName in the Name field.
  7. Enter the name of the application within quotation marks in the Value field, for example: "webwb"
  8. Add a second parameter.
  9. Enter pdfName in the Name field.
  10. Enter the name of the PDF file (without the .pdf extension) within quotation marks in the Value field, for example: "vwgti"

    Adding a local action to view a PDF file
    Adding a local action to view a PDF file
  11. Click Submit, and then click Save.

List the PDF file in the pyCustomAppCache file

To complete this process, make sure that the PDF file is listed in the mobile application's pyCustomAppCache file. For the example displayed above, add the following entry: webwb/vwgti.pdf

  1. In the search bar in the header, enter pyCustomAppCache
  2. From the results that are returned, click pyCustomAppCache to open this HTML rule.
  3. Enter webwb/vwgti.pdf in the HTML Source data field.
    Editing the pyCustomAppCache file
    Editing the pyCustomAppCache file
  4. Click Save.

Tags

Pega Platform 7.1.9 Pega Mobile Client Mobile Pega Express Media and Advertising Utilities Financial Services Government Healthcare Insurance Life Sciences Manufacturing Retail Hospitality and Entertainment
Did you find this content helpful? YesNo

Have a question? Get answers now.

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

Ready to crush complexity?

Experience the benefits of Pega Community when you log in.

We'd prefer it if you saw us at our best.

Pega.com is not optimized for Internet Explorer. For the optimal experience, please use:

Close Deprecation Notice
Contact us