feat: allow generating accessible pdf with printToPDF
(#39563)
* feat: allow generating accessible pdf with printToPDF * docs: mark generateTaggedPDF experimental
This commit is contained in:
parent
381c955bca
commit
2affecd4dd
6 changed files with 51 additions and 98 deletions
|
@ -2081,6 +2081,28 @@ describe('webContents module', () => {
|
|||
// Check that correct # of pages are rendered.
|
||||
expect(doc.numPages).to.equal(3);
|
||||
});
|
||||
|
||||
it('does not tag PDFs by default', async () => {
|
||||
await w.loadFile(path.join(__dirname, 'fixtures', 'api', 'print-to-pdf-small.html'));
|
||||
|
||||
const data = await w.webContents.printToPDF({});
|
||||
const doc = await pdfjs.getDocument(data).promise;
|
||||
const markInfo = await doc.getMarkInfo();
|
||||
expect(markInfo).to.be.null();
|
||||
});
|
||||
|
||||
it('can generate tag data for PDFs', async () => {
|
||||
await w.loadFile(path.join(__dirname, 'fixtures', 'api', 'print-to-pdf-small.html'));
|
||||
|
||||
const data = await w.webContents.printToPDF({ generateTaggedPDF: true });
|
||||
const doc = await pdfjs.getDocument(data).promise;
|
||||
const markInfo = await doc.getMarkInfo();
|
||||
expect(markInfo).to.deep.equal({
|
||||
Marked: true,
|
||||
UserProperties: false,
|
||||
Suspects: false
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('PictureInPicture video', () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue