mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
update readme (#2110)
This commit is contained in:
committed by
Eugenio Romano
parent
96557e5f6b
commit
4a9b344f4a
@@ -35,6 +35,43 @@ necessary configuration [prerequisites](https://github.com/Alfresco/alfresco-ng2
|
|||||||
npm install ng2-alfresco-viewer
|
npm install ng2-alfresco-viewer
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Configuring PDF.js library
|
||||||
|
|
||||||
|
In order to configure your webpack-enabled application with the PDF.js library please follow the next steps.
|
||||||
|
|
||||||
|
Install pdfjs-dist
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm install pdfjs-dist
|
||||||
|
```
|
||||||
|
|
||||||
|
Update `vendors.ts` by appending the following:
|
||||||
|
|
||||||
|
```ts
|
||||||
|
// PDF.js
|
||||||
|
require('pdfjs-dist/web/compatibility.js');
|
||||||
|
const pdfjsLib = require('pdfjs-dist');
|
||||||
|
pdfjsLib.PDFJS.workerSrc = './pdf.worker.js';
|
||||||
|
require('pdfjs-dist/web/pdf_viewer.js');
|
||||||
|
```
|
||||||
|
|
||||||
|
The code above enables the "viewer" component and "compatibility" mode for all the browsers.
|
||||||
|
It also configures the web worker for PDF.js library to render PDF files in the background.
|
||||||
|
|
||||||
|
Update the `plugins` section of the `webpack.common.js` file with the next lines:
|
||||||
|
|
||||||
|
```js
|
||||||
|
new CopyWebpackPlugin([
|
||||||
|
...
|
||||||
|
{
|
||||||
|
from: 'node_modules/pdfjs-dist/build/pdf.worker.js',
|
||||||
|
to: 'pdf.worker.js'
|
||||||
|
}
|
||||||
|
])
|
||||||
|
```
|
||||||
|
|
||||||
|
The Viewer component now should be able displaying PDF files.
|
||||||
|
|
||||||
## Basic usage
|
## Basic usage
|
||||||
|
|
||||||
Using with node id:
|
Using with node id:
|
||||||
|
Reference in New Issue
Block a user