Skip to content

Commit

Permalink
📦 Build 3.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
vbuch committed Jan 19, 2024
1 parent 52ead8b commit 979cadd
Show file tree
Hide file tree
Showing 9 changed files with 65 additions and 15 deletions.
7 changes: 6 additions & 1 deletion packages/placeholder-pdfkit/dist/pdfkitAddPlaceholder.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export function pdfkitAddPlaceholder({ pdf, reason, contactInfo, name, location, signatureLength, byteRangePlaceholder, subFilter, widgetRect, }: InputType): ReturnType;
export function pdfkitAddPlaceholder({ pdf, reason, contactInfo, name, location, signingTime, signatureLength, byteRangePlaceholder, subFilter, widgetRect, appName, }: InputType): ReturnType;
export type InputType = {
/**
* PDFDocument
Expand All @@ -9,6 +9,7 @@ export type InputType = {
contactInfo: string;
name: string;
location: string;
signingTime?: Date;
signatureLength?: number;
byteRangePlaceholder?: string;
/**
Expand All @@ -19,6 +20,10 @@ export type InputType = {
* [x1, y1, x2, y2] widget rectangle
*/
widgetRect?: number[];
/**
* Name of the application generating the signature
*/
appName?: string;
};
export type ReturnType = {
signature: any;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 18 additions & 4 deletions packages/placeholder-pdfkit/dist/pdfkitAddPlaceholder.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ var _utils = require("@signpdf/utils");
* @property {string} contactInfo
* @property {string} name
* @property {string} location
* @property {Date} [signingTime]
* @property {number} [signatureLength]
* @property {string} [byteRangePlaceholder]
* @property {string} [subFilter] One of SUBFILTER_* from \@signpdf/utils
* @property {number[]} [widgetRect] [x1, y1, x2, y2] widget rectangle
* @property {string} [appName] Name of the application generating the signature
*/

/**
Expand All @@ -39,10 +41,12 @@ const pdfkitAddPlaceholder = ({
contactInfo,
name,
location,
signingTime = undefined,
signatureLength = _utils.DEFAULT_SIGNATURE_LENGTH,
byteRangePlaceholder = _utils.DEFAULT_BYTE_RANGE_PLACEHOLDER,
subFilter = _utils.SUBFILTER_ADOBE_PKCS7_DETACHED,
widgetRect = [0, 0, 0, 0]
widgetRect = [0, 0, 0, 0],
appName = undefined
}) => {
/* eslint-disable no-underscore-dangle,no-param-reassign */
// Generate the signature placeholder
Expand All @@ -54,14 +58,24 @@ const pdfkitAddPlaceholder = ({
Contents: Buffer.from(String.fromCharCode(0).repeat(signatureLength)),
Reason: new String(reason),
// eslint-disable-line no-new-wrappers
M: new Date(),
M: signingTime !== null && signingTime !== void 0 ? signingTime : new Date(),
ContactInfo: new String(contactInfo),
// eslint-disable-line no-new-wrappers
Name: new String(name),
// eslint-disable-line no-new-wrappers
Location: new String(location) // eslint-disable-line no-new-wrappers
Location: new String(location),
// eslint-disable-line no-new-wrappers
Prop_Build: {
Filter: {
Name: 'Adobe.PPKLite'
},
...(appName ? {
App: {
Name: appName
}
} : {})
}
});

if (!pdf._acroform) {
pdf.initForm();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export function pdfkitAddPlaceholder({ pdf, pdfBuffer, reason, contactInfo, name, location, signatureLength, byteRangePlaceholder, subFilter, widgetRect, }: InputType): ReturnType;
export function pdfkitAddPlaceholder({ pdf, pdfBuffer, reason, contactInfo, name, location, signingTime, signatureLength, byteRangePlaceholder, subFilter, widgetRect, appName, }: InputType): ReturnType;
export type InputType = {
/**
* PDFDocument
Expand All @@ -9,6 +9,7 @@ export type InputType = {
contactInfo: string;
name: string;
location: string;
signingTime?: Date;
signatureLength?: number;
byteRangePlaceholder?: string;
/**
Expand All @@ -19,6 +20,10 @@ export type InputType = {
* [x1, y1, x2, y2] widget rectangle
*/
widgetRect?: number[];
/**
* Name of the application generating the signature
*/
appName?: string;
};
export type ReturnType = {
signature: any;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 18 additions & 3 deletions packages/placeholder-pdfkit010/dist/pdfkitAddPlaceholder.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ var _pdfkitReferenceMock = require("./pdfkitReferenceMock");
* @property {string} contactInfo
* @property {string} name
* @property {string} location
* @property {Date} [signingTime]
* @property {number} [signatureLength]
* @property {string} [byteRangePlaceholder]
* @property {string} [subFilter] One of SUBFILTER_* from \@signpdf/utils
* @property {number[]} [widgetRect] [x1, y1, x2, y2] widget rectangle
* @property {string} [appName] Name of the application generating the signature
*/

/**
Expand All @@ -43,10 +45,12 @@ const pdfkitAddPlaceholder = ({
contactInfo,
name,
location,
signingTime = undefined,
signatureLength = _utils.DEFAULT_SIGNATURE_LENGTH,
byteRangePlaceholder = _utils.DEFAULT_BYTE_RANGE_PLACEHOLDER,
subFilter = _utils.SUBFILTER_ADOBE_PKCS7_DETACHED,
widgetRect = [0, 0, 0, 0]
widgetRect = [0, 0, 0, 0],
appName = undefined
}) => {
/* eslint-disable no-underscore-dangle,no-param-reassign */
// Generate the signature placeholder
Expand All @@ -58,12 +62,23 @@ const pdfkitAddPlaceholder = ({
Contents: Buffer.from(String.fromCharCode(0).repeat(signatureLength)),
Reason: new String(reason),
// eslint-disable-line no-new-wrappers
M: new Date(),
M: signingTime !== null && signingTime !== void 0 ? signingTime : new Date(),
ContactInfo: new String(contactInfo),
// eslint-disable-line no-new-wrappers
Name: new String(name),
// eslint-disable-line no-new-wrappers
Location: new String(location) // eslint-disable-line no-new-wrappers
Location: new String(location),
// eslint-disable-line no-new-wrappers
Prop_Build: {
Filter: {
Name: 'Adobe.PPKLite'
},
...(appName ? {
App: {
Name: appName
}
} : {})
}
});

// Check if pdf already contains acroform field
Expand Down
7 changes: 6 additions & 1 deletion packages/placeholder-plain/dist/plainAddPlaceholder.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
export function plainAddPlaceholder({ pdfBuffer, reason, contactInfo, name, location, signatureLength, subFilter, widgetRect, }: InputType): Buffer;
export function plainAddPlaceholder({ pdfBuffer, reason, contactInfo, name, location, signingTime, signatureLength, subFilter, widgetRect, appName, }: InputType): Buffer;
export type InputType = {
pdfBuffer: Buffer;
reason: string;
contactInfo: string;
name: string;
location: string;
signingTime?: Date;
signatureLength?: number;
/**
* One of SUBFILTER_* from \@signpdf/utils
Expand All @@ -14,5 +15,9 @@ export type InputType = {
* [x1, y1, x2, y2] widget rectangle
*/
widgetRect?: number[];
/**
* Name of the application generating the signature
*/
appName?: string;
};
//# sourceMappingURL=plainAddPlaceholder.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions packages/placeholder-plain/dist/plainAddPlaceholder.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@ const getAcroFormRef = slice => {
* @property {string} contactInfo
* @property {string} name
* @property {string} location
* @property {Date} [signingTime]
* @property {number} [signatureLength]
* @property {string} [subFilter] One of SUBFILTER_* from \@signpdf/utils
* @property {number[]} [widgetRect] [x1, y1, x2, y2] widget rectangle
* @property {string} [appName] Name of the application generating the signature
*/

/**
Expand All @@ -58,9 +60,11 @@ const plainAddPlaceholder = ({
contactInfo,
name,
location,
signingTime = undefined,
signatureLength = _utils.DEFAULT_SIGNATURE_LENGTH,
subFilter = _utils.SUBFILTER_ADOBE_PKCS7_DETACHED,
widgetRect = [0, 0, 0, 0]
widgetRect = [0, 0, 0, 0],
appName = undefined
}) => {
let pdf = (0, _utils.removeTrailingNewLine)(pdfBuffer);
const info = (0, _readPdf.default)(pdf);
Expand Down Expand Up @@ -101,9 +105,11 @@ const plainAddPlaceholder = ({
contactInfo,
name,
location,
signingTime,
signatureLength,
subFilter,
widgetRect
widgetRect,
appName
});
if (!getAcroFormRef(pdf.toString())) {
const rootIndex = (0, _getIndexFromRef.default)(info.xref, info.rootRef);
Expand Down

0 comments on commit 979cadd

Please sign in to comment.