From b4bcc37f03b6a46f7d75ab66b4a0ee49276c5423 Mon Sep 17 00:00:00 2001 From: Priestch Date: Sat, 28 Oct 2023 16:24:45 +0800 Subject: [PATCH] docs: inline all learned knowledge --- docs/.vitepress/theme/custom.css | 12 ++++---- docs/learned-knowledge/app-options.md | 25 ---------------- docs/learned-knowledge/index.md | 23 +++++++++----- docs/learned-knowledge/parts/app-options.md | 30 +++++++++++++++++++ .../{ => parts}/application.md | 2 -- docs/learned-knowledge/parts/events.md | 1 + 6 files changed, 53 insertions(+), 40 deletions(-) delete mode 100644 docs/learned-knowledge/app-options.md create mode 100644 docs/learned-knowledge/parts/app-options.md rename docs/learned-knowledge/{ => parts}/application.md (86%) create mode 100644 docs/learned-knowledge/parts/events.md diff --git a/docs/.vitepress/theme/custom.css b/docs/.vitepress/theme/custom.css index 72c57cd..42ed54e 100644 --- a/docs/.vitepress/theme/custom.css +++ b/docs/.vitepress/theme/custom.css @@ -1,6 +1,6 @@ -:root { - --vp-c-brand-1: var(--vp-c-green-1); - --vp-c-brand-2: var(--vp-c-green-2); - --vp-c-brand-3: var(--vp-c-green-3); - --vp-c-brand-soft: var(--vp-c-green-soft); -} +/*:root {*/ +/* --vp-c-brand-1: var(--vp-c-green-1);*/ +/* --vp-c-brand-2: var(--vp-c-green-2);*/ +/* --vp-c-brand-3: var(--vp-c-green-3);*/ +/* --vp-c-brand-soft: var(--vp-c-green-soft);*/ +/*}*/ diff --git a/docs/learned-knowledge/app-options.md b/docs/learned-knowledge/app-options.md deleted file mode 100644 index 206fc94..0000000 --- a/docs/learned-knowledge/app-options.md +++ /dev/null @@ -1,25 +0,0 @@ -# AppOptions - -There are dozens of times options in PDF.js, and they all belong to four kinds for now. You may wonder why there are so many options, and what they mean at the first time. This document will help you to understand them. - -Let's crack on them one by one! - -### defaultUrl - -- Type `URL | string | Uint8Array` - -The url of the document. - -### [Kinds](https://github.com/mozilla/pdf.js/blob/34506f8874ce86ea21b9db54d0552947208bf4bb/web/app_options.js#L43) - -- VIEWER -- API -- WORKER -- PREFERENCE - -### Options You may need to know - -- `defaultUrl` -- `locale` -- `workerSrc` -- `sandboxBundleSrc` diff --git a/docs/learned-knowledge/index.md b/docs/learned-knowledge/index.md index d72f36a..ed2067a 100644 --- a/docs/learned-knowledge/index.md +++ b/docs/learned-knowledge/index.md @@ -6,24 +6,33 @@ > > All these are what I learned from the PDF.js project. It may not be accurate, but I hope it can help you to understand the PDF.js better. -## Table of Contents +# Table of Contents -### Background Introduction +[[toc]] + +## Background Introduction [PDF.js](https://github.com/mozilla/pdf.js) is an OSS project supported by Mozilla and developed using HTML5, It's goal is to create a general-purpose, web standards-based platform for rendering PDFs in the **Firefox browser**. Many people find out that it's hard to integrate it into project, it's [somehow intentionally](#issues-talked-about-why-it-s-hard-to-integrate). It's not developed as a component or library you can easily integrate like most npm packages, because it's primary goal is to be used easily in **Firefox browser**, the goal doesn't match most developers expectations. -It's the trade-off decision made by the maintainers, we should respect it. +It's the trade-off decision made by the maintainers, we should understand it. -### Issues talked about why it's not easy to integrate +#### Issues talked about why it's not easy to integrate - [Issue 5609](https://github.com/mozilla/pdf.js/issues/5609#issuecomment-68530552) - [Issue 9210](https://github.com/mozilla/pdf.js/issues/9210#issuecomment-347834276) - [Issue 7203](https://github.com/mozilla/pdf.js/issues/7203#issuecomment-210510569) -## The Terms +## PDFViewerApplication + + + +## AppOptions + + + +## Import Events -- [AppOptions](./app-options) -- [PDFViewerApplication](./application) + diff --git a/docs/learned-knowledge/parts/app-options.md b/docs/learned-knowledge/parts/app-options.md new file mode 100644 index 0000000..e06c858 --- /dev/null +++ b/docs/learned-knowledge/parts/app-options.md @@ -0,0 +1,30 @@ +There are dozens of times options in PDF.js, and they all belong to four kinds for now. You may wonder why there are so many options, and what they mean at the first time. This document will help you to understand them. + +Let's crack on them one by one! + +### [Option Kinds](https://github.com/mozilla/pdf.js/blob/34506f8874ce86ea21b9db54d0552947208bf4bb/web/app_options.js#L43) + +- VIEWER +- API +- WORKER +- PREFERENCE + +### Important options + +- `defaultUrl` +- `locale` +- `workerSrc` +- `sandboxBundleSrc` + +#### defaultUrl + +- Type `URL | string | Uint8Array` + +The url of the PDF file. If you got [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) issue when loading a PDF file from a different origin, see details at [origin match error](../pitfalls#origin-not-match) section in common pitfalls page . + +#### locale + +- Type `string` +- Default `en-US` + +The locale of the viewer, it easy to switch a different locale by setting this option. See all supported locales in folder [l10n](https://github.com/mozilla/pdf.js/tree/master/l10n). diff --git a/docs/learned-knowledge/application.md b/docs/learned-knowledge/parts/application.md similarity index 86% rename from docs/learned-knowledge/application.md rename to docs/learned-knowledge/parts/application.md index 3fb37c1..bc62934 100644 --- a/docs/learned-knowledge/application.md +++ b/docs/learned-knowledge/parts/application.md @@ -1,4 +1,2 @@ -# PDFViewerApplication - The global `PDFViewerApplication` object is the entry of the default viewer of PDF.js, it glues all the modules together, and provides the API for the user. diff --git a/docs/learned-knowledge/parts/events.md b/docs/learned-knowledge/parts/events.md new file mode 100644 index 0000000..a2ba289 --- /dev/null +++ b/docs/learned-knowledge/parts/events.md @@ -0,0 +1 @@ +#### `documentinit`