diff --git a/.circleci/config.yml b/.circleci/config.yml
index ce0f34912..d8cb794d2 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -9,11 +9,6 @@ jobs:
# specify the version you desire here
- image: circleci/node:11.4.0
- # Specify service dependencies here if necessary
- # CircleCI maintains a library of pre-built images
- # documented at https://circleci.com/docs/2.0/circleci-images/
- # - image: circleci/mongo:3.4.4
-
working_directory: ~/repo
steps:
@@ -22,9 +17,7 @@ jobs:
# Download and cache dependencies
- restore_cache:
keys:
- - v1-dependencies-{{ checksum "package.json" }}
- # fallback to using the latest cache if no exact match is found
- - v1-dependencies-
+ - v1-dependencies-{{ checksum "package.json" }}
- run: yarn install
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 000000000..d25029a43
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,16 @@
+* text eol=lf
+
+tests/**/*.encoded binary eol=lf
+tests/**/*.decoded binary eol=lf
+
+*.otf binary
+*.ttf binary
+*.woff binary
+*.woff2 binary
+*.pdf binary
+*.png binary
+*.jpg binary
+*.eot binary
+assets/**/* binary
+*.jar binary
+*.bat binary
diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
new file mode 100644
index 000000000..7c719c8fb
--- /dev/null
+++ b/.github/FUNDING.yml
@@ -0,0 +1,12 @@
+# These are supported funding model platforms
+
+github: [Hopding] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
+patreon: # Replace with a single Patreon username
+open_collective: # Replace with a single Open Collective username
+ko_fi: # Replace with a single Ko-fi username
+tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
+community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
+liberapay: # Replace with a single Liberapay username
+issuehunt: # Replace with a single IssueHunt username
+otechie: # Replace with a single Otechie username
+custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml
new file mode 100644
index 000000000..41931ce67
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/bug.yml
@@ -0,0 +1,97 @@
+name: Bug Report π
+description: Something not working? Let us know! Just be sure it's something we can reproduce.
+labels: ["bug", "needs-triage"]
+body:
+ - type: markdown
+ attributes:
+ value: |
+ Thanks for taking the time to submit a bug report! π
+ * Be sure to answer **all** of the questions below.
+ * Provide lots of detail. Too much info is better than not enough.
+ * If we can't reproduce the issue, we can't fix it.
+
+ If you've never created an issue on GitHub before, you might find these links helpful:
+ * [45 GitHub Issues Dos and Don'ts](https://davidwalsh.name/45-github-issues-dos-donts)
+ * [Smart Questions](http://catb.org/~esr/faqs/smart-questions.html)
+
+ You can read [MAINTAINERSHIP.md](https://github.com/Hopding/pdf-lib/blob/master/docs/MAINTAINERSHIP.md) to learn more about how this repo is maintained.
+ - type: textarea
+ attributes:
+ label: What were you trying to do?
+ description: Clearly describe what you were trying to do when you found this bug.
+ validations:
+ required: true
+ - type: textarea
+ attributes:
+ label: How did you attempt to do it?
+ description: Clearly describe, in detail, how you attempted to do this. Include both prose and code snippets in your response.
+ validations:
+ required: true
+ - type: textarea
+ attributes:
+ label: What actually happened?
+ description: Clearly describe what actually happened as a result of what you attempted. Be sure to include all relevant stacktraces, CLI output, and screenshots.
+ validations:
+ required: true
+ - type: textarea
+ attributes:
+ label: What did you expect to happen?
+ description: Clearly describe what you expected to happen as a result of what you attempted. Include examples of what you expected in your response.
+ validations:
+ required: true
+ - type: textarea
+ attributes:
+ label: How can we reproduce the issue?
+ description: |
+ π£ _This is a very important part of your report._
+
+ Provide **complete**, **executable** code that can be used to reproduce the bug (e.g. a git repo, ZIP file, or JSFiddle). You must attach (or provide links to) any PDFs, images, or other files necessary to run your code.
+
+ Your code example should be a [SSCCE](http://www.sscce.org/):
+ - Short (Small) - Don't include code that is irrelevant or unnecessary.
+ - Self Contained - Ensure everything is included, ready to go.
+ - Correct - No additional code or changes are needed to copy, paste, and execute it.
+ - Example - Demonstrates the problem you are reporting.
+
+ Please also type out a list of specific steps we can take to run your code and reproduce the issue. Depending on what you're reporting, this might be simple as running a JSFiddle or downloading a ZIP file and executing `node index.js`. Some issues will require more instructions.
+
+ > If you are unable to share certain files (e.g. confidential PDFs), then state this in your response. Be prepared to share the files privately (e.g. via email). If you are unable to do this then we probably can't fix the issue.
+
+ β οΈ If your response includes incomplete code or doesn't clearly state how to execute the code you've provided, your report will be closed without comment.
+
+ π Thank you for taking the time to create a well-defined report! This helps reduce the demand placed on maintainers trying to help you. We want to make this a pleasant, efficient process for both you and us!
+ validations:
+ required: true
+ - type: input
+ attributes:
+ label: Version
+ description: What version of `pdf-lib` are you using?
+ validations:
+ required: true
+ - type: dropdown
+ attributes:
+ label: What environment are you running pdf-lib in?
+ multiple: true
+ options:
+ - Browser
+ - Node
+ - Deno
+ - React Native
+ - Other
+ validations:
+ required: true
+ - type: checkboxes
+ attributes:
+ label: Checklist
+ options:
+ - label: My report includes a Short, Self Contained, Correct (Compilable) Example.
+ required: true
+ - label: I have attached all PDFs, images, and other files needed to run my SSCCE.
+ required: true
+ - type: textarea
+ attributes:
+ label: Additional Notes
+ description: |
+ Please provide any additional information or observations here.
+ validations:
+ required: false
diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml
new file mode 100644
index 000000000..bdc897132
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/config.yml
@@ -0,0 +1,9 @@
+blank_issues_enabled: false
+
+contact_links:
+ - name: Get Help in GitHub Discussions π
+ url: https://github.com/Hopding/pdf-lib/discussions
+ about: Have a question or idea? Want to talk to the community? Join us in pdf-lib's GitHub Discussions!
+ - name: Maintainership Information π οΈ
+ url: https://github.com/Hopding/pdf-lib/blob/master/docs/MAINTAINERSHIP.md
+ about: Learn how this repo is maintained and how we handle communication.
diff --git a/.github/ISSUE_TEMPLATE/proposal.yml b/.github/ISSUE_TEMPLATE/proposal.yml
new file mode 100644
index 000000000..5e139ed99
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/proposal.yml
@@ -0,0 +1,82 @@
+name: Proposal π‘
+description: We're eager to improve pdf-lib! Have an idea you'd like to propose?
+labels: ["proposal", "needs-triage"]
+body:
+ - type: markdown
+ attributes:
+ value: |
+ Thanks for taking the time to submit a proposal!
+
+ In most cases, [discussions](https://github.com/Hopding/pdf-lib/discussions) are a better place to submit feedback and discuss ideas. This form is meant for ideas that have a clear path to implementation. You should only use this form to submit a proposal if:
+ * You have a specific idea in mind to improve `pdf-lib`.
+ * You've done your research.
+ * You've read [CONTRIBUTING.md](https://github.com/Hopding/pdf-lib/blob/master/docs/CONTRIBUTING.md) and understand what involved in making a change to `pdf-lib`.
+ * You've read the sections of the PDF specification listed [here](https://github.com/Hopding/pdf-lib/blob/master/docs/CONTRIBUTING.md#understanding-pdfs).
+ * You can describe a technical approach to implementing your idea.
+
+ If you still think this is the right form to propose you're idea, then please fill it out. We love well thought out, detailed, technical proposals! π
+
+ Keep the following in mind when filling out this form:
+ * Be sure to answer **all** of the questions below.
+ * Provide lots of detail. Too much info is better than not enough.
+
+ Please help us help you by reading the following posts before submitting your report! π
+ * [www.sscce.org](http://www.sscce.org/)
+ * [Smart Questions](http://catb.org/~esr/faqs/smart-questions.html)
+ * [45 GitHub Issues Dos and Don'ts](https://davidwalsh.name/45-github-issues-dos-donts)
+
+ (These posts are focused more on issues/questions, but can still help you write a good proposal).
+
+ You can read [MAINTAINERSHIP.md](https://github.com/Hopding/pdf-lib/blob/master/docs/MAINTAINERSHIP.md) to learn more about how this repo is maintained.
+ - type: textarea
+ attributes:
+ label: Describe your idea
+ description: Clearly describe your idea. How would it improve `pdf-lib`? Include code snippets to demonstrate what an API implementing your proposal could look like. Please provide visualizations (screenshots, diagrams, videos, etc...) if possible.
+ validations:
+ required: true
+ - type: textarea
+ attributes:
+ label: How could this be implemented?
+ description: Clearly describe how your idea could be implemented. Your response should be technical. What specific changes would be required to make this a reality?
+ validations:
+ required: true
+ - type: textarea
+ attributes:
+ label: What problem are you trying to solve?
+ description: Clearly explain the problem your proposal would solve. This might seem redundant in light of the previous question and that's okay.
+ validations:
+ required: true
+ - type: textarea
+ attributes:
+ label: Why does this matter to you?
+ description: Clearly explain why this proposal matters to you. What led you to think of it? Would it help you solve a problem or build a project?
+ validations:
+ required: true
+ - type: textarea
+ attributes:
+ label: Would others find this helpful?
+ description: Is this a niche problem/solution? How many other `pdf-lib` users do you think would benefit from your proposal?
+ validations:
+ required: true
+ - type: dropdown
+ attributes:
+ label: Are you interested in implementing your proposal?
+ multiple: false
+ options:
+ - 'Yes'
+ - 'No'
+ validations:
+ required: true
+ - type: textarea
+ attributes:
+ label: Why are you submitting a proposal?
+ description: Are you looking for somebody to work on this? Do you want to know if it's feasible? Just want to share your ideas & research? Do you want somebody to bounce ideas off of? Or something else?
+ validations:
+ required: true
+ - type: textarea
+ attributes:
+ label: Additional Notes
+ description: |
+ Please provide any additional information or observations here.
+ validations:
+ required: false
diff --git a/.github/ISSUE_TEMPLATE/share.yml b/.github/ISSUE_TEMPLATE/share.yml
new file mode 100644
index 000000000..5ce6f2d52
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/share.yml
@@ -0,0 +1,23 @@
+name: Share What You're Working On β¨
+description: Working on something? Let us know!
+labels: ["in-progress", "needs-triage"]
+body:
+ - type: markdown
+ attributes:
+ value: |
+ Use this form to let other contributors and the `pdf-lib` maintainers know that you're working on something.
+
+ You can read [MAINTAINERSHIP.md](https://github.com/Hopding/pdf-lib/blob/master/docs/MAINTAINERSHIP.md) to learn more about how this repo is maintained.
+ - type: textarea
+ attributes:
+ label: What are you working on?
+ description: Clearly describe what you're working on.
+ validations:
+ required: true
+ - type: textarea
+ attributes:
+ label: Additional Notes
+ description: |
+ Please provide any additional information or observations here.
+ validations:
+ required: false
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
new file mode 100644
index 000000000..0bbb01fd2
--- /dev/null
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,58 @@
+
+
+## What?
+
+
+## Why?
+
+
+## How?
+
+
+## Testing?
+
+
+
+## New Dependencies?
+
+
+## Screenshots
+
+
+## Suggested Reading?
+
+
+## Anything Else?
+
+
+## Checklist
+- [ ] I read [CONTRIBUTING.md](https://github.com/Hopding/pdf-lib/blob/master/docs/CONTRIBUTING.md).
+- [ ] I read [MAINTAINERSHIP.md#pull-requests](https://github.com/Hopding/pdf-lib/blob/master/docs/MAINTAINERSHIP.md#pull-requests).
+- [ ] I added/updated unit tests for my changes.
+- [ ] I added/updated integration tests for my changes.
+- [ ] I [ran the integration tests](https://github.com/Hopding/pdf-lib/blob/master/docs/CONTRIBUTING.md#running-the-integration-tests).
+- [ ] I tested my changes in Node, Deno, and the browser.
+- [ ] I viewed documents produced with my changes in Adobe Acrobat, Foxit Reader, Firefox, and Chrome.
+- [ ] I added/updated doc comments for any new/modified public APIs.
+- [ ] My changes work for both **new** and **existing** PDF files.
+- [ ] I [ran the linter](https://github.com/Hopding/pdf-lib/blob/master/docs/CONTRIBUTING.md#running-the-linter) on my changes.
diff --git a/.github/issue_template.md b/.github/issue_template.md
new file mode 100644
index 000000000..7cdfb2ede
--- /dev/null
+++ b/.github/issue_template.md
@@ -0,0 +1,13 @@
+# π¨β οΈ STOP!!! β οΈπ¨
+
+ππππππππππππππππππππππππππππππππππππππππ
+
+**All new issues must be created from a template: https://github.com/Hopding/pdf-lib/issues/new/choose**
+
+ππππππππππππππππππππππππππππππππππππππππ
+
+* If you create an issue without using a template it will be closed without comment.
+* Do not create an issue if you have a question. Open a [discussion](https://github.com/Hopding/pdf-lib/discussions/new) instead.
+* If none of the templates match what you're looking for, then you should not create an issue. Start a [discussion](https://github.com/Hopding/pdf-lib/discussions/new) instead.
+
+See [MAINTAINERSHIP.md#issues](https://github.com/Hopding/pdf-lib/blob/master/docs/MAINTAINERSHIP.md#issues) for more information.
diff --git a/.github/labeler.yml b/.github/labeler.yml
new file mode 100644
index 000000000..dad70e13d
--- /dev/null
+++ b/.github/labeler.yml
@@ -0,0 +1,4 @@
+
+needs-triage:
+ - '*'
+ - '**/*'
diff --git a/.github/workflows/pr-labeler.yml b/.github/workflows/pr-labeler.yml
new file mode 100644
index 000000000..6dcefa34b
--- /dev/null
+++ b/.github/workflows/pr-labeler.yml
@@ -0,0 +1,13 @@
+# Uses https://github.com/marketplace/actions/labeler
+
+name: "Pull Request Labeler"
+on:
+- pull_request_target
+
+jobs:
+ triage:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/labeler@v3
+ with:
+ repo-token: "${{ secrets.GITHUB_TOKEN }}"
diff --git a/.github/workflows/sponsors.yml b/.github/workflows/sponsors.yml
new file mode 100644
index 000000000..eb790d72e
--- /dev/null
+++ b/.github/workflows/sponsors.yml
@@ -0,0 +1,16 @@
+# Uses https://github.com/marketplace/actions/sponsor-labels
+
+name: Label sponsors
+on:
+ pull_request:
+ types: [opened]
+ issues:
+ types: [opened]
+jobs:
+ build:
+ name: is-sponsor-label
+ runs-on: ubuntu-latest
+ steps:
+ - uses: JasonEtco/is-sponsor-label-action@v1
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml
new file mode 100644
index 000000000..7b01ec0de
--- /dev/null
+++ b/.github/workflows/stale.yml
@@ -0,0 +1,36 @@
+# Uses https://github.com/marketplace/actions/close-stale-issues
+
+name: 'Close stale issues and PRs'
+on:
+ workflow_dispatch:
+ schedule:
+ - cron: '30 1 * * *' # Every day at 1:30 AM
+
+permissions:
+ issues: write
+ pull-requests: write
+
+jobs:
+ stale:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/stale@v4
+ with:
+ debug-only: false
+
+ exempt-issue-labels: 'high-impact-bug,in-progress,needs-triage,not-stale'
+ exempt-pr-labels: 'not-stale,needs-triage'
+
+ stale-issue-label: 'stale'
+ stale-pr-label: 'stale'
+
+ stale-issue-message: 'This issue is stale because it has been open 2 weeks with no activity. It will be closed in 2 days unless there is new activity. See [MAINTAINERSHIP.md#issues](https://github.com/Hopding/pdf-lib/blob/master/docs/MAINTAINERSHIP.md#issues) for details.'
+ stale-pr-message: 'This PR is stale because it has been open 3 weeks with no activity. It will be be closed in 2 days unless there is new activity. See [MAINTAINERSHIP.md#pull-requests](https://github.com/Hopding/pdf-lib/blob/master/docs/MAINTAINERSHIP.md#pull-requests) for details.'
+ close-issue-message: 'This issue was closed because it went 2 weeks with no activity. Feel free to leave a comment if you feel it should be reopened!'
+ close-pr-message: 'This PR was closed because it went 3 weeks with no activity. Feel free to leave a comment if you feel it should be reopened!'
+
+ days-before-issue-stale: 14
+ days-before-pr-stale: 21
+ days-before-issue-close: 2
+ days-before-pr-close: 2
+
diff --git a/.gitignore b/.gitignore
index 2b12fa619..7b6199b96 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,19 @@
+scratchpad/build/
+apps/node-build/
node_modules/
+coverage/
+ts3.4/
build/
dist/
cjs/
es/
-tsBuildInfo.json
\ No newline at end of file
+tsBuildInfo.json
+flamegraph.html
+yarn-error.log
+isolate*.log
+.DS_Store
+out.pdf
+*.tgz
+
+.vscode/settings.json
\ No newline at end of file
diff --git a/.vscode/launch.json b/.vscode/launch.json
new file mode 100644
index 000000000..0bcb80362
--- /dev/null
+++ b/.vscode/launch.json
@@ -0,0 +1,15 @@
+{
+ // Use IntelliSense to learn about possible attributes.
+ // Hover to view descriptions of existing attributes.
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
+ "version": "0.2.0",
+ "configurations": [
+ {
+ "type": "node",
+ "request": "launch",
+ "name": "Launch Program",
+ "program": "${workspaceFolder}/scratchpad/build/scratchpad/index.js",
+ "outFiles": ["${workspaceFolder}/**/*.js"]
+ }
+ ]
+}
diff --git a/GUIDELINES.md b/GUIDELINES.md
deleted file mode 100644
index 43769d56c..000000000
--- a/GUIDELINES.md
+++ /dev/null
@@ -1 +0,0 @@
-* Do not use `for .. of` loops.
\ No newline at end of file
diff --git a/LICENSE.md b/LICENSE.md
new file mode 100644
index 000000000..7a237e68e
--- /dev/null
+++ b/LICENSE.md
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2019 Andrew Dillon
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/README.md b/README.md
new file mode 100644
index 000000000..02c9bed4e
--- /dev/null
+++ b/README.md
@@ -0,0 +1,1504 @@
+
+
+
+
+
+
+