Skip to content

coherentgraphics/coherentpdf.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

c9acf08 · Jul 23, 2024
May 10, 2024
May 5, 2024
May 10, 2024
Apr 24, 2022
May 12, 2022
May 10, 2024
Aug 11, 2022
Apr 12, 2024
May 12, 2014
Jul 23, 2024
Apr 12, 2024
Apr 12, 2024
May 10, 2024
Jun 7, 2022
May 10, 2024
Aug 17, 2022
May 10, 2024
Aug 17, 2022
Aug 12, 2022
Apr 24, 2022
Jun 30, 2022
Aug 17, 2022
May 8, 2024
May 8, 2024
Apr 11, 2022
Apr 11, 2022
Aug 17, 2022
Jun 23, 2022
Aug 17, 2022
Jun 20, 2022
Aug 17, 2022
Aug 17, 2022
Aug 12, 2022
Jun 20, 2022
May 10, 2024

Repository files navigation

coherentpdf.js

A JavaScript library for editing PDF files. For example:

  • Quality Split and Merge, keeping bookmarks. Extract pages. Split on Bookmarks.
  • Impose files n-up
  • Create new PDFs. Convert text files to PDF
  • Losslessly squeeze files to reduce their size
  • Encrypt and Decrypt (including AES 128 and AES 256 encryption)
  • Read and set info and metadata from a PDF file. Set and read XMP Metadata.
  • Scale, rotate, crop and flip pages. Scale pages to fit.
  • Copy, Remove and Add bookmarks. Build table of contents from bookmarks.
  • Stamp logos, shapes, watermarks, page numbers and multiline text. Transparency.
  • List, copy or remove annotations
  • Add and remove file attachments to document or page. Extract attachments.
  • Thicken hairlines, blacken text, make draft documents
  • Reconstruct malformed files
  • Detect missing fonts, low resolution images. Remove images. Extract images.
  • Add printer's marks
  • Add, modify, remove, or print page labels.
  • Export PDF file to / Import PDF file from JSON.
  • Manipulate optional content groups

coherentpdf.js is distributed under the AGPL - see LICENSE.md. If you are unable to abide by the terms of the AGPL, you will need a commercial license.

https://www.coherentpdf.com/

For commercial licenses, email [email protected]

Use

coherentpdf.js can be used from both node and the browser.

The file cpdflibtest.js uses every function in coherentpdf.js. Call ./run to run it in node.

In the dist/ directory:

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.

Documentation

  1. cpdfjsmanual.pdf contains the API documentation interleaved with the coherentpdf.js API. This is the primary source of documentation:

    https://coherentpdf.com/cpdfjsmanual.pdf

    The command line tools can be found at:

    https://community.coherentpdf.com/

  2. API documentation online at

    https://www.coherentpdf.com/jscpdf/index.html

Data types

Arguments are numbers, strings, or arrays (of type UInt8Array for data). Page ranges are represented by arrays of numbers.

Memory Management

A PDF p must be explicitly deallocated with deletePdf(p).

Errors

Any function may raise an exception, containing a string describing the problem.

Concurrency

coherentpdf.js is synchronous and non-re-entrant. In the browser, best used in a worker.

Examples

Server-side: cpdflibtest.js tests every function in coherentpdf.js.

Client-side: index.html is an interactive browser example with the worker cpdfworker.js. You will need to run this from a real server, for example http-server, rather than just loading index.html directly.

Contact

https://www.coherentpdf.com/

For commercial licenses, email [email protected]

About

JavaScript PDF manipulation library derived from CPDF

Resources

License

Stars

Watchers

Forks

Packages

No packages published