https://github.com/qq15725/modern-pdf
🚀 Generate PDF in a way that describes the DOM.
https://github.com/qq15725/modern-pdf
jspdf pdf pdf-generation pdf-generator pdfkit
Last synced: 4 months ago
JSON representation
🚀 Generate PDF in a way that describes the DOM.
- Host: GitHub
- URL: https://github.com/qq15725/modern-pdf
- Owner: qq15725
- License: mit
- Created: 2024-01-03T07:18:33.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-03-12T09:25:27.000Z (over 1 year ago)
- Last Synced: 2024-04-23T21:22:42.746Z (about 1 year ago)
- Topics: jspdf, pdf, pdf-generation, pdf-generator, pdfkit
- Language: TypeScript
- Homepage:
- Size: 525 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
modern-pdf
## Usage
```ts
import { PDF } from 'modern-pdf'const pdf = new PDF({
// meta: {
// colorSpace: 'cmyk',
// },
children: [
{
name: 'page1',
style: { width: 300, height: 600 },
children: [
{
style: { rotate: 60, width: 50, height: 50 },
image: '/assets/test.jpg',
},
{
style: { rotate: 40, left: 100, top: 100, fontSize: 20, color: '#FF00FF' },
text: 'test',
},
{
style: { left: 200, top: 100, width: 100, height: 200, fontSize: 22 },
text: [
{
letterSpacing: 3,
fragments: [
{ content: 'He', color: '#00FF00', fontSize: 12 },
{ content: 'llo', color: '#000000' },
],
},
{ content: ', ', color: '#FF0000' },
{ content: 'World!', color: '#0000FF' },
],
},
],
},
],
})pdf.save('download.pdf')
```