Skip to content

Commit

Permalink
docs: inline all learned knowledge
Browse files Browse the repository at this point in the history
  • Loading branch information
Priestch committed Oct 28, 2023
1 parent 53d100c commit b4bcc37
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 40 deletions.
12 changes: 6 additions & 6 deletions docs/.vitepress/theme/custom.css
Original file line number Diff line number Diff line change
@@ -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);*/
/*}*/
25 changes: 0 additions & 25 deletions docs/learned-knowledge/app-options.md

This file was deleted.

23 changes: 16 additions & 7 deletions docs/learned-knowledge/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

<!--@include: ./parts/application.md-->

## AppOptions

<!--@include: ./parts/app-options.md-->

## Import Events

- [AppOptions](./app-options)
- [PDFViewerApplication](./application)
<!--@include: ./parts/events.md-->
30 changes: 30 additions & 0 deletions docs/learned-knowledge/parts/app-options.md
Original file line number Diff line number Diff line change
@@ -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).
Original file line number Diff line number Diff line change
@@ -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.
1 change: 1 addition & 0 deletions docs/learned-knowledge/parts/events.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#### `documentinit`

0 comments on commit b4bcc37

Please sign in to comment.