Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions PDFApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,13 @@ function getMetadata() {
* @param {Object} object Object for updading PDF metadata.
* @return {promise} Updated PDF blob.
*/
function udpateMetadata(object) {
function updateMetadata(object) {
if (!this.pdfBlob) {
throw new Error("Please set the source PDF blob using the setPDFBlob method.");
}
const pdfBlob = this.pdfBlob;
const PDFA = new PDFApp(this);
return PDFA.udpateMetadata(pdfBlob, object);
return PDFA.updateMetadata(pdfBlob, object);
}

/**
Expand Down Expand Up @@ -351,7 +351,7 @@ class PDFApp {
* @param {Object} object Object including the values for updating metadata.
* @return {promise} PDF Blob.
*/
udpateMetadata(pdfBlob, object) {
updateMetadata(pdfBlob, object) {
if (typeof object != "object" || Object.keys(object).length == 0) {
throw new Error("Please set valid object for updating PDF metadata.");
}
Expand Down Expand Up @@ -1132,4 +1132,4 @@ class PDFApp {
async getPDFObjectFromBlob_(blob) {
return await this.PDFLib.PDFDocument.load(new Uint8Array(blob.getBytes()));
}
}
}
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ This library uses the following 3 scopes.
|||
| [exportPages](#exportpages) | Export specific pages from a PDF blob. |
| [getMetadata](#getmetadata) | Get PDF metadata from a PDF blob. |
| [udpateMetadata](#udpatemetadata) | Update PDF metadata of a PDF blob. |
| [updateMetadata](#updateMetadata) | Update PDF metadata of a PDF blob. |
| [reorderPages](#reorderpages) | Reorder pages of a PDF blob. |
| [mergePDFs](#mergepdfs) | Merge multiple PDF files in a single PDF. |
| [convertPDFToPng](#convertpdftopng) | Convert PDF pages to PNG images. |
Expand Down Expand Up @@ -191,9 +191,9 @@ PDFApp.setPDFBlob(blob).getMetadata()

- This is from my post "[Management of PDF Metadata using Google Apps Script](https://medium.com/google-cloud/management-of-pdf-metadata-using-google-apps-script-60fd41f4fc16)".

<a name="udpatemetadata"></a>
<a name="updateMetadata"></a>

## udpateMetadata
## updateMetadata

![](images/fig3.png)

Expand All @@ -213,7 +213,7 @@ const object = {
producer: "sample producer",
};

PDFApp.setPDFBlob(blob).udpateMetadata(object)
PDFApp.setPDFBlob(blob).updateMetadata(object)
.then(newBlob => DriveApp.createFile(newBlob))
.catch(err => console.log(err));
```
Expand Down