Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Roman Tsukanov committed Sep 5, 2023
1 parent 64b6044 commit cb7ac4b
Show file tree
Hide file tree
Showing 3 changed files with 702 additions and 202 deletions.
12 changes: 6 additions & 6 deletions surveyjs-pdf-nodejs/README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ To generate a PDF form in a Node.js environment, follow these steps:

1. Install the [`survey-pdf`](https://www.npmjs.com/package/survey-pdf) npm package.

2. (Optional) If your survey contains [HTML](https://surveyjs.io/form-library/documentation/api-reference/add-custom-html-to-survey) and [Signature Pad](https://surveyjs.io/form-library/documentation/api-reference/signature-pad-model) questions, install the [`jsdom`](https://www.npmjs.com/package/jsdom) package to create a simulated web environment in a Node.js application. Create a JSDOM instance and reference the `window` and `document` objects from the JSDOM instance in a global scope.
2. *(Optional)* If your survey contains [HTML](https://surveyjs.io/form-library/documentation/api-reference/add-custom-html-to-survey) or [Signature](https://surveyjs.io/form-library/documentation/api-reference/signature-pad-model) questions, install the [`jsdom`](https://www.npmjs.com/package/jsdom) package to create a simulated web environment in a Node.js application. Create a JSDOM instance and reference the `window` and `document` objects from the JSDOM instance in a global scope.

3. Create a [`SurveyPDF`](https://surveyjs.io/pdf-generator/documentation/api-reference/surveypdf) instance. Its constructor accepts two parameters: a survey JSON schema and a [PDF document configuration](https://surveyjs.io/pdf-generator/documentation/api-reference/idocoptions).

Expand All @@ -32,13 +32,13 @@ To generate a PDF form in a Node.js environment, follow these steps:

## Limitations

Take note of the following considerations when exporting PDF forms in Node.js:
Please take into account the following restrictions when you generate PDF forms in Node.js:

* Complex HTML is not supported
In Node.js, [HTML](https://surveyjs.io/form-library/documentation/api-reference/add-custom-html-to-survey) questions are rendered in 'standard' [HTML render mode](https://surveyjs.io/pdf-generator/documentation/api-reference/idocoptions#htmlRenderAs) only. The `htmlRenderAs: 'image'` mode is not supported. HTML questions can render simple HTML markup. Complex HTML markup is not supported.
- **HTML support is limited**
In Node.js, [HTML](https://surveyjs.io/form-library/documentation/api-reference/add-custom-html-to-survey) questions do not support the `"image"` [render mode](https://surveyjs.io/pdf-generator/documentation/api-reference/idocoptions#htmlRenderAs) and complex markup.

* Images should be referenced as as data URIs (Base64-encoded images)
Images embedded to a survey, such as a survey [logo](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#logo) or images from the [Image](https://surveyjs.io/form-library/documentation/api-reference/add-image-to-survey) and [Image Picker](https://surveyjs.io/form-library/documentation/api-reference/add-image-to-survey) questions, should be set to Base64 encoded URIs. Direct linking (URLs) are not supported.
- **Only base64-encoded images are supported**
Images embedded in a survey, such as a [survey logo](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#logo) or images from the [Image](https://surveyjs.io/form-library/documentation/api-reference/add-image-to-survey) and [Image Picker](https://surveyjs.io/form-library/documentation/api-reference/add-image-to-survey) questions, can be specified as base64-encoded strings or as URLs. However, Node.js supports only base64-encoded strings.

## SurveyJS PDF Generator Resources

Expand Down
Loading

0 comments on commit cb7ac4b

Please sign in to comment.