# Form Designer: How to generate a PDF version of the form archive

**URL:** <https://discuss.workflowgen.com/t/form-designer-how-to-generate-a-pdf-version-of-the-form-archive/268>\
**Category:** Form Designer\
**Created:** [May 17, 2014, 4:50am UTC](https://discuss.workflowgen.com/t/form-designer-how-to-generate-a-pdf-version-of-the-form-archive/268 "2014-05-17T04:50:18Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![wfg-admin](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.workflowgen.com/wfg-admin/32/714_2.png) [@wfg-admin](https://discuss.workflowgen.com/u/wfg-admin)\
**Post date:** [May 17, 2014, 4:50am UTC](https://discuss.workflowgen.com/t/form-designer-how-to-generate-a-pdf-version-of-the-form-archive/268/1 "2014-05-17T04:50:18Z")

</div>

This article provides a solution to generate the form archive as a PDF. The HTML version of the form archive is converted to PDF using an external library (WkHtmlToPdf).

**Note:** This solution has not been tested with a high number of transactions.

1. Install WkHtmlToPdf ([http://wkhtmltopdf.org/](http://wkhtmltopdf.org/)). Advantages:

2. Create a `FORM_PRINT` process data (FILE data type). This process data will contain the PDF version of the form archive.

3. Add a form section with two text fields with the IDs `FORM_DRAFT` and `FORM_PRINT`. You must hide this section for all workflow actions (edit the section Settings / Section Behavior / Hidden checkbox).

4. Map the `FORM_PRINT` textbox to the `FORM_PRINT` process data. For each action of your workflow you have to map `FORM_PRINT` textbox to the `FORM_PRINT` process data. You can use the action parameters.

5. In the .NET editor, add the following code:

### Alternative libraries

It’s also possible to use a commercial component such as EVO or HiQPdf.

**Example with EVO**

```auto
EvoPdf.PdfConverter pdfConverter = new EvoPdf.PdfConverter();
pdfConverter.PdfDocumentOptions.PdfPageSize = EvoPdf.PdfPageSize.A4;
pdfConverter.PdfDocumentOptions.PdfCompressionLevel = EvoPdf.PdfCompressionLevel.Normal;
pdfConverter.JavaScriptEnabled = false;
pdfConverter.SavePdfFromHtmlStringToFile(this.FormArchive, this.StoragePath + "\\form_print.pdf");

```

**Example with HiQPdf**

```auto
HiQPdf.HtmlToPdf htmlToPdfConverter = new HiQPdf.HtmlToPdf();
htmlToPdfConverter.Document.PageSize = HiQPdf.PdfPageSize.A4;
htmlToPdfConverter.Document.PageOrientation = HiQPdf.PdfPageOrientation.Portrait;
htmlToPdfConverter.Document.Margins = new HiQPdf.PdfMargins(5);
htmlToPdfConverter.ConvertHtmlToFile(this.FormArchive, this.StoragePath + "\\form_print.pdf")

```

---

<div class="post-metadata">

**Author:** ![hcampeau](https://avatars.discourse-cdn.com/v4/letter/h/bc8723/32.png) [@hcampeau](https://discuss.workflowgen.com/u/hcampeau)\
**Post date:** [April 4, 2018, 6:57pm UTC](https://discuss.workflowgen.com/t/form-designer-how-to-generate-a-pdf-version-of-the-form-archive/268/2 "2018-04-04T18:57:26Z")

</div>

In trying this, the pdf being generated is blank. Any tips or suggestions? We are using PDFSharp (1.32.3057).  
Is FORM\_PRINT to be mapped as both the IN and OUT parameters? How is the hidden FORM\_DRAFT field used?

---

<div class="post-metadata">

**Author:** ![eddy.daouk](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.workflowgen.com/eddy.daouk/32/672_2.png) [@eddy.daouk](https://discuss.workflowgen.com/u/eddy.daouk)\
**Post date:** [April 4, 2018, 7:57pm UTC](https://discuss.workflowgen.com/t/form-designer-how-to-generate-a-pdf-version-of-the-form-archive/268/3 "2018-04-04T19:57:08Z")

</div>

Hi,

This article is regarding WkHtmlToPdf. Each solution should have a different approach to implementing them with WorkflowGen.

If you want assistance regarding the implementation of PDFSharp, kindly open an assistance ticket in our Helpdesk website and we would be happy to help.

Regards,  
Eddy.

---

<div class="post-metadata">

**Author:** ![ParadimeWeb](https://avatars.discourse-cdn.com/v4/letter/p/8e8cbc/32.png) [@ParadimeWeb](https://discuss.workflowgen.com/u/ParadimeWeb)\
**Post date:** [April 6, 2018, 12:24am UTC](https://discuss.workflowgen.com/t/form-designer-how-to-generate-a-pdf-version-of-the-form-archive/268/4 "2018-04-06T00:24:38Z")

</div>

Interesting… I did something similar to that. What would be ideal is if we can use the default FORM\_ARCHIVE to store the pdf file. That way, by default, this pdf file will be attached to notification emails!

Anyway of modifying your solution to allow that?

Thanks

---

<div class="post-metadata">

**Author:** ![eddy.daouk](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.workflowgen.com/eddy.daouk/32/672_2.png) [@eddy.daouk](https://discuss.workflowgen.com/u/eddy.daouk)\
**Post date:** [April 6, 2018, 6:11pm UTC](https://discuss.workflowgen.com/t/form-designer-how-to-generate-a-pdf-version-of-the-form-archive/268/5 "2018-04-06T18:11:56Z")

</div>

This is already possible by using WkHtmlToPdf. All you need to do is enable “Show the data in the follow-up forms” to the data that stores the PDF file (In Data page -\> Edit Data -\> Visibility), and a link to that file should be generated in the follow-up form as well as the email that contains a list of all the data with “Show the data in the follow-up forms” enabled.

Regards,  
Eddy.

---

<div class="post-metadata">

**Author:** ![ParadimeWeb](https://avatars.discourse-cdn.com/v4/letter/p/8e8cbc/32.png) [@ParadimeWeb](https://discuss.workflowgen.com/u/ParadimeWeb)\
**Post date:** [April 16, 2018, 7:02pm UTC](https://discuss.workflowgen.com/t/form-designer-how-to-generate-a-pdf-version-of-the-form-archive/268/6 "2018-04-16T19:02:38Z")

</div>

I would still think it would be smarter to have the default FORM\_ARCHIVE because of the previews. When you preview a form on the dashboard, it shows you the form archive.

---

<div class="post-metadata">

**Author:** ![athomas](https://avatars.discourse-cdn.com/v4/letter/a/c77e96/32.png) [@athomas](https://discuss.workflowgen.com/u/athomas)\
**Post date:** [November 13, 2018, 6:46pm UTC](https://discuss.workflowgen.com/t/form-designer-how-to-generate-a-pdf-version-of-the-form-archive/268/8 "2018-11-13T18:46:46Z")

</div>

Does this have to be installed on the computer of every user that needs to print the forms?

---

<div class="post-metadata">

**Author:** ![eddy.daouk](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.workflowgen.com/eddy.daouk/32/672_2.png) [@eddy.daouk](https://discuss.workflowgen.com/u/eddy.daouk)\
**Post date:** [November 20, 2018, 11:09pm UTC](https://discuss.workflowgen.com/t/form-designer-how-to-generate-a-pdf-version-of-the-form-archive/268/9 "2018-11-20T23:09:33Z")

</div>

Hi @athomas,

No, this only needs to be installed on the server where the WorkfowGen application is installed.

Regards,  
Eddy.

---

<div class="post-metadata">

**Author:** ![isen0011](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.workflowgen.com/isen0011/32/413_2.png) [@isen0011](https://discuss.workflowgen.com/u/isen0011)\
**Post date:** [July 15, 2020, 9:30pm UTC](https://discuss.workflowgen.com/t/form-designer-how-to-generate-a-pdf-version-of-the-form-archive/268/10 "2020-07-15T21:30:30Z")

</div>

Bumping an old topic here, but I’m trying something tangentially related to this and I’m wondering if this logic still works. I’m trying to save the FormArchive at a specific step in the workflow using .cs, and it seems like `this.FormArchive` is blank whenever I try to get at it. I did find `this.GetFormArchive()`, but it seems like that is trying to insert the archive into the existing form instead of just save it.

Is there an easy way to just export the FormArchive? Thanks!

---

<div class="post-metadata">

**Author:** ![eddy.daouk](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.workflowgen.com/eddy.daouk/32/672_2.png) [@eddy.daouk](https://discuss.workflowgen.com/u/eddy.daouk)\
**Post date:** [July 17, 2020, 2:37am UTC](https://discuss.workflowgen.com/t/form-designer-how-to-generate-a-pdf-version-of-the-form-archive/268/11 "2020-07-17T02:37:04Z")

</div>

Hi @isen0011,

`this.FormArchive` should be called at the overrided **Render** method:

```auto
 protected override void Render(HtmlTextWriter writer)
  {
     base.Render(writer)
     //Code here
  }

```

It is at this stage of the page’s life cycle where the FormArchive file gets generated.  
So if you’re trying to get it at the `PageLoad` method, it will be empty.

Regards,  
Eddy.

---

<div class="post-metadata">

**Author:** ![dhulls](https://avatars.discourse-cdn.com/v4/letter/d/54ee81/32.png) [@dhulls](https://discuss.workflowgen.com/u/dhulls)\
**Post date:** [September 9, 2020, 8:24pm UTC](https://discuss.workflowgen.com/t/form-designer-how-to-generate-a-pdf-version-of-the-form-archive/268/12 "2020-09-09T20:24:18Z")

</div>

We have implemented the code listed above and successfully are able to output a PDF document using wkhtmltopdf. This seems to be working well for unless there is text within the form that is using expanding text boxes. The form output in PDF form shows the first line and not the additional lines of text. How can we use our expanding text boxes with the wkhtmltopdf?
