@jsreport/jsreport-pdf-utils
Advanced tools
Comparing version 4.0.1 to 4.0.2
@@ -31,3 +31,4 @@ const path = require('path') | ||
reporter.documentStore.registerComplexType('PdfAccessibility', { | ||
enabled: { type: 'Edm.Boolean' } | ||
enabled: { type: 'Edm.Boolean' }, | ||
pdfUA: { type: 'Edm.Boolean' } | ||
}) | ||
@@ -34,0 +35,0 @@ |
@@ -200,2 +200,6 @@ const parsePdf = require('./utils/parsePdf') | ||
if (pdfAccessibility?.pdfUA === true) { | ||
doc.pdfUA() | ||
} | ||
try { | ||
@@ -202,0 +206,0 @@ currentBuffer = await doc.asBuffer() |
@@ -24,2 +24,3 @@ const path = require('path') | ||
reporter.addRequestContextMetaConfig('pdfUtilsOutlines', { sandboxHidden: true }) | ||
reporter.addRequestContextMetaConfig('pdfUtilsAccessibility', { sandboxHidden: true }) | ||
@@ -98,2 +99,17 @@ reporter.extendProxy(proxyExtend) | ||
reporter.beforeRenderListeners.add('pdf-utils', (req, res) => { | ||
// we use just root template setting for pdfAccessibility | ||
// this is because otherwise you need to set the accessibility on every merged/template | ||
// the use case when you would want root template to have for example pdf/ua enabled but not some child renders doesn't exist I tihnk | ||
if (!req.context.pdfUtilsAccessibility && !req.template.pdfAccessibility) { | ||
return | ||
} | ||
if (req.context.pdfUtilsAccessibility) { | ||
req.template.pdfAccessibility = req.context.pdfUtilsAccessibility | ||
} else { | ||
req.context.pdfUtilsAccessibility = req.template.pdfAccessibility | ||
} | ||
}) | ||
// we insert to the front so we can run before reports or scripts | ||
@@ -104,2 +120,4 @@ reporter.afterRenderListeners.insert(0, 'pdf-utils', async (req, res) => { | ||
req.template.pdfMeta == null && | ||
req.template.pdfAccessibility?.enabled !== true && | ||
req.template.pdfAccessibility?.pdfUA !== true && | ||
req.template.pdfA?.enabled !== true && | ||
@@ -187,6 +205,2 @@ req.template.pdfSign == null && | ||
if (req.template.pdfAccessibility?.enabled) { | ||
req.context.pdfAccessibility = { enabled: true } | ||
} | ||
try { | ||
@@ -200,3 +214,3 @@ res.content = await (require('./pdfProcessing.js')( | ||
pdfA: req.template.pdfA, | ||
pdfAccessibility: req.template.pdfAccessibility || req.context.pdfAccessibility, | ||
pdfAccessibility: req.context.pdfUtilsAccessibility, | ||
pdfPassword, | ||
@@ -203,0 +217,0 @@ pdfSign, |
{ | ||
"name": "@jsreport/jsreport-pdf-utils", | ||
"version": "4.0.1", | ||
"version": "4.0.2", | ||
"description": "jsreport extension providing pdf operations like merge or concatenation", | ||
@@ -36,3 +36,3 @@ "keywords": [ | ||
"@jsreport/node-signpdf": "1.4.2", | ||
"@jsreport/pdfjs": "1.4.1", | ||
"@jsreport/pdfjs": "1.4.2", | ||
"cheerio": "1.0.0-rc.12", | ||
@@ -46,7 +46,7 @@ "lodash.omit": "4.5.0", | ||
"devDependencies": { | ||
"@jsreport/jsreport-assets": "4.0.1", | ||
"@jsreport/jsreport-assets": "4.0.2", | ||
"@jsreport/jsreport-child-templates": "4.0.0", | ||
"@jsreport/jsreport-chrome-pdf": "4.0.0", | ||
"@jsreport/jsreport-core": "4.0.1", | ||
"@jsreport/jsreport-handlebars": "4.0.0", | ||
"@jsreport/jsreport-core": "4.1.0", | ||
"@jsreport/jsreport-handlebars": "4.0.1", | ||
"@jsreport/jsreport-jsrender": "4.0.0", | ||
@@ -56,4 +56,4 @@ "@jsreport/jsreport-scripts": "4.0.0", | ||
"handlebars": "4.7.7", | ||
"mocha": "8.2.1", | ||
"puppeteer": "21.1.0", | ||
"mocha": "10.1.0", | ||
"puppeteer": "21.3.7", | ||
"rimraf": "2.6.3", | ||
@@ -60,0 +60,0 @@ "should": "13.2.3", |
@@ -10,2 +10,6 @@ # @jsreport/jsreport-pdf-utils | ||
### 4.0.2 | ||
- initial support of the pdf/ua | ||
### 4.0.1 | ||
@@ -12,0 +16,0 @@ |
@@ -673,5 +673,5 @@ import React, { Component, useState } from 'react' | ||
<div className={`${styles.tabPanel} ${activeTab === 'pdfAccessibility' ? styles.active : ''}`}> | ||
<p style={{ marginTop: '1rem' }}> | ||
Copy pdf accessibility tags during operations (beta) | ||
</p> | ||
<h2 style={{ marginTop: '1rem' }}> | ||
copy tags during operations (beta) | ||
</h2> | ||
<div style={{ marginTop: '1rem', paddingBottom: '0.5rem' }}> | ||
@@ -684,3 +684,3 @@ <div className='form-group'> | ||
type='checkbox' checked={pdfAccessibility.enabled === true} | ||
onChange={(v) => Studio.updateEntity(Object.assign({}, entity, { pdfAccessibility: { enabled: v.target.checked } }))} | ||
onChange={(v) => Studio.updateEntity(Object.assign({}, entity, { pdfAccessibility: { ...entity.pdfAccessibility, enabled: v.target.checked } }))} | ||
/> | ||
@@ -690,2 +690,24 @@ </label> | ||
</div> | ||
<h2 style={{ marginTop: '1rem' }}> | ||
pdf/UA (beta) | ||
</h2> | ||
<p>tasks for the template developer: | ||
<ul> | ||
<li>html img needs to have the alt attribute</li> | ||
<li>the pdf utils meta needs to have filled language</li> | ||
<li>"copy tags" needs to be selected</li> | ||
</ul> | ||
</p> | ||
<div style={{ marginTop: '1rem', paddingBottom: '0.5rem' }}> | ||
<div className='form-group'> | ||
<label> | ||
Enabled | ||
<br /> | ||
<input | ||
type='checkbox' checked={pdfAccessibility.pdfUA === true} | ||
onChange={(v) => Studio.updateEntity(Object.assign({}, entity, { pdfAccessibility: { ...entity.pdfAccessibility, pdfUA: v.target.checked } }))} | ||
/> | ||
</label> | ||
</div> | ||
</div> | ||
</div> | ||
@@ -692,0 +714,0 @@ </div> |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
1700329
8091
72
+ Added@jsreport/pdfjs@1.4.2(transitive)
+ Addedcrypto-js@4.2.0(transitive)
- Removed@jsreport/pdfjs@1.4.1(transitive)
- Removedcrypto-js@4.1.1(transitive)
Updated@jsreport/pdfjs@1.4.2