From e2c9459d942758a72b0e79f7d7a9c5b7024a93fa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Luiz=20Am=C3=A9rico?= <luizamericop@gmail.com>
Date: Sat, 2 Mar 2019 21:30:20 -0300
Subject: [PATCH 1/2] Add changelog and improve Get Started document

---
 CHANGELOG.md            | 15 +++++++
 docs/getting_started.md | 89 ++++++++++++++++++++---------------------
 2 files changed, 59 insertions(+), 45 deletions(-)
 create mode 100644 CHANGELOG.md

diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 00000000..4e8d4434
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,15 @@
+## pdfkit changelog
+
+### Unreleased
+
+- Fix setting printing permission
+- Fix corruption of string objects in browser
+- Add option to set default font
+- Remove call to fontkit.openSync
+
+### [v0.9.0] - 2019-1-28
+
+- Convert to code base from coffescript to ES6+
+- Fix loading grayscale / transparent PNG files
+- Reduce number of calls to async functions
+- Implement encryption / access control
diff --git a/docs/getting_started.md b/docs/getting_started.md
index fdd241ff..f808ca0c 100644
--- a/docs/getting_started.md
+++ b/docs/getting_started.md
@@ -33,10 +33,9 @@ The `write` and `output` methods found in PDFKit before version 0.5 are now depr
 
 ## Using PDFKit in the browser
 
-As of version 0.6, PDFKit can be used in the browser as well as in Node!
-There are two ways to use PDFKit in the browser.  The first is to use [Browserify](http://browserify.org/),
-which is a Node module packager for the browser with the familiar `require` syntax.  The second is to use
-a prebuilt version of PDFKit, which you can [download from Github](https://github.com/devongovett/pdfkit/releases).
+PDFKit can be used in the browser as well as in Node! There are two ways to use PDFKit in the browser.
+The first is to create an app using an module bundler like [Browserify](http://browserify.org/) or [Webpack](https://webpack.js.org/).
+The second is to create a standalone pdfkit script as explained [here](https://github.com/foliojs/pdfkit/wiki/How-to-compile-standalone-PDFKit-for-use-in-the-browser).
 
 Using PDFKit in the browser is exactly the same as using it in Node, except you'll want to pipe the
 output to a destination supported in the browser, such as a
@@ -45,7 +44,7 @@ to generate a URL to allow display of generated PDFs directly in the browser via
 be used to upload the PDF to a server, or trigger a download in the user's browser.
 
 To get a Blob from a `PDFDocument`, you should pipe it to a [blob-stream](https://github.com/devongovett/blob-stream),
-which is a module that generates a Blob from any Node-style stream.  The following example uses Browserify to load
+which is a module that generates a Blob from any Node-style stream. The following example uses Browserify to load
 `PDFKit` and `blob-stream`, but if you're not using Browserify, you can load them in whatever way you'd like (e.g. script tags).
 
     // require dependencies
@@ -74,7 +73,7 @@ which is a module that generates a Blob from any Node-style stream.  The followi
 You can see an interactive in-browser demo of PDFKit [here](http://pdfkit.org/demo/browser.html).
 
 Note that in order to Browserify a project using PDFKit, you need to install the `brfs` module with npm,
-which is used to load built-in font data into the package. It is listed as a `devDependency` in
+which is used to load built-in font data into the package. It is listed as a `devDependencies` in
 PDFKit's `package.json`, so it isn't installed by default for Node users.
 If you forget to install it, Browserify will print an error message.
 
@@ -105,7 +104,7 @@ then overridden by individual options passed to the `addPage` method.
 You can set the page margins in two ways. The first is by setting the `margin`
 property (singular) to a number, which applies that margin to all edges. The
 other way is to set the `margins` property (plural) to an object with `top`,
-`bottom`, `left`, and `right` values.  The default is a 1 inch (72 point) margin
+`bottom`, `left`, and `right` values. The default is a 1 inch (72 point) margin
 on all sides.
 
 For example:
@@ -128,20 +127,20 @@ For example:
 ## Switching to previous pages
 
 PDFKit normally flushes pages to the output file immediately when a new page is created, making
-it impossible to jump back and add content to previous pages.  This is normally not an issue, but
+it impossible to jump back and add content to previous pages. This is normally not an issue, but
 in some circumstances it can be useful to add content to pages after the whole document, or a part
-of the document, has been created already.  Examples include adding page numbers, or filling in other
+of the document, has been created already. Examples include adding page numbers, or filling in other
 parts of information you don't have until the rest of the document has been created.
 
 PDFKit has a `bufferPages` option in versions v0.7.0 and later that allows you to control when
 pages are flushed to the output file yourself rather than letting PDFKit handle that for you. To use
-it, just pass `bufferPages: true` as an option to the `PDFDocument` constructor.  Then, you can call
+it, just pass `bufferPages: true` as an option to the `PDFDocument` constructor. Then, you can call
 `doc.switchToPage(pageNumber)` to switch to a previous page (page numbers start at 0).
 
 When you're ready to flush the buffered pages to the output file, call `flushPages`.
 This method is automatically called by `doc.end()`, so if you just want to buffer all pages in the document, you
-never need to call it.  Finally, there is a `bufferedPageRange` method, which returns the range
-of pages that are currently buffered.  Here is a small example that shows how you might add page
+never need to call it. Finally, there is a `bufferedPageRange` method, which returns the range
+of pages that are currently buffered. Here is a small example that shows how you might add page
 numbers to a document.
 
     // create a document, and enable bufferPages mode
@@ -188,12 +187,12 @@ Here is a list of all of the properties you can add to the document metadata.
 According to the PDF spec, each property must have its first letter
 capitalized.
 
-  * `Title` - the title of the document
-  * `Author` - the name of the author
-  * `Subject` - the subject of the document
-  * `Keywords` - keywords associated with the document
-  * `CreationDate` - the date the document was created (added automatically by PDFKit)
-  * `ModDate` - the date the document was last modified
+- `Title` - the title of the document
+- `Author` - the name of the author
+- `Subject` - the subject of the document
+- `Keywords` - keywords associated with the document
+- `CreationDate` - the date the document was created (added automatically by PDFKit)
+- `ModDate` - the date the document was last modified
 
 ## Encryption and Access Privileges
 
@@ -206,38 +205,38 @@ To enable encryption, provide a user password when creating the `PDFDocument` in
 The PDF file will be encrypted when a user password is provided, and users will be prompted to enter
 the password to decrypt the file when opening it.
 
- * `userPassword` - the user password (string value)
+- `userPassword` - the user password (string value)
 
 To set access privileges for the PDF file, you need to provide an owner password and permission
 settings in the `option` object when creating `PDFDocument`. By default, all operations are disallowed.
 You need to explicitly allow certain operations.
 
- * `ownerPassword` - the owner password (string value)
- * `permissions` - the object specifying PDF file permissions
+- `ownerPassword` - the owner password (string value)
+- `permissions` - the object specifying PDF file permissions
 
 Following settings are allowed in `permissions` object:
 
- * `printing` - whether printing is allowed. Specify `"lowResolution"` to allow degraded printing, or `"highResolution"` to allow printing with high resolution
- * `modifying` - whether modifying the file is allowed. Specify `true` to allow modifying document content
- * `copying` - whether copying text or graphics is allowed. Specify `true` to allow copying
- * `annotating` - whether annotating, form filling is allowed. Specify `true` to allow annotating and form filling
- * `fillingForms` - whether form filling and signing is allowed. Specify `true` to allow filling in form fields and signing
- * `contentAccessibility` - whether copying text for accessibility is allowed. Specify `true` to allow copying for accessibility
- * `documentAssembly` - whether assembling document is allowed. Specify `true` to allow document assembly
+- `printing` - whether printing is allowed. Specify `"lowResolution"` to allow degraded printing, or `"highResolution"` to allow printing with high resolution
+- `modifying` - whether modifying the file is allowed. Specify `true` to allow modifying document content
+- `copying` - whether copying text or graphics is allowed. Specify `true` to allow copying
+- `annotating` - whether annotating, form filling is allowed. Specify `true` to allow annotating and form filling
+- `fillingForms` - whether form filling and signing is allowed. Specify `true` to allow filling in form fields and signing
+- `contentAccessibility` - whether copying text for accessibility is allowed. Specify `true` to allow copying for accessibility
+- `documentAssembly` - whether assembling document is allowed. Specify `true` to allow document assembly
 
 You can specify either user password, owner password or both passwords.
 Behavior differs according to passwords you provides:
 
- * When only user password is provided,
-   users with user password are able to decrypt the file and have full access to the document.
- * When only owner password is provided,
-   users are able to decrypt and open the document without providing any password,
-   but the access is limited to those operations explicitly permitted.
-   Users with owner password have full access to the document.
- * When both passwords are provided,
-   users with user password are able to decrypt the file
-   but only have limited access to the file according to permission settings.
-   Users with owner password have full access to the document.
+- When only user password is provided,
+  users with user password are able to decrypt the file and have full access to the document.
+- When only owner password is provided,
+  users are able to decrypt and open the document without providing any password,
+  but the access is limited to those operations explicitly permitted.
+  Users with owner password have full access to the document.
+- When both passwords are provided,
+  users with user password are able to decrypt the file
+  but only have limited access to the file according to permission settings.
+  Users with owner password have full access to the document.
 
 Note that PDF file itself cannot enforce access privileges.
 When file is decrypted, PDF viewer applications have full access to the file content,
@@ -246,16 +245,16 @@ and it is up to viewer applications to respect permission settings.
 To choose encryption method, you need to specify PDF version.
 PDFKit will choose best encryption method available in the PDF version you specified.
 
- * `pdfVersion` - a string value specifying PDF file version
+- `pdfVersion` - a string value specifying PDF file version
 
 Available options includes:
 
- * `1.3` - PDF version 1.3 (default), 40-bit RC4 is used
- * `1.4` - PDF version 1.4, 128-bit RC4 is used
- * `1.5` - PDF version 1.5, 128-bit RC4 is used
- * `1.6` - PDF version 1.6, 128-bit AES is used
- * `1.7` - PDF version 1.7, 128-bit AES is used
- * `1.7ext3` - PDF version 1.7 ExtensionLevel 3, 256-bit AES is used
+- `1.3` - PDF version 1.3 (default), 40-bit RC4 is used
+- `1.4` - PDF version 1.4, 128-bit RC4 is used
+- `1.5` - PDF version 1.5, 128-bit RC4 is used
+- `1.6` - PDF version 1.6, 128-bit AES is used
+- `1.7` - PDF version 1.7, 128-bit AES is used
+- `1.7ext3` - PDF version 1.7 ExtensionLevel 3, 256-bit AES is used
 
 When using PDF version 1.7 ExtensionLevel 3, password is truncated to 127 bytes of its UTF-8 representation.
 In older versions, password is truncated to 32 bytes, and only Latin-1 characters are allowed.

From ee62958741bce15d24c85b4026add2883f200cd1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Luiz=20Am=C3=A9rico?= <luizamericop@gmail.com>
Date: Sat, 2 Mar 2019 21:37:57 -0300
Subject: [PATCH 2/2] Add Update Changelog entry to PULL REQUEST template

---
 .github/PULL_REQUEST_TEMPLATE.md | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index 16ec0ecb..62690115 100644
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -7,23 +7,29 @@ merge of your pull request!
 -->
 
 <!-- Is it a Bug fix, feature, docs update, ... -->
+
 **What kind of change does this PR introduce?**
 
 <!-- You can also link to an open issue here -->
+
 **What is the current behavior?**
 
 <!-- if this is a feature change -->
-**What is the new behavior?**
 
+**What is the new behavior?**
 
 <!-- Have you done all of these things?  -->
+
 **Checklist**:
+
 <!-- add "N/A" to the end of each line that's irrelevant to your changes -->
 <!-- to check an item, place an "x" in the box like so: "- [x] Documentation" -->
+
 - [ ] Tests (preference for unit tests)
 - [ ] Documentation
+- [ ] Update CHANGELOG.md
 - [ ] Ready to be merged <!-- In your opinion, is this ready to be merged as soon as it's reviewed? -->
 
 <!-- feel free to add additional comments -->
 
-<!-- Thank you for contributing! -->
\ No newline at end of file
+<!-- Thank you for contributing! -->
