Skip to content

Commit

Permalink
Bump version to 1.13.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Hopding committed Dec 6, 2020
1 parent 0d35886 commit 1f63950
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 11 deletions.
2 changes: 1 addition & 1 deletion apps/rn/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4885,7 +4885,7 @@ path-type@^3.0.0:
pify "^3.0.0"

pdf-lib@./../..:
version "1.12.0"
version "1.13.0"
dependencies:
"@pdf-lib/standard-fonts" "^1.0.0"
"@pdf-lib/upng" "^1.0.1"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pdf-lib",
"version": "1.12.0",
"version": "1.13.0",
"description": "Create and modify PDF files with JavaScript",
"author": "Andrew Dillon <[email protected]>",
"contributors": [
Expand Down
6 changes: 5 additions & 1 deletion src/api/PDFDocument.ts
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,11 @@ export default class PDFDocument {
assertOrUndefined(options.modificationDate, 'options.modificationDate', [
Date,
]);
assertIsOneOfOrUndefined(options.afRelationship, 'options.afRelationship', AFRelationship);
assertIsOneOfOrUndefined(
options.afRelationship,
'options.afRelationship',
AFRelationship,
);

const bytes = toUint8Array(attachment);
const embedder = FileEmbedder.for(bytes, name, options);
Expand Down
4 changes: 2 additions & 2 deletions src/api/PDFEmbeddedFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export default class PDFEmbeddedFile implements Embeddable {

/**
* The AF-Tag is needed to achieve PDF-A3 compliance for embedded files
*
*
* The following document outlines the uses cases of the associated files (AF) tag.
* See:
* https://www.pdfa.org/wp-content/uploads/2018/10/PDF20_AN002-AF.pdf
Expand All @@ -82,7 +82,7 @@ export default class PDFEmbeddedFile implements Embeddable {
this.doc.catalog.set(PDFName.of('AF'), this.doc.context.obj([]));
}
const AF = this.doc.catalog.lookup(PDFName.of('AF'), PDFArray);
AF.push(ref)
AF.push(ref);

this.alreadyEmbedded = true;
}
Expand Down
9 changes: 4 additions & 5 deletions src/core/embedders/FileEmbedder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PDFHexString from 'src/core/objects/PDFHexString';
import PDFContext from 'src/core/PDFContext';
import PDFRef from 'src/core/objects/PDFRef';

/**
/**
* From the PDF-A3 specification, section **3.1. Requirements - General**.
* See:
* * https://www.pdfa.org/wp-content/uploads/2018/10/PDF20_AN002-AF.pdf
Expand All @@ -16,7 +16,7 @@ export enum AFRelationship {
EncryptedPayload = 'EncryptedPayload',
FormData = 'EncryptedPayload',
Schema = 'Schema',
Unspecified = 'Unspecified'
Unspecified = 'Unspecified',
}

export interface EmbeddedFileOptions {
Expand Down Expand Up @@ -56,10 +56,9 @@ class FileEmbedder {
description,
creationDate,
modificationDate,
afRelationship
afRelationship,
} = this.options;


const embeddedFileStream = context.flateStream(this.fileData, {
Type: 'EmbeddedFile',
Subtype: mimeType ?? undefined,
Expand All @@ -81,7 +80,7 @@ class FileEmbedder {
UF: PDFHexString.fromText(this.fileName),
EF: { F: embeddedFileStreamRef },
Desc: description ? PDFHexString.fromText(description) : undefined,
AFRelationship: afRelationship ?? undefined
AFRelationship: afRelationship ?? undefined,
});

if (ref) {
Expand Down
5 changes: 4 additions & 1 deletion src/core/objects/PDFArray.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ class PDFArray extends PDFObject {
lookupMaybe(index: number, type: typeof PDFNull): typeof PDFNull | undefined;
lookupMaybe(index: number, type: typeof PDFNumber): PDFNumber | undefined;
lookupMaybe(index: number, type: typeof PDFStream): PDFStream | undefined;
lookupMaybe(index: number, type: typeof PDFRawStream): PDFRawStream | undefined;
lookupMaybe(
index: number,
type: typeof PDFRawStream,
): PDFRawStream | undefined;
lookupMaybe(index: number, type: typeof PDFRef): PDFRef | undefined;
lookupMaybe(index: number, type: typeof PDFString): PDFString | undefined;
lookupMaybe(
Expand Down

0 comments on commit 1f63950

Please sign in to comment.