cpdf-source/docsplits/javascriptsplits/c00.tex

47 lines
1.1 KiB
TeX
Raw Normal View History

2022-08-10 20:07:58 +02:00
// CHAPTER -1: Introduction
2022-05-20 16:48:24 +02:00
2022-08-16 15:53:19 +02:00
/**
2022-08-10 20:07:58 +02:00
Use
---
2022-05-20 16:48:24 +02:00
2022-08-17 17:13:08 +02:00
coherentpdf.js can be used from both node and the browser.
2022-05-20 16:48:24 +02:00
2022-08-17 17:13:08 +02:00
The file `cpdflibtest.js` uses every function in coherentpdf.js. Call `./run`
to run it in node.
2022-05-20 16:48:24 +02:00
2022-08-17 17:13:08 +02:00
For development server-side with node: `coherentpdf.js` (minified version
`coherentpdf.min.js`). Load with `const coherentpdf = require('coherentpdf')`
if installed in npm, or `const coherentpdf = require('./coherentpdf.js')` to
load from current directory.
For development client-side with the browser : `coherentpdf.browser.js`
(minified version for deployment : `coherentpdf.browser.min.js`). Load with
`<script src="coherentpdf.browser.js"></script>` or similar.
2022-05-20 16:48:24 +02:00
Data types
2022-08-10 20:07:58 +02:00
----------
2022-05-20 16:48:24 +02:00
2022-08-10 20:07:58 +02:00
Arguments are numbers, strings, or arrays (of type UInt8Array for data). Page
ranges are represented by arrays of numbers.
2022-05-20 16:48:24 +02:00
Memory Management
2022-08-10 20:07:58 +02:00
-----------------
2022-05-20 16:48:24 +02:00
2022-08-10 20:07:58 +02:00
A PDF p must be explicitly deallocated with deletePdf(p).
2022-05-20 16:48:24 +02:00
Errors
2022-08-10 20:07:58 +02:00
------
2022-05-20 16:48:24 +02:00
Any function may raise an exception, containing a string describing the problem.
2022-08-16 15:53:19 +02:00
Concurrency
-----------
2022-08-17 17:13:08 +02:00
coherentpdf.js is synchronous and non-re-entrant. In the browser, best used in a worker.
2022-08-16 15:53:19 +02:00
**/