@kingstonsoftware/pdf-o-rama
Advanced tools
Comparing version 2.2.6 to 2.2.7
@@ -16,3 +16,3 @@ "use strict"; | ||
var _hummus = _interopRequireDefault(require("hummus")); | ||
var _hummus = _interopRequireDefault(require("@kingstonsoftware/hummus")); | ||
@@ -224,3 +224,3 @@ var _json = _interopRequireDefault(require("json5")); | ||
for (let i = 0; i < numPages; i++) { | ||
const pageModifier = new _hummus.default.PDFPageModifier(this.pdfWriter, i); | ||
const pageModifier = new _hummus.default.PDFPageModifier(this.pdfWriter, i, true); | ||
let pageContext = pageModifier.startContext().getContext(); | ||
@@ -285,11 +285,17 @@ const fields = data.fields.filter(f => f.page === i); | ||
const q = Math.PI / 4.0; | ||
pageModifier.endContext(); | ||
let gsID = this.createOpacityExtGState(0.5); | ||
let formXObject = this.pdfWriter.createFormXObject(0, 0, w, h); | ||
let gsName = formXObject.getResourcesDictionary().addExtGStateMapping(gsID); | ||
formXObject.getContentContext().q().gs(gsName).w(1.0).G(0).rg(1, 0.6, 1).m(0, halfH).l(halfH, 0).l(w, 0).l(w, h).l(halfH, h).h().B().BT().g(0).Tm(1, 0, 0, 1, halfH, halfH - fontDims.height / 2.0).Tf(font, 12).Tj(`Sign Here ${field.value || ""}`).ET().Q(); | ||
const gsID = this.createExtGState(0.5); | ||
const formXObject = this.pdfWriter.createFormXObject(0, 0, w, h); | ||
const gsName = formXObject.getResourcesDictionary().addExtGStateMapping(gsID); | ||
formXObject.getContentContext().q().gs(gsName).rg(1, 0.6, 1).m(0, halfH).l(halfH, 0).l(w, 0).l(w, h).l(halfH, h).f().G(0).J(0).w(1).m(halfH, h).l(0, halfH).l(halfH, 0).S().w(2).m(halfH, 0).l(w, 0).l(w, h).l(halfH, h).S().BT().g(0).Tm(1, 0, 0, 1, halfH, halfH - fontDims.height / 2.0).Tf(font, 12).Tj(`Sign Here ${field.value || ""}`).ET().Q(); | ||
this.pdfWriter.endFormXObject(formXObject); | ||
pageContext = pageModifier.startContext().getContext(); | ||
pageContext.q().cm(1, 0, 0, 1, x, y + halfH).cm(Math.cos(q), Math.sin(q), -Math.sin(q), Math.cos(q), 0, 0).cm(1, 0, 0, 1, 0, -halfH) // NOTE: The coordinate space of the XObjects is the same as the page! | ||
const q = Math.PI / 4.0; // 45 degrees | ||
// The sign-here arrow is the same height as the field box, | ||
// points to the bottom left corner of the box and is at 45 degrees | ||
pageContext.q().cm(1, 0, 0, 1, x, y) // Translate | ||
.cm(Math.cos(q), Math.sin(q), -Math.sin(q), Math.cos(q), 0, 0) // Rotate | ||
.cm(1, 0, 0, 1, 0, -halfH) // Translate | ||
// NOTE: The coordinate space of the XObjects is the same as the page! | ||
.doXObject(formXObject).Q(); | ||
@@ -310,10 +316,16 @@ break; | ||
createOpacityExtGState(opacity) { | ||
createExtGState(opacity) { | ||
const context = this.pdfWriter.getObjectsContext(); | ||
const id = context.startNewIndirectObject(); | ||
const dict = context.startDictionary(); | ||
dict.writeKey("type").writeNameValue("ExtGState").writeKey("ca"); | ||
const dict = context.startDictionary(); // See Section 4.3.4 | ||
dict.writeKey("type").writeNameValue("ExtGState").writeKey("ca"); // Non-stroking opacity | ||
context.writeNumber(opacity).endLine(); | ||
dict.writeKey("CA"); | ||
context.writeNumber(opacity).endLine().endDictionary(dict); | ||
dict.writeKey("CA"); // Stroking opacity | ||
context.writeNumber(opacity).endLine(); | ||
dict.writeKey("SA"); // Turn on stroke adjustment | ||
context.writeBoolean(true).endLine().endDictionary(dict); | ||
return id; | ||
@@ -320,0 +332,0 @@ } |
@@ -7,6 +7,6 @@ "use strict"; | ||
exports.fullVersion = exports.version = void 0; | ||
const version = '2.2.6'; | ||
const version = '2.2.7'; | ||
exports.version = version; | ||
const fullVersion = '2.2.6-20200223.0'; | ||
const fullVersion = '2.2.7-20200422.0'; | ||
exports.fullVersion = fullVersion; | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "@kingstonsoftware/pdf-o-rama", | ||
"private": false, | ||
"version": "2.2.6", | ||
"version": "2.2.7", | ||
"description": "A tool for manipulating PDF files", | ||
@@ -47,11 +47,11 @@ "engines": { | ||
"devDependencies": { | ||
"@babel/cli": "^7.7.7", | ||
"@babel/core": "^7.7.7", | ||
"@babel/node": "^7.7.7", | ||
"@babel/plugin-proposal-class-properties": "^7.7.4", | ||
"@babel/plugin-proposal-decorators": "^7.7.4", | ||
"@babel/plugin-proposal-optional-chaining": "^7.7.5", | ||
"@babel/plugin-syntax-object-rest-spread": "^7.7.4", | ||
"@babel/preset-env": "^7.7.7", | ||
"jest-cli": "^24.9.0" | ||
"@babel/cli": "^7.8.4", | ||
"@babel/core": "^7.9.0", | ||
"@babel/node": "^7.8.7", | ||
"@babel/plugin-proposal-class-properties": "^7.8.3", | ||
"@babel/plugin-proposal-decorators": "^7.8.3", | ||
"@babel/plugin-proposal-optional-chaining": "^7.9.0", | ||
"@babel/plugin-syntax-object-rest-spread": "^7.8.3", | ||
"@babel/preset-env": "^7.9.5", | ||
"jest-cli": "^25.3.0" | ||
}, | ||
@@ -61,8 +61,8 @@ "dependencies": { | ||
"autobind-decorator": "^2.4.0", | ||
"chalk": "^3.0.0", | ||
"fs-extra": "^8.1.0", | ||
"hummus": "^1.0.108", | ||
"json5": "^2.1.1", | ||
"chalk": "^4.0.0", | ||
"fs-extra": "^9.0.0", | ||
"@kingstonsoftware/hummus": "^1.0.109", | ||
"json5": "^2.1.3", | ||
"md5": "^2.2.1", | ||
"minimist": "^1.2.0", | ||
"minimist": "^1.2.5", | ||
"qrcode": "^1.4.4", | ||
@@ -69,0 +69,0 @@ "tmp-promise": "^2.0.2" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
69105
533
+ Added@kingstonsoftware/hummus@1.0.110(transitive)
+ Added@types/node@14.18.63(transitive)
+ Addedat-least-node@1.0.0(transitive)
+ Addedchalk@4.1.2(transitive)
+ Addedfs-extra@9.1.0(transitive)
+ Addedjsonfile@6.1.0(transitive)
+ Addeduniversalify@2.0.1(transitive)
- Removedhummus@^1.0.108
- Removed@mapbox/node-pre-gyp@1.0.11(transitive)
- Removedabbrev@1.1.1(transitive)
- Removedagent-base@6.0.2(transitive)
- Removedaproba@2.0.0(transitive)
- Removedare-we-there-yet@2.0.0(transitive)
- Removedchalk@3.0.0(transitive)
- Removedchownr@2.0.0(transitive)
- Removedcolor-support@1.1.3(transitive)
- Removedconsole-control-strings@1.1.0(transitive)
- Removeddebug@4.3.7(transitive)
- Removeddelegates@1.0.0(transitive)
- Removeddetect-libc@2.0.3(transitive)
- Removedfs-extra@8.1.0(transitive)
- Removedfs-minipass@2.1.0(transitive)
- Removedgauge@3.0.2(transitive)
- Removedhas-unicode@2.0.1(transitive)
- Removedhttps-proxy-agent@5.0.1(transitive)
- Removedhummus@1.0.117(transitive)
- Removedjsonfile@4.0.0(transitive)
- Removedmake-dir@3.1.0(transitive)
- Removedminipass@3.3.65.0.0(transitive)
- Removedminizlib@2.1.2(transitive)
- Removedmkdirp@1.0.4(transitive)
- Removedms@2.1.3(transitive)
- Removednode-fetch@2.7.0(transitive)
- Removednopt@5.0.0(transitive)
- Removednpmlog@5.0.1(transitive)
- Removedobject-assign@4.1.1(transitive)
- Removedreadable-stream@3.6.2(transitive)
- Removedrimraf@3.0.2(transitive)
- Removedsafe-buffer@5.2.1(transitive)
- Removedsemver@6.3.17.6.3(transitive)
- Removedsignal-exit@3.0.7(transitive)
- Removedstring_decoder@1.3.0(transitive)
- Removedtar@6.2.1(transitive)
- Removedtr46@0.0.3(transitive)
- Removeduniversalify@0.1.2(transitive)
- Removedutil-deprecate@1.0.2(transitive)
- Removedwebidl-conversions@3.0.1(transitive)
- Removedwhatwg-url@5.0.0(transitive)
- Removedwide-align@1.1.5(transitive)
- Removedyallist@4.0.0(transitive)
Updatedchalk@^4.0.0
Updatedfs-extra@^9.0.0
Updatedjson5@^2.1.3
Updatedminimist@^1.2.5