Comparing version 2.0.0-alpha.8 to 2.0.0
@@ -7,2 +7,11 @@ # Changelog | ||
## [Unreleased] | ||
## [2.0.0] - 2018-06-19 | ||
### Changed | ||
- The outline method now accepts an outline ID (number) as a valid input for the parent parameter | ||
### Fixed | ||
- Fixed OTF font browser usage (`new Font(src)` now properly accepts both Node.js Buffer and ArrayBuffer as input) | ||
## [2.0.0-alpha.8] - 2018-05-13 | ||
@@ -9,0 +18,0 @@ ### Added |
@@ -664,9 +664,16 @@ 'use strict' | ||
let parentIndex | ||
if (parent === undefined || parent === '') { | ||
parentIndex = 0 | ||
if (typeof parent === 'number' && parent >= 0 && parent <= this._outlines.length) { | ||
// the user provided a valid index number: use it as the parentIndex | ||
parentIndex = parent | ||
} else { | ||
parentIndex = this._outlines.findIndex( | ||
(item, index) => (item.data.title === parent) | ||
) | ||
if (parentIndex === -1) parentIndex = this.outline(parent, destination) | ||
// the user did not provide a valid index number: search for it in the outline array | ||
// if it is not found, create the corresponding parent at root level | ||
if (parent === undefined || parent === '') { | ||
parentIndex = 0 | ||
} else { | ||
parentIndex = this._outlines.findIndex( | ||
(item, index) => (item.data.title === parent) | ||
) | ||
if (parentIndex === -1) parentIndex = this.outline(parent, destination) | ||
} | ||
} | ||
@@ -673,0 +680,0 @@ |
@@ -13,2 +13,3 @@ 'use strict' | ||
const StringWidth = Base.StringWidth | ||
const util = require('../util') | ||
@@ -20,3 +21,3 @@ module.exports = class OTFFontFactory extends Base { | ||
// convert to array buffer | ||
const ab = b.buffer.slice(b.byteOffset, b.byteOffset + b.byteLength) | ||
const ab = util.toArrayBuffer(b) | ||
this.font = opentype.parse(ab) | ||
@@ -23,0 +24,0 @@ } |
{ | ||
"name": "pdfjs", | ||
"author": "Markus Ast <npm.m@rkusa.st>", | ||
"version": "2.0.0-alpha.8", | ||
"version": "2.0.0", | ||
"description": "A Portable Document Format (PDF) generation library targeting both the server- and client-side.", | ||
@@ -21,3 +21,3 @@ "keywords": [ | ||
"@rkusa/linebreak": "^1.0.0", | ||
"opentype.js": "^0.7.3", | ||
"opentype.js": "^0.8.0", | ||
"pako": "^1.0.6", | ||
@@ -24,0 +24,0 @@ "unorm": "^1.4.1", |
@@ -12,3 +12,3 @@ ![pdfjs](https://cdn.rawgit.com/rkusa/pdfjs/2.x/logo.svg) | ||
```bash | ||
npm install pdfjs@2.0.0-alpha.8 | ||
npm install pdfjs@2.0.0 | ||
``` | ||
@@ -15,0 +15,0 @@ |
@@ -131,3 +131,3 @@ declare module "pdfjs" { | ||
*/ | ||
outline(title: string, destination: string, parent?: string): void; | ||
outline(title: string, destination: string, parent?: string | number): void; | ||
} | ||
@@ -134,0 +134,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
327282
6282
0
+ Addedopentype.js@0.8.0(transitive)
- Removedopentype.js@0.7.3(transitive)
Updatedopentype.js@^0.8.0