14 |
15 | #### Preview
16 |
17 | A simple function to compile a React component to an HTML string with the Onedoc print styles.
18 | ```jsx
19 | const html = await compile();
20 | ```
21 |
22 |
23 |
24 |
14 |
15 | #### Preview
16 |
17 | Set the page ratio and margin sizes in px. You can also use the `@page` at-rule in CSS to manage all aspects of printed pages. More on this [here](https://developer.mozilla.org/en-US/docs/Web/CSS/@page).
18 |
19 |
20 |
21 |
51 |
52 | ### Examples
53 |
54 |
--------------------------------------------------------------------------------
/docs/components/footnote/footnote.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: Footnote
3 |
4 |
5 | ---
6 |
7 | Creates an automatically numbered footnote. This will remove the footnote content from the document flow and place it at the bottom of the page.
8 |
9 | Support
10 |
11 |
27 | This is a footnote to explaning what CSS{" "}
28 |
29 | CSS is the acronym of “Cascading Style Sheets”. CSS is a computer language
30 | for laying out and structuring web pages (HTML or XML).
31 | {" "}
32 | is.
33 |
85 |
86 |
--------------------------------------------------------------------------------
/docs/components/shell/currentpagetop.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: CurrentPageTop
3 |
4 |
5 | ---
6 |
7 | Displays content in the top of the current page.
8 |
9 | This component will override the content of the `PageTop` component for the current page.
10 |
11 | Support
12 |
13 |
51 |
52 | ### Examples
53 |
54 |
--------------------------------------------------------------------------------
/docs/components/shell/pagetop.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: PageTop
3 |
4 |
5 | ---
6 |
7 | Displays content in the top of all the pages.
8 |
9 | This component should be placed as early as possible in the document and will apply to all subsequent pages.
10 |
11 | Support
12 |
13 |
14 |
15 | #### Preview
16 |
17 | The created fields can be signed as-is in Acrobat Reader or other PDF viewers, using Onedoc's signature API, or through other e-signature services like [DocuSign](https://developers.docusign.com/docs/esign-rest-api/esign101/concepts/tabs/pdf-transform/).
18 |
19 | Supported fields:
20 |
21 | | Field Type | Description |
22 | |------------|-------------|
23 | | signHere | Signature field |
24 | | signHereOptional | Optional signature field |
25 | | signInitialHere | Initials field |
26 | | signInitialHereOptional | Optional initials field |
27 | | company | Company name field |
28 | | dateSigned | Date signed field |
29 | | title | Title field |
30 | | fullName | Full name field |
31 | | lastName | Last name field |
32 | | firstName | First name field |
33 | | emailAddress | Email address field |
34 | | number | Number field |
35 | | date | Date field |
36 | | ssn | Social Security Number field |
37 | | zip5 | ZIP code field |
38 | | zip5dash4 | ZIP code with 4-digit extension field |
39 | | note | Note field |
40 | | list | List field |
41 | | checkbox | Checkbox field |
42 | | radio | Radio button field |
43 | | approve | Approve button field |
44 | | decline | Decline button field |
45 | | view | View button field |
46 | | signerAttachment | Signer attachment field |
47 | | signerAttachmentOptional | Optional signer attachment field |
48 |
49 |
50 |
51 |
47 |
48 | ### Examples
49 |
50 | #### Custom Style
51 |
52 | You can use a custom CSS counter-style, by passing a known name or a custom counter style.
53 |
54 |
55 |
56 |
16 |
17 | #### Preview
18 |
19 | Show the current running header of level 1 in the page header. All running headers are reset when any of their parent headings are encountered (e.g. a level 2 heading resets the level 3, 4, 5 and 6 headings).
20 |
21 |
22 |
23 |
16 |
17 | ```jsx
18 | import { RunningH6 } from "@fileforge/react-print";
19 | ```
20 |
21 |
--------------------------------------------------------------------------------
/docs/contributing.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: 'Contributing'
3 | sidebarTitle: 'Contributing'
4 | description: 'Wanna help? Awesome! There are many ways you can contribute.'
5 | icon: 'fa-solid fa-code-pull-request'
6 | ---
7 |
8 | ## Improving the docs
9 |
10 | Documentation is extremely important and takes a fair deal of time and effort to write and keep updated. Everything is written in [Markdown](https://www.markdownguide.org/) to facilitate the process of contributing.
11 |
12 |
17 |
18 |
19 | }>
20 |
21 | ## Docs Setup Guide
22 |
23 | 1. Clone the repository:
24 |
25 | ```sh
26 | git clone https://github.com/fileforge/react-print-pdf
27 | ```
28 |
29 | 2. Install all dependencies:
30 |
31 | ```sh
32 | pnpm install
33 | ```
34 |
35 | 3. Run local servers and watch for changes:
36 |
37 | ```sh
38 | pnpm dev
39 | ```
40 |
41 | 4. Make your changes under the `/docs` folder and see a live preview at [localhost:3000](http://localhost:3000).
42 |
43 | 5. Submit a pull request.
44 |
45 |
46 |
47 | ## Building new components
48 |
49 | We're open to expanding the catalog of components to cover as many use cases as possible. We suggest to open an issue for discussion first to make sure your idea is aligned with the project goals.
50 |
51 |
56 |
57 |
58 | }>
59 |
60 | ## Components Setup Guide
61 |
62 | 1. Clone the repository:
63 |
64 | ```sh
65 | git clone https://github.com/fileforge/react-print-pdf
66 | ```
67 |
68 | 2. Install pip2pic dependencies:
69 |
70 | ```sh
71 | brew update
72 | brew install gs graphicsmagick
73 | ```
74 |
75 | 3. Install pip2pic:
76 |
77 | ```sh
78 | npm install pdf2pic
79 | ```
80 |
81 | 4. Install all dependencies:
82 |
83 | ```sh
84 | pnpm install
85 | ```
86 |
87 | 5. Run local servers and watch for changes:
88 |
89 | ```sh
90 | pnpm dev
91 | ```
92 |
93 | 6. Add a new folder under `src` and build your component.
94 |
95 | 7. Don't forget to add tests.
96 |
97 | 8. Submit a pull request.
98 |
99 |
100 |
101 | ## Opening issues
102 |
103 | Open an issue to report bugs or to propose new features.
104 |
105 | - **Reporting bugs**: describe the bug as clearly as you can, including steps to reproduce, what happened and what you were expecting to happen. Also include browser version, OS and other related software's (npm, Node.js, etc) versions when applicable.
106 |
107 | - **Suggesting features**: explain the proposed feature, what it should do, why it is useful, how users should use it. Give us as much info as possible so it will be easier to discuss, access and implement the proposed feature. When you're unsure about a certain aspect of the feature, feel free to leave it open for others to discuss and find an appropriate solution.
108 |
109 | ## Proposing pull requests
110 |
111 | Pull requests are very welcome. Note that if you are going to propose drastic changes, be sure to open an issue for discussion first, to make sure that your PR will be accepted before you spend effort coding it.
112 |
113 | - **Forking the repository**: clone it locally and create a branch for your proposed bug fix or new feature. Avoid working directly on the main branch.
114 |
115 | - **Making changes**: implement your bug fix or feature, write tests to cover it and make sure all tests are passing. Then commit your changes, push your bug fix/feature branch to the origin (your forked repo) and open a pull request to the upstream (the repository you originally forked)'s main branch.
--------------------------------------------------------------------------------
/docs/development.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: 'Development'
3 | description: 'Learn how to preview changes locally'
4 | ---
5 |
6 |
7 | **Prerequisite** You should have installed Node.js (version 18.10.0 or
8 | higher).
9 |
10 |
11 | Step 1. Install Mintlify on your OS:
12 |
13 |
14 |
15 | ```bash npm
16 | npm i -g mintlify
17 | ```
18 |
19 | ```bash yarn
20 | yarn global add mintlify
21 | ```
22 |
23 |
24 |
25 | Step 2. Go to the docs are located (where you can find `mint.json`) and run the following command:
26 |
27 | ```bash
28 | mintlify dev
29 | ```
30 |
31 | The documentation website is now available at `http://localhost:3000`.
32 |
33 | ### Custom Ports
34 |
35 | Mintlify uses port 3000 by default. You can use the `--port` flag to customize the port Mintlify runs on. For example, use this command to run in port 3333:
36 |
37 | ```bash
38 | mintlify dev --port 3333
39 | ```
40 |
41 | You will see an error like this if you try to run Mintlify in a port that's already taken:
42 |
43 | ```md
44 | Error: listen EADDRINUSE: address already in use :::3000
45 | ```
46 |
47 | ## Mintlify Versions
48 |
49 | Each CLI is linked to a specific version of Mintlify. Please update the CLI if your local website looks different than production.
50 |
51 |
52 |
53 | ```bash npm
54 | npm i -g mintlify@latest
55 | ```
56 |
57 | ```bash yarn
58 | yarn global upgrade mintlify
59 | ```
60 |
61 |
62 |
63 | ## Deployment
64 |
65 |
66 | Unlimited editors available under the [Startup
67 | Plan](https://mintlify.com/pricing)
68 |
69 |
70 | You should see the following if the deploy successfully went through:
71 |
72 |
73 |
74 |
75 |
76 | ## Troubleshooting
77 |
78 | Here's how to solve some common problems when working with the CLI.
79 |
80 |
81 |
82 | Update to Node v18. Run `mintlify install` and try again.
83 |
84 |
85 | Go to the `C:/Users/Username/.mintlify/` directory and remove the `mint`
86 | folder. Then Open the Git Bash in this location and run `git clone
87 | https://github.com/mintlify/mint.git`.
88 |
89 | Repeat step 3.
90 |
91 |
92 |
93 | Try navigating to the root of your device and delete the ~/.mintlify folder.
94 | Then run `mintlify dev` again.
95 |
96 |
97 |
98 | Curious about what changed in a CLI version? [Check out the CLI changelog.](/changelog/command-line)
99 |
--------------------------------------------------------------------------------
/docs/essentials/code.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: 'Code Blocks'
3 | description: 'Display inline code and code blocks'
4 | icon: 'code'
5 | ---
6 |
7 | ## Basic
8 |
9 | ### Inline Code
10 |
11 | To denote a `word` or `phrase` as code, enclose it in backticks (`).
12 |
13 | ```
14 | To denote a `word` or `phrase` as code, enclose it in backticks (`).
15 | ```
16 |
17 | ### Code Block
18 |
19 | Use [fenced code blocks](https://www.markdownguide.org/extended-syntax/#fenced-code-blocks) by enclosing code in three backticks and follow the leading ticks with the programming language of your snippet to get syntax highlighting. Optionally, you can also write the name of your code after the programming language.
20 |
21 | ```java HelloWorld.java
22 | class HelloWorld {
23 | public static void main(String[] args) {
24 | System.out.println("Hello, World!");
25 | }
26 | }
27 | ```
28 |
29 | ````md
30 | ```java HelloWorld.java
31 | class HelloWorld {
32 | public static void main(String[] args) {
33 | System.out.println("Hello, World!");
34 | }
35 | }
36 | ```
37 | ````
38 |
--------------------------------------------------------------------------------
/docs/essentials/images.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: 'Images and Embeds'
3 | description: 'Add image, video, and other HTML elements'
4 | icon: 'image'
5 | ---
6 |
7 |
11 |
12 | ## Image
13 |
14 | ### Using Markdown
15 |
16 | The [markdown syntax](https://www.markdownguide.org/basic-syntax/#images) lets you add images using the following code
17 |
18 | ```md
19 | 
20 | ```
21 |
22 | Note that the image file size must be less than 5MB. Otherwise, we recommend hosting on a service like [Cloudinary](https://cloudinary.com/) or [S3](https://aws.amazon.com/s3/). You can then use that URL and embed.
23 |
24 | ### Using Embeds
25 |
26 | To get more customizability with images, you can also use [embeds](/writing-content/embed) to add images
27 |
28 | ```html
29 |
30 | ```
31 |
32 | ## Embeds and HTML elements
33 |
34 |
44 |
45 |
46 |
47 |
48 |
49 | Mintlify supports [HTML tags in Markdown](https://www.markdownguide.org/basic-syntax/#html). This is helpful if you prefer HTML tags to Markdown syntax, and lets you create documentation with infinite flexibility.
50 |
51 |
52 |
53 | ### iFrames
54 |
55 | Loads another HTML page within the document. Most commonly used for embedding videos.
56 |
57 | ```html
58 |
59 | ```
60 |
--------------------------------------------------------------------------------
/docs/essentials/markdown.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: 'Markdown Syntax'
3 | description: 'Text, title, and styling in standard markdown'
4 | icon: 'text-size'
5 | ---
6 |
7 | ## Titles
8 |
9 | Best used for section headers.
10 |
11 | ```md
12 | ## Titles
13 | ```
14 |
15 | ### Subtitles
16 |
17 | Best use to subsection headers.
18 |
19 | ```md
20 | ### Subtitles
21 | ```
22 |
23 |
24 |
25 | Each **title** and **subtitle** creates an anchor and also shows up on the table of contents on the right.
26 |
27 |
28 |
29 | ## Text Formatting
30 |
31 | We support most markdown formatting. Simply add `**`, `_`, or `~` around text to format it.
32 |
33 | | Style | How to write it | Result |
34 | | ------------- | ----------------- | --------------- |
35 | | Bold | `**bold**` | **bold** |
36 | | Italic | `_italic_` | _italic_ |
37 | | Strikethrough | `~strikethrough~` | ~strikethrough~ |
38 |
39 | You can combine these. For example, write `**_bold and italic_**` to get **_bold and italic_** text.
40 |
41 | You need to use HTML to write superscript and subscript text. That is, add `` or `` around your text.
42 |
43 | | Text Size | How to write it | Result |
44 | | ----------- | ------------------------ | ---------------------- |
45 | | Superscript | `superscript` | superscript |
46 | | Subscript | `subscript` | subscript |
47 |
48 | ## Linking to Pages
49 |
50 | You can add a link by wrapping text in `[]()`. You would write `[link to google](https://google.com)` to [link to google](https://google.com).
51 |
52 | Links to pages in your docs need to be root-relative. Basically, you should include the entire folder path. For example, `[link to text](/writing-content/text)` links to the page "Text" in our components section.
53 |
54 | Relative links like `[link to text](../text)` will open slower because we cannot optimize them as easily.
55 |
56 | ## Blockquotes
57 |
58 | ### Singleline
59 |
60 | To create a blockquote, add a `>` in front of a paragraph.
61 |
62 | > Dorothy followed her through many of the beautiful rooms in her castle.
63 |
64 | ```md
65 | > Dorothy followed her through many of the beautiful rooms in her castle.
66 | ```
67 |
68 | ### Multiline
69 |
70 | > Dorothy followed her through many of the beautiful rooms in her castle.
71 | >
72 | > The Witch bade her clean the pots and kettles and sweep the floor and keep the fire fed with wood.
73 |
74 | ```md
75 | > Dorothy followed her through many of the beautiful rooms in her castle.
76 | >
77 | > The Witch bade her clean the pots and kettles and sweep the floor and keep the fire fed with wood.
78 | ```
79 |
80 | ### LaTeX
81 |
82 | Mintlify supports [LaTeX](https://www.latex-project.org) through the Latex component.
83 |
84 | 8 x (vk x H1 - H2) = (0,1)
85 |
86 | ```md
87 | 8 x (vk x H1 - H2) = (0,1)
88 | ```
89 |
--------------------------------------------------------------------------------
/docs/essentials/navigation.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: 'Navigation'
3 | description: 'The navigation field in mint.json defines the pages that go in the navigation menu'
4 | icon: 'map'
5 | ---
6 |
7 | The navigation menu is the list of links on every website.
8 |
9 | You will likely update `mint.json` every time you add a new page. Pages do not show up automatically.
10 |
11 | ## Navigation syntax
12 |
13 | Our navigation syntax is recursive which means you can make nested navigation groups. You don't need to include `.mdx` in page names.
14 |
15 |
16 |
17 | ```json Regular Navigation
18 | "navigation": [
19 | {
20 | "group": "Getting Started",
21 | "pages": ["quickstart"]
22 | }
23 | ]
24 | ```
25 |
26 | ```json Nested Navigation
27 | "navigation": [
28 | {
29 | "group": "Getting Started",
30 | "pages": [
31 | "quickstart",
32 | {
33 | "group": "Nested Reference Pages",
34 | "pages": ["nested-reference-page"]
35 | }
36 | ]
37 | }
38 | ]
39 | ```
40 |
41 |
42 |
43 | ## Folders
44 |
45 | Simply put your MDX files in folders and update the paths in `mint.json`.
46 |
47 | For example, to have a page at `https://yoursite.com/your-folder/your-page` you would make a folder called `your-folder` containing an MDX file called `your-page.mdx`.
48 |
49 |
50 |
51 | You cannot use `api` for the name of a folder unless you nest it inside another folder. Mintlify uses Next.js which reserves the top-level `api` folder for internal server calls. A folder name such as `api-reference` would be accepted.
52 |
53 |
54 |
55 | ```json Navigation With Folder
56 | "navigation": [
57 | {
58 | "group": "Group Name",
59 | "pages": ["your-folder/your-page"]
60 | }
61 | ]
62 | ```
63 |
64 | ## Hidden Pages
65 |
66 | MDX files not included in `mint.json` will not show up in the sidebar but are accessible through the search bar and by linking directly to them.
67 |
--------------------------------------------------------------------------------
/docs/essentials/reusable-snippets.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: Reusable Snippets
3 | description: Reusable, custom snippets to keep content in sync
4 | icon: 'recycle'
5 | ---
6 |
7 | import SnippetIntro from '/snippets/snippet-intro.mdx';
8 |
9 |
10 |
11 | ## Creating a custom snippet
12 |
13 | **Pre-condition**: You must create your snippet file in the `snippets` directory.
14 |
15 |
16 | Any page in the `snippets` directory will be treated as a snippet and will not
17 | be rendered into a standalone page. If you want to create a standalone page
18 | from the snippet, import the snippet into another file and call it as a
19 | component.
20 |
21 |
22 | ### Default export
23 |
24 | 1. Add content to your snippet file that you want to re-use across multiple
25 | locations. Optionally, you can add variables that can be filled in via props
26 | when you import the snippet.
27 |
28 | ```mdx snippets/my-snippet.mdx
29 | Hello world! This is my content I want to reuse across pages. My keyword of the
30 | day is {word}.
31 | ```
32 |
33 |
34 | The content that you want to reuse must be inside the `snippets` directory in
35 | order for the import to work.
36 |
37 |
38 | 2. Import the snippet into your destination file.
39 |
40 | ```mdx destination-file.mdx
41 | ---
42 | title: My title
43 | description: My Description
44 | ---
45 |
46 | import MySnippet from '/snippets/path/to/my-snippet.mdx';
47 |
48 | ## Header
49 |
50 | Lorem impsum dolor sit amet.
51 |
52 |
53 | ```
54 |
55 | ### Reusable variables
56 |
57 | 1. Export a variable from your snippet file:
58 |
59 | ```mdx snippets/path/to/custom-variables.mdx
60 | export const myName = 'my name';
61 |
62 | export const myObject = { fruit: 'strawberries' };
63 | ```
64 |
65 | 2. Import the snippet from your destination file and use the variable:
66 |
67 | ```mdx destination-file.mdx
68 | ---
69 | title: My title
70 | description: My Description
71 | ---
72 |
73 | import { myName, myObject } from '/snippets/path/to/custom-variables.mdx';
74 |
75 | Hello, my name is {myName} and I like {myObject.fruit}.
76 | ```
77 |
78 | ### Reusable components
79 |
80 | 1. Inside your snippet file, create a component that takes in props by exporting
81 | your component in the form of an arrow function.
82 |
83 | ```mdx snippets/custom-component.mdx
84 | export const MyComponent = ({ title }) => (
85 |
86 |
{title}
87 |
... snippet content ...
88 |
89 | );
90 | ```
91 |
92 |
93 | MDX does not compile inside the body of an arrow function. Stick to HTML
94 | syntax when you can or use a default export if you need to use MDX.
95 |
96 |
97 | 2. Import the snippet into your destination file and pass in the props
98 |
99 | ```mdx destination-file.mdx
100 | ---
101 | title: My title
102 | description: My Description
103 | ---
104 |
105 | import { MyComponent } from '/snippets/custom-component.mdx';
106 |
107 | Lorem ipsum dolor sit amet.
108 |
109 |
110 | ```
111 |
--------------------------------------------------------------------------------
/docs/favicon.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
17 |
--------------------------------------------------------------------------------
/docs/getting-started/setup.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: "Setup"
3 | sidebarTitle: "Setup"
4 | description: "Create a brand-new folder with packages powered by React Print."
5 | icon: "fa-solid fa-hammer"
6 | ---
7 | # Fast Set Up ⚡️
8 |
9 | Clone this repository ⬇️
10 |
15 | Clone our dev-local repository and follow the instructions in the readMe to get started quickly.
16 |
17 |
18 | 
19 |
20 |
21 | We recommed splitting your editor into two windows, one for the code and the other for the PDF viewing integration.
22 |
23 |
24 | # Manual Set Up 🛠️
25 |
26 | ## 1. Create directory
27 |
28 | Create a new folder called `react-print-starter` and initialize a new npm project
29 |
30 | ```sh
31 | mkdir react-print-starter
32 | cd react-print-starter
33 | npm init -y
34 | ```
35 |
36 | ## 2. Install the dependencies
37 |
38 | Get the react-print package locally
39 |
40 |
41 |
42 | ```sh title="npm"
43 | npm install @fileforge/react-print
44 | ```
45 |
46 | ```sh title="yarn"
47 | yarn add @fileforge/react-print
48 | ```
49 |
50 | ```sh title="pnpm"
51 | pnpm add @fileforge/react-print
52 | ```
53 |
54 |
55 |
56 | ## 3. Create your first PDF Component
57 |
58 | Create a new `documents` folder, then create a new file inside called `index.jsx` and copy the following code:
59 |
60 |
61 | ```jsx document/index.tsx
62 | import { PageTop, PageBottom, PageBreak } from "@fileforge/react-print";
63 | import * as React from "react";
64 |
65 | export const Document = ({ props }) => {
66 | return (
67 |
68 |
69 | Hello #1
70 |
71 |
Hello #2
72 |
73 |
Hello #3
74 |
75 |
76 | Hello #4, but on a new page !
77 |
78 | );
79 | };
80 | ```
81 |
82 | ## 4. Compile your document to HTML
83 |
84 | Back in your parent folder, create a `main.jsx` file that imports your document an renders it using the `compile` function.
85 |
86 | ```js index.tsx
87 | import { compile } from "@fileforge/react-print";
88 | import { Document } from "./document";
89 |
90 | const html = await compile();
91 |
92 | console.log(html);
93 | ```
94 |
95 | ## 5. Generate your document with FileForge
96 |
97 | We recommend generating your PDF using the [FileForge API](/integrations/onedoc), as it is specifically designed to integrate seamlessly with react-print. However, you are welcome to choose any external renderer that better meets your needs.
98 | [How to generate my PDF from my react-print component.](/api-reference/api-reference/generate)
99 |
100 | ## 6. Next steps
101 |
102 | Try to modify your PDF by using our different pre-built components.
103 |
104 |
105 |
106 | A React component to help compile your React code for PDF rendering.
107 |
108 |
109 | {" "}
110 |
111 |
112 | A React component to help you build beautiful foot-notes.
113 |
114 |
115 |
116 | A suite of React components for structured document layout management.
117 |
118 |
119 |
--------------------------------------------------------------------------------
/docs/guides/fonts.mdx:
--------------------------------------------------------------------------------
1 | Fonts work the same way as they would in the browser.
2 |
3 | ## Hosted Webfont
4 |
5 | You can add a link to any hosted webfont stylesheet, such as:
6 |
7 | * Google Fonts or Typekit,
8 | * Self-hosted fonts on an existing website.
9 |
10 | To use these fonts when converting to PDF, you will have to link the stylesheet in your HTML. Given that HTML5 supports `` placement in the `` and ``, you can place the link in either location, or inside your React component.
11 |
12 |
13 |
14 | ```html
15 |
16 |
17 |
18 |
19 |
20 |
23 |
38 | >
39 | )
40 | }
41 | ```
42 |
43 |
44 |
45 | ## Local Webfont
46 |
47 | You can also use local webfonts. To do this, you will need to include the font files as an asset when uploading with the Onedoc SDK. You can then reference the font in your CSS.
48 |
49 | ```css
50 | @font-face {
51 | font-family: 'Roboto';
52 | src: url('Roboto-Regular.ttf') format('truetype');
53 | }
54 | ```
55 |
56 |
57 |
58 | ```ts
59 | const file = ff.pdf.generate([
60 | new File([fs.readFileSync("index.html")], "index.html", {
61 | type: "text/html",
62 | }),
63 | new File([fs.readFileSync("Roboto-Regular.ttf")], "Roboto-Regular.ttf", {
64 | type: "font/ttf",
65 | }),
66 | ], {})
67 | ```
68 |
69 |
70 | ```sh
71 | curl -X POST "https://api.fileforge.com/pdf/generate" \
72 | -H "X-API-Key: YOUR_API_KEY" \
73 | -F "files[]=@index.html;type=text/html" \
74 | -F "files[]=@Roboto-Regular.ttf;type=font/ttf"
75 | ```
76 |
77 |
78 |
--------------------------------------------------------------------------------
/docs/guides/images/toc.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/guides/images/toc.jpg
--------------------------------------------------------------------------------
/docs/guides/references.mdx:
--------------------------------------------------------------------------------
1 | Fileforge's PDF generation API supports rich cross-referencing capabilities. This allows you to create links between different parts of your document, such as linking to a specific section or page.
2 |
3 | ## Cross-linking
4 |
5 | Similarly to HTML, Fileforge automatically parses local links in your document.
6 |
7 | ```html
8 | Go to section 1
9 |
10 | Go to google.com
11 |
12 |
13 |
14 |
15 | ```
16 |
17 | This also works in elements contained in the page shell, such as headers and footers.
18 |
19 |
20 |
21 | ```tsx
22 | const Document = () => {
23 | return <>
24 |
25 | Go to first page
26 |
27 |
28 |
Cover page
29 |
30 | >
31 | }
32 | ```
33 |
34 |
35 |
36 | ## Pointers
37 |
38 | ### Counters
39 |
40 | When adding cross-references to PDFs, you may want to consider their printed page number. Fileforge provides a `page` counter that you can use to reference the page number.
41 |
42 | ```html
43 |
48 |
49 | Section 1
50 |
51 |
52 |
53 |
54 |
55 | ```
56 |
57 | You can also reference custom counters, such as a section number.
58 |
59 | ```html
60 |
77 |
78 | Section 1
79 |
80 |
81 |
82 |
83 |
84 | ```
85 |
86 | ### Names
87 |
88 | You can also use the contents of a target element to reference it. For example, you may want to display `(see "Cover page")` instead of `(see page 1)`.
89 |
90 |
91 | Since the target content will be inlined, we recommend adding the ID to headers rather than sections or divs.
92 |
93 |
94 | ```html
95 |
100 |
101 | Cover page
102 |
103 |
104 |
Cover page
105 |
106 |
107 | ```
108 |
109 | ## Example: Table of Contents
110 |
111 | You can combine the above functionality to build a table of contents that automatically updates with the page numbers.
112 |
113 | ```html
114 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
Introduction
159 |
160 |
This is the first section
161 |
162 |
This is the second section
163 |
164 |
Conclusion
165 | ```
166 |
167 | This will yeld the following table of contents:
168 |
169 |
170 | 
171 |
172 |
--------------------------------------------------------------------------------
/docs/images/background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/background.png
--------------------------------------------------------------------------------
/docs/images/banner-twitter.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/banner-twitter.jpg
--------------------------------------------------------------------------------
/docs/images/checks-passed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/checks-passed.png
--------------------------------------------------------------------------------
/docs/images/example.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/example.png
--------------------------------------------------------------------------------
/docs/images/legacy-vs-react-print.avif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/legacy-vs-react-print.avif
--------------------------------------------------------------------------------
/docs/images/previews/compile-8dbcfb7e/document.1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/compile-8dbcfb7e/document.1.jpg
--------------------------------------------------------------------------------
/docs/images/previews/compile-8dbcfb7e/document.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/compile-8dbcfb7e/document.pdf
--------------------------------------------------------------------------------
/docs/images/previews/compile-f31067dd/document.1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/compile-f31067dd/document.1.jpg
--------------------------------------------------------------------------------
/docs/images/previews/compile-f31067dd/document.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/compile-f31067dd/document.pdf
--------------------------------------------------------------------------------
/docs/images/previews/css-fa74d9a5/document.1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/css-fa74d9a5/document.1.jpg
--------------------------------------------------------------------------------
/docs/images/previews/css-fa74d9a5/document.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/css-fa74d9a5/document.pdf
--------------------------------------------------------------------------------
/docs/images/previews/currentpagetop-2643a477/document.1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/currentpagetop-2643a477/document.1.jpg
--------------------------------------------------------------------------------
/docs/images/previews/currentpagetop-2643a477/document.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/currentpagetop-2643a477/document.pdf
--------------------------------------------------------------------------------
/docs/images/previews/field-8e7a7bcb/document.1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/field-8e7a7bcb/document.1.jpg
--------------------------------------------------------------------------------
/docs/images/previews/field-8e7a7bcb/document.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/field-8e7a7bcb/document.pdf
--------------------------------------------------------------------------------
/docs/images/previews/floatbottom-1c4af231/document.1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/floatbottom-1c4af231/document.1.jpg
--------------------------------------------------------------------------------
/docs/images/previews/floatbottom-1c4af231/document.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/floatbottom-1c4af231/document.pdf
--------------------------------------------------------------------------------
/docs/images/previews/font-0d283416/document.1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/font-0d283416/document.1.jpg
--------------------------------------------------------------------------------
/docs/images/previews/font-0d283416/document.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/font-0d283416/document.pdf
--------------------------------------------------------------------------------
/docs/images/previews/footnote-e49ec577/document.1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/footnote-e49ec577/document.1.jpg
--------------------------------------------------------------------------------
/docs/images/previews/footnote-e49ec577/document.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/footnote-e49ec577/document.pdf
--------------------------------------------------------------------------------
/docs/images/previews/latex-2663e15e/document.1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/latex-2663e15e/document.1.jpg
--------------------------------------------------------------------------------
/docs/images/previews/latex-2663e15e/document.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/latex-2663e15e/document.pdf
--------------------------------------------------------------------------------
/docs/images/previews/latex-c1cd8f84/document.1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/latex-c1cd8f84/document.1.jpg
--------------------------------------------------------------------------------
/docs/images/previews/latex-c1cd8f84/document.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/latex-c1cd8f84/document.pdf
--------------------------------------------------------------------------------
/docs/images/previews/margins-35fa1266/document.1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/margins-35fa1266/document.1.jpg
--------------------------------------------------------------------------------
/docs/images/previews/margins-35fa1266/document.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/margins-35fa1266/document.pdf
--------------------------------------------------------------------------------
/docs/images/previews/markdown-344947c9/document.1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/markdown-344947c9/document.1.jpg
--------------------------------------------------------------------------------
/docs/images/previews/markdown-344947c9/document.2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/markdown-344947c9/document.2.jpg
--------------------------------------------------------------------------------
/docs/images/previews/markdown-344947c9/document.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/markdown-344947c9/document.pdf
--------------------------------------------------------------------------------
/docs/images/previews/markdown-cdc02780/document.1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/markdown-cdc02780/document.1.jpg
--------------------------------------------------------------------------------
/docs/images/previews/markdown-cdc02780/document.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/markdown-cdc02780/document.pdf
--------------------------------------------------------------------------------
/docs/images/previews/markdown-f4432de3/document.1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/markdown-f4432de3/document.1.jpg
--------------------------------------------------------------------------------
/docs/images/previews/markdown-f4432de3/document.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/markdown-f4432de3/document.pdf
--------------------------------------------------------------------------------
/docs/images/previews/nobreak-ba337df4/document.1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/nobreak-ba337df4/document.1.jpg
--------------------------------------------------------------------------------
/docs/images/previews/nobreak-ba337df4/document.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/nobreak-ba337df4/document.pdf
--------------------------------------------------------------------------------
/docs/images/previews/pagebottom-fd5eaff9/document.1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/pagebottom-fd5eaff9/document.1.jpg
--------------------------------------------------------------------------------
/docs/images/previews/pagebottom-fd5eaff9/document.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/pagebottom-fd5eaff9/document.pdf
--------------------------------------------------------------------------------
/docs/images/previews/pagebreak-bb162ea2/document.1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/pagebreak-bb162ea2/document.1.jpg
--------------------------------------------------------------------------------
/docs/images/previews/pagebreak-bb162ea2/document.2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/pagebreak-bb162ea2/document.2.jpg
--------------------------------------------------------------------------------
/docs/images/previews/pagebreak-bb162ea2/document.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/pagebreak-bb162ea2/document.pdf
--------------------------------------------------------------------------------
/docs/images/previews/pagenumber-4d636b47/document.1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/pagenumber-4d636b47/document.1.jpg
--------------------------------------------------------------------------------
/docs/images/previews/pagenumber-4d636b47/document.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/pagenumber-4d636b47/document.pdf
--------------------------------------------------------------------------------
/docs/images/previews/pagenumber-fe8490ef/document.1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/pagenumber-fe8490ef/document.1.jpg
--------------------------------------------------------------------------------
/docs/images/previews/pagenumber-fe8490ef/document.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/pagenumber-fe8490ef/document.pdf
--------------------------------------------------------------------------------
/docs/images/previews/pagesnumber-ba7ca0ce/document.1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/pagesnumber-ba7ca0ce/document.1.jpg
--------------------------------------------------------------------------------
/docs/images/previews/pagesnumber-ba7ca0ce/document.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/pagesnumber-ba7ca0ce/document.pdf
--------------------------------------------------------------------------------
/docs/images/previews/pagetop-53bf6bd2/document.1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/pagetop-53bf6bd2/document.1.jpg
--------------------------------------------------------------------------------
/docs/images/previews/pagetop-53bf6bd2/document.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/pagetop-53bf6bd2/document.pdf
--------------------------------------------------------------------------------
/docs/images/previews/runningh1-230ef375/document.1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/runningh1-230ef375/document.1.jpg
--------------------------------------------------------------------------------
/docs/images/previews/runningh1-230ef375/document.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/runningh1-230ef375/document.pdf
--------------------------------------------------------------------------------
/docs/images/previews/tailwind-1aadcc0c/document.1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/tailwind-1aadcc0c/document.1.jpg
--------------------------------------------------------------------------------
/docs/images/previews/tailwind-1aadcc0c/document.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/tailwind-1aadcc0c/document.pdf
--------------------------------------------------------------------------------
/docs/images/previews/tailwind-b7e447a6/document.1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/tailwind-b7e447a6/document.1.jpg
--------------------------------------------------------------------------------
/docs/images/previews/tailwind-b7e447a6/document.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/tailwind-b7e447a6/document.pdf
--------------------------------------------------------------------------------
/docs/images/previews/tailwind-e99fe796/document.1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/tailwind-e99fe796/document.1.jpg
--------------------------------------------------------------------------------
/docs/images/previews/tailwind-e99fe796/document.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/tailwind-e99fe796/document.pdf
--------------------------------------------------------------------------------
/docs/images/previews/ui-templates-invoice-advanced-657df4ea/document.1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/ui-templates-invoice-advanced-657df4ea/document.1.jpg
--------------------------------------------------------------------------------
/docs/images/previews/ui-templates-invoice-advanced-657df4ea/document.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/ui-templates-invoice-advanced-657df4ea/document.pdf
--------------------------------------------------------------------------------
/docs/images/previews/ui-templates-invoice-c1137a92/document.1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/ui-templates-invoice-c1137a92/document.1.jpg
--------------------------------------------------------------------------------
/docs/images/previews/ui-templates-invoice-c1137a92/document.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/ui-templates-invoice-c1137a92/document.pdf
--------------------------------------------------------------------------------
/docs/images/previews/ui-templates-nda-markdown-a1c048ca/document.1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/ui-templates-nda-markdown-a1c048ca/document.1.jpg
--------------------------------------------------------------------------------
/docs/images/previews/ui-templates-nda-markdown-a1c048ca/document.2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/ui-templates-nda-markdown-a1c048ca/document.2.jpg
--------------------------------------------------------------------------------
/docs/images/previews/ui-templates-nda-markdown-a1c048ca/document.3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/ui-templates-nda-markdown-a1c048ca/document.3.jpg
--------------------------------------------------------------------------------
/docs/images/previews/ui-templates-nda-markdown-a1c048ca/document.4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/ui-templates-nda-markdown-a1c048ca/document.4.jpg
--------------------------------------------------------------------------------
/docs/images/previews/ui-templates-nda-markdown-a1c048ca/document.5.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/ui-templates-nda-markdown-a1c048ca/document.5.jpg
--------------------------------------------------------------------------------
/docs/images/previews/ui-templates-nda-markdown-a1c048ca/document.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/ui-templates-nda-markdown-a1c048ca/document.pdf
--------------------------------------------------------------------------------
/docs/images/previews/ui-templates-receipt-644d535a/document.1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/ui-templates-receipt-644d535a/document.1.jpg
--------------------------------------------------------------------------------
/docs/images/previews/ui-templates-receipt-644d535a/document.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/ui-templates-receipt-644d535a/document.pdf
--------------------------------------------------------------------------------
/docs/images/previews/ui-templates-report-charts-fe27a92e/document.1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/ui-templates-report-charts-fe27a92e/document.1.jpg
--------------------------------------------------------------------------------
/docs/images/previews/ui-templates-report-charts-fe27a92e/document.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/ui-templates-report-charts-fe27a92e/document.pdf
--------------------------------------------------------------------------------
/docs/images/previews/ui-templates-scientific-report-7f68dcf5/document.1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/ui-templates-scientific-report-7f68dcf5/document.1.jpg
--------------------------------------------------------------------------------
/docs/images/previews/ui-templates-scientific-report-7f68dcf5/document.2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/ui-templates-scientific-report-7f68dcf5/document.2.jpg
--------------------------------------------------------------------------------
/docs/images/previews/ui-templates-scientific-report-7f68dcf5/document.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/previews/ui-templates-scientific-report-7f68dcf5/document.pdf
--------------------------------------------------------------------------------
/docs/images/react-email-cover.avif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/images/react-email-cover.avif
--------------------------------------------------------------------------------
/docs/integrations/onedoc.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: "Onedoc"
3 | sidebarTitle: "Onedoc"
4 | description: "Use Onedoc as your primary documents generation and management providers"
5 | icon: "1"
6 | ---
7 |
8 | In this section we will show you how can you generate and host a .pdf using [Onedoc's SDK](https://www.npmjs.com/package/@onedoc/client).
9 |
10 | Onedoc is currently in public beta mode.
11 |
12 | ## Prerequisites
13 |
14 | To get the most out of this guide, you'll need to:
15 |
16 | - [Sign-up/in to Onedoc](https://app.onedoclabs.com/login)
17 | - [Generate your API Key](https://app.onedoclabs.com/login)
18 |
19 | ## 1. Installation
20 |
21 |
22 | Want to get started without a project? We have setup a [simple
23 | CodeSandbox](https://codesandbox.io/p/devbox/onedoc-template-invoice-forked-jdyw6j?embed=1&file=%2Findex.tsx)
24 | for you to try out.
25 |
26 |
27 | If you did not have set up a NodeJS project, you can use the following command to do so:
28 |
29 | ```sh npm
30 | npm init -y
31 | ```
32 |
33 | Get the Onedoc Node.js SDK
34 |
35 |
36 |
37 | ```sh npm
38 | npm install @onedoc/client
39 | ```
40 |
41 | ```sh yarn
42 | yarn add @onedoc/client
43 | ```
44 |
45 | ```sh pnpm
46 | pnpm add @onedoc/client
47 | ```
48 |
49 |
50 |
51 | ## 2. Create a document template
52 |
53 | Create a `components` directory using the following command:
54 |
55 | ```sh terminal
56 | mkdir components
57 | ```
58 |
59 | Then create your document template on `components/pdf-template.jsx`. Your file must export a React component.
60 |
61 | ```javascript components/pdf-template.jsx
62 | import * as React from "react";
63 |
64 | export const PDFTemplate = ({ name }) => {
65 | return (
66 |
67 |
Hello {name} !
68 |
69 | );
70 | };
71 | ```
72 |
73 | and optionally, a stylesheet named `stylesheet.css`, in the `root` directory:
74 |
75 | ```css ./stylesheet.css
76 | body {
77 | background-color: lightblue;
78 | }
79 | ```
80 |
81 | ## 3. Generate your PDF
82 |
83 | Create a new file `generate.tsx', import the React document template and generate a PDF using your `ONEDOC_API_KEY` and your main React component.
84 |
85 |
86 |
87 | ```javascript generate.tsx
88 | import React from "react";
89 | import { PDFTemplate } from "./components/pdf-template";
90 | import { Onedoc } from "@onedoc/client";
91 | import { readFileSync, writeFileSync } from "fs";
92 | import { compile } from "@fileforge/react-print";
93 | import { join } from "path";
94 |
95 | const ONEDOC_API_KEY = "####-####-####-####"; // replace with your api key
96 |
97 | (async () => {
98 | const onedoc = new Onedoc(ONEDOC_API_KEY);
99 |
100 | let doc = {
101 | html: await compile(),
102 | title: "Hello",
103 | test: true, // if true, produce a PDF in test mode with a Onedoc's watermark
104 | save: true, // if true, host the document and provide a download link in the console and your Onedoc's dashboard
105 | expiresIn: 30, // the number of day you want to host your document
106 | assets: [
107 | {
108 | path: "./stylesheet.css",
109 | content: readFileSync(join(process.cwd(), "stylesheet.css")).toString(),
110 | },
111 | ],
112 | };
113 |
114 | const { file, link, error, info } = await onedoc.render(doc);
115 |
116 | if (error) {
117 | throw error;
118 | }
119 |
120 | console.log(link);
121 | })();
122 | ```
123 |
124 |
125 |
126 | You are almost done ! Run the script using the following command :
127 |
128 | ```sh terminal
129 | npx tsx ./generate.tsx
130 | ```
131 |
132 | Stylesheets and other referenced assets should be passed in the `asset` parameter. If you are using a framework such as Tailwind, you must submit a compiled stylesheet that can be applied to a HTML file that contains the compiled React component.
133 |
134 | You must upload the content of your asset in string or Buffer format in the `content` field.
135 |
136 | ## 4. Congratulations !
137 |
138 | You just created your first PDF using Onedoc Node.js + React SDK. You can now access your private [dashboard](https://app.onedoclabs.com/) to preview and download your PDF.
139 |
--------------------------------------------------------------------------------
/docs/introduction.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: "React Print"
3 | sidebarTitle: "Introduction"
4 | description: "Build PDFs using React and TypeScript."
5 | icon: "hand-wave"
6 | ---
7 |
8 | ## Why ?
9 |
10 |
11 | React Print is meant to help developers design PDFs. It outputs an HTML string
12 | that can be used to generate a PDF using a renderer like the [FileForge
13 | API](/api-reference/api-reference/generate).
14 |
15 |
16 | We believe documents are at the core of communication—invoices, contracts, resumes, brochures, etc. They are the primary method for exchanging information with others professionally. So, why do we continue to use decades-old technology to create them? We believe you deserve better. Document production needs to be modernized. Start today and create your next PDF the same way you build a web app. And yes, this includes automating data integration into your documents. **Say hello to react-print.**
17 |
18 |
23 | Contribute to development and give us a ⭐️
24 |
25 |
26 | ## Getting Started
27 |
28 | React Print is designed to be incrementally adopted, so you can add it to most codebases in a few minutes.
29 |
30 |
31 | React Print is your go-to library for creating PDFs using React and
32 | TypeScript. It provides a set of components to help you build amazing
33 | documents without having to deal with the mess of creating complex layouts and
34 | maintaining archaic markup.
35 |
36 |
37 | Create a brand-new folder with packages powered by React Print.
38 |
39 |
40 | ## Components
41 |
42 | A set of standard components to help you build amazing documents without having to deal with the mess of creating complex layouts and maintaining archaic markup.
43 |
44 |
45 | Compile a React component to a string with the Onedoc print styles.
46 |
47 | Allows adding CSS to the document while securely parsing and escaping it.
48 |
49 | Create automatically numbered footnotes.
50 |
51 | Render LaTeX formulas right in your React components.
52 |
53 | Render Markdown inside your templates.
54 |
55 | Display content in other page regions.
56 |
57 | Add signature fields to your document.
58 |
59 | A simple, drop-in way to use Tailwind CSS in your components.
60 |
61 | Display dynamic values based on your document, such as page numbers and running headers.
62 |
63 |
64 | Help us increase the number of components and start being an active member of
65 | the react-print community by
66 | [contributing](/react-print/contributing/contributing)
67 |
68 |
69 | # Rendering
70 |
71 | PDFs component created by react-print can be rendered, hosted (and more) with your preferred providers. We recommend using the [FileForge API](/api-reference/api-reference/generate) as it has been specificaly build to work with react-print.
72 |
73 |
74 |
75 | Manage your document using Onedoc
76 |
77 |
78 | Coming soon ..
79 |
80 |
81 |
82 |
83 | ## Authors
84 |
85 | - Auguste L. ([@thisisnotFranck](https://twitter.com/thisisnotfranck))
86 | - Pierre D. ([@pierre_dge120](https://twitter.com/pedro_dge120))
87 | - Titouan L. ([@titouan325](https://twitter.com/titouan325))
88 |
--------------------------------------------------------------------------------
/docs/logo/dark.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/docs/logo/light.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/docs/logo/react-print-trim.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/logo/react-print-trim.png
--------------------------------------------------------------------------------
/docs/logo/react-print.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OnedocLabs/react-print-pdf/f1023fe7b335f228c85ec3a7c0a151fd3d69e22f/docs/logo/react-print.png
--------------------------------------------------------------------------------
/docs/mint.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "React Print",
3 | "schema": "schema.json",
4 | "logo": {
5 | "dark": "/logo/react-print-trim.png",
6 | "light": "/logo/react-print-trim.png",
7 | "href": "https://www.onedoclabs.com/"
8 | },
9 | "favicon": "/favicon.svg",
10 | "colors": {
11 | "primary": "#ffffff",
12 | "light": "#ffffff",
13 | "background": {
14 | "light": "#FFFFFF",
15 | "dark": "#000000"
16 | },
17 | "anchors": {
18 | "from": "#101010",
19 | "to": "#606060"
20 | }
21 | },
22 | "redirects": [
23 | {
24 | "source": "/:slug*",
25 | "destination": "https://docs.fileforge.com/react-print/:slug*"
26 | }
27 | ],
28 | "seo": {
29 | "indexHiddenPages": true
30 | },
31 | "analytics": {
32 | "posthog": {
33 | "apiKey": "phc_jHjWg3U3A39knTK6ChWEUHIXMFYZ7rATZOLzhK39dv9",
34 | "apiHost": "https://eu.posthog.com"
35 | },
36 | "ga4": {
37 | "measurementId": "G-KD443H3TZ3"
38 | }
39 | },
40 | "modeToggle": {
41 | "default": "dark",
42 | "isHidden": true
43 | },
44 | "feedback": {
45 | "thumbsRating": true
46 | },
47 | "topbarLinks": [],
48 | "topbarCtaButton": {
49 | "type": "github",
50 | "url": "https://github.com/OnedocLabs/react-print"
51 | },
52 | "tabs": [],
53 | "anchors": [
54 | {
55 | "name": "Documentation",
56 | "icon": "book-open-cover",
57 | "url": "https://react.onedoclabs.com/introduction"
58 | },
59 | {
60 | "name": "Discord",
61 | "icon": "discord",
62 | "url": "https://discord.gg/uRJE6e2rgr"
63 | },
64 | {
65 | "name": "Github",
66 | "icon": "github",
67 | "url": "https://github.com/OnedocLabs/react-print"
68 | },
69 | {
70 | "name": "Onedoc",
71 | "icon": "globe",
72 | "url": "https://www.onedoclabs.com/"
73 | }
74 | ],
75 | "navigation": [
76 | {
77 | "group": "Overview",
78 | "pages": [
79 | "introduction",
80 | "contributing"
81 | ]
82 | },
83 | {
84 | "group": "Getting Started",
85 | "pages": [
86 | "getting-started/setup"
87 | ]
88 | },
89 | {
90 | "group": "Integrations",
91 | "pages": [
92 | "integrations/onedoc"
93 | ]
94 | },
95 | {
96 | "group": "Components",
97 | "pages": [
98 | "/react-print/components/undefined",
99 | "/react-print/components/undefined",
100 | "/react-print/components/undefined",
101 | "/react-print/components/undefined",
102 | "/react-print/components/undefined",
103 | "/react-print/components/undefined",
104 | "/react-print/components/undefined",
105 | "/react-print/components/undefined",
106 | "/react-print/components/undefined"
107 | ]
108 | },
109 | {
110 | "group": "Templates",
111 | "pages": [
112 | "ui/templates",
113 | {
114 | "group": "Reports",
115 | "pages": [
116 | "ui/templates/scientific-report",
117 | "ui/templates/report-charts"
118 | ]
119 | },
120 | {
121 | "group": "Receipts",
122 | "pages": [
123 | "ui/templates/receipt"
124 | ]
125 | },
126 | {
127 | "group": "NDA",
128 | "pages": [
129 | "ui/templates/nda-markdown"
130 | ]
131 | },
132 | {
133 | "group": "Invoices",
134 | "pages": [
135 | "ui/templates/invoice",
136 | "ui/templates/invoice-advanced"
137 | ]
138 | }
139 | ]
140 | },
141 | {
142 | "group": "Troubleshooting",
143 | "pages": [
144 | "troubleshooting/faq"
145 | ]
146 | }
147 | ],
148 | "footerSocials": {
149 | "twitter": "https://twitter.com/Onedoclabs",
150 | "github": "https://github.com/OnedocLabs/onedoc",
151 | "linkedin": "https://www.linkedin.com/company/onedoclabs"
152 | }
153 | }
--------------------------------------------------------------------------------
/docs/quickstart.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: 'Quickstart'
3 | description: 'Start building awesome documentation in under 5 minutes'
4 | ---
5 |
6 | ## Setup your development
7 |
8 | Learn how to update your docs locally and and deploy them to the public.
9 |
10 | ### Edit and preview
11 |
12 |
13 |
14 | During the onboarding process, we created a repository on your Github with
15 | your docs content. You can find this repository on our
16 | [dashboard](https://dashboard.mintlify.com). To clone the repository
17 | locally, follow these
18 | [instructions](https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository)
19 | in your terminal.
20 |
21 |
22 | Previewing helps you make sure your changes look as intended. We built a
23 | command line interface to render these changes locally. 1. Install the
24 | [Mintlify CLI](https://www.npmjs.com/package/mintlify) to preview the
25 | documentation changes locally with this command: ``` npm i -g mintlify ```
26 | 2. Run the following command at the root of your documentation (where
27 | `mint.json` is): ``` mintlify dev ```
28 |
29 |
30 |
31 | ### Deploy your changes
32 |
33 |
34 |
35 |
36 | Our Github app automatically deploys your changes to your docs site, so you
37 | don't need to manage deployments yourself. You can find the link to install on
38 | your [dashboard](https://dashboard.mintlify.com). Once the bot has been
39 | successfully installed, there should be a check mark next to the commit hash
40 | of the repo.
41 |
42 |
43 | [Commit and push your changes to
44 | Git](https://docs.github.com/en/get-started/using-git/pushing-commits-to-a-remote-repository#about-git-push)
45 | for your changes to update in your docs site. If you push and don't see that
46 | the Github app successfully deployed your changes, you can also manually
47 | update your docs through our [dashboard](https://dashboard.mintlify.com).
48 |
49 |
50 |
51 |
52 | ## Update your docs
53 |
54 | Add content directly in your files with MDX syntax and React components. You can use any of our components, or even build your own.
55 |
56 |
57 |
58 |
59 | Add flair to your docs with personalized branding.
60 |
61 |
62 |
67 | Implement your OpenAPI spec and enable API user interaction.
68 |
69 |
70 |
75 | Draw insights from user interactions with your documentation.
76 |
77 |
78 |
83 | Keep your docs on your own website's subdomain.
84 |
85 |
86 |
87 |
--------------------------------------------------------------------------------
/docs/snippets/components.mdx:
--------------------------------------------------------------------------------
1 |
2 | Compile a React component to a string with the Onedoc print styles.
3 |
4 | Allows adding CSS to the document while securely parsing and escaping it.
5 |
6 | Create automatically numbered footnotes.
7 |
8 | Render LaTeX formulas right in your React components.
9 |
10 | Render Markdown inside your templates.
11 |
12 | Display content in other page regions.
13 |
14 | Add signature fields to your document.
15 |
16 | A simple, drop-in way to use Tailwind CSS in your components.
17 |
18 | Display dynamic values based on your document, such as page numbers and running headers.
19 |
--------------------------------------------------------------------------------
/docs/troubleshooting/faq.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: "FAQ"
3 | ---
4 |
5 | ## Issues with Node.js modules
6 |
7 | `react-print` ships both for server and client side. Some components are only available for the server side such as `Tailwind`.
8 |
9 | If you plan to use `react-print` on the client side, you should import your components from `@fileforge/react-print/client` instead of `@fileforge/react-print` or `@fileforge/react-print/server`.
10 |
--------------------------------------------------------------------------------
/docs/ui/templates.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: Browse
3 | icon: list
4 | ---
5 |
6 | ## Reports
7 |
8 |
9 |
10 |
104 |
105 | This is some additional content to to inform you that Acme Inc. is a
106 | fake company and this is a fake receipt. This is just a demo to show you
107 | how you can create a beautiful receipt with Onedoc.{" "}
108 |
109 | Some additional conditions may apply. This template comes from the
110 | react-print library, available at https://react.onedoclabs.com/
111 |
112 |