# How to Generate and Preview PDF from a word template without downloading it

**URL:** <https://forums.pega.com/t/how-to-generate-and-preview-pdf-from-a-word-template-without-downloading-it/4150>\
**Category:** User Experience\
**Tags:** dev-designer-studio, 8-7-4, user-experience, system-architect, case-management\
**Created:** [March 15, 2023, 9:27am UTC](https://forums.pega.com/t/how-to-generate-and-preview-pdf-from-a-word-template-without-downloading-it/4150 "2023-03-15T09:27:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Intandhp](https://avatars.discourse-cdn.com/v4/letter/i/9f8e36/32.png) [@Intandhp](https://forums.pega.com/u/Intandhp)\
**Post date:** [March 15, 2023, 9:27am UTC](https://forums.pega.com/t/how-to-generate-and-preview-pdf-from-a-word-template-without-downloading-it/4150/1 "2023-03-15T09:27:54Z")

</div>

Hi,

I need to generate a pdf and preview it directly when I click a button

I have an action set on-click that calls an activity that will generate pdf based on the word template and the mail merge that I provided. Then, I run script “pega.ui.HarnessActions.doAttachmentSingleClick”

But, it is downloading the pdf instead of previewing it. I don’t want to download the pdf, I want to preview pdf in Pega

Does anyone know how to preview the pdf?

Thank you

---

<div class="post-metadata">

**Author:** ![ArulDevan](https://yyz2.discourse-cdn.com/pega/user_avatar/forums.pega.com/aruldevan/32/16328_2.png) [@ArulDevan](https://forums.pega.com/u/ArulDevan)\
**Post date:** [March 15, 2023, 10:04am UTC](https://forums.pega.com/t/how-to-generate-and-preview-pdf-from-a-word-template-without-downloading-it/4150/2 "2023-03-15T10:04:15Z")

</div>

Hi @Intandhp: If you are using Theme-Cosmos, files and documents utility pane by default has the feasibility to preview pdf files. Even it is working with a application built on UI-Kit in version 8.7.4.

May I know if your application is migrated from a older version? If this is the case you may need to refactor the codes to use latest feature (please check the impacts for older attachments too ).

Please also have a look into [this](https://support.pega.com/question/how-display-pdf-sectioninvoice) which speaks about a custom implementation.

Thanks.

---

<div class="post-metadata">

**Author:** ![MarijeSchillern](https://yyz2.discourse-cdn.com/pega/user_avatar/forums.pega.com/marijeschillern/32/21738_2.png) [@MarijeSchillern](https://forums.pega.com/u/MarijeSchillern)\
**Post date:** [March 15, 2023, 10:59am UTC](https://forums.pega.com/t/how-to-generate-and-preview-pdf-from-a-word-template-without-downloading-it/4150/3 "2023-03-15T10:59:35Z")

</div>

@Intandhp did you already try the suggestions in past forum questions?

> **[Inline PDF Document Preview (Pega 8.1) | Support Center](https://support.pega.com/question/inline-pdf-document-preview-pega-81)**
>
> Hi, We are using Pega 8.1 I need to enable inline document preview on an attachment section that we built. However, when clicking on the attached documents, the only option available is to download it. Inline document preview is not available. I...

> **[Preview PDF Document on PEGA 8.3 | Support Center](https://support.pega.com/question/preview-pdf-document-pega-83)**
>
> Hi, I have a requirement to preview pdf document stored on BLOB from external database. Can someone give me a help with my problem.  Thanks.   \*\*\*Edited by Moderator Marissa to update General to Product\*\*\*  

> **[PDF file can not be displayed in preview mode when using Cosmos | Support Center](https://support.pega.com/question/pdf-file-can-not-be-displayed-preview-mode-when-using-cosmos)**
>
> From Pega 8.4.1, while a PDF file can be displayed in preview mode using UIkit, the same PDF file of the same work object is always downloaded rather than being displayed in preview mode when the PDF link is clicked from the case attachment panel....

> **[Troubleshooting document attachment issues with PDF inline preview | Support...](https://support.pega.com/support-doc/troubleshooting-document-attachment-issues-pdf-inline-preview)**
>
> Learn how to avoid or resolve issues related to the limitations of PDF inline previews used in the Attachment gadget, the Document gadget, and the Pulse gadget.
