Skip to content

Commit

Permalink
Fixes conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
pierredge committed Jun 4, 2024
2 parents 43b0691 + bde5353 commit 1bc6166
Show file tree
Hide file tree
Showing 32 changed files with 1,226 additions and 415 deletions.
366 changes: 183 additions & 183 deletions LICENSE.md

Large diffs are not rendered by default.

40 changes: 24 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
![React email cover](docs/images/react-email-cover.avif)
![Cover Fileforge](https://github.com/OnedocLabs/react-print-pdf/assets/33000377/6861210a-5f0d-4898-9529-bb13dfa982d1)

<div align="center"><strong>React Print</strong></div>
<div align="center">The new way to build documents.<br />High-quality, unstyled components for creating PDFs.</div>
<br />
<div align="center">
<a href="https://www.onedoclabs.com/">Website</a>
<a href="https://www.fileforge.com/">Website</a>
<span> · </span>
<a href="https://github.com/OnedocLabs/react-print">GitHub</a>
<a href="https://github.com/OnedocLabs/">GitHub</a>
<span> · </span>
<a href="https://discord.com/invite/uRJE6e2rgr">Discord</a>
<span> · </span>
<a href="https://react.onedoclabs.com">Documentation</a>
<a href="https://fileforge.docs.buildwithfern.com/react-print/welcome/getting-started">Documentation</a>
</div>

<br/>
Expand All @@ -19,8 +19,8 @@

[![GitHub Repo stars](https://img.shields.io/github/stars/Onedoclabs/react-print)](https://github.com/OnedocLabs/react-print)
[![Discord](https://img.shields.io/discord/1182321379081736192?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.gg/uRJE6e2rgr)
[![X (formerly Twitter) Follow](https://img.shields.io/twitter/follow/Onedoclabs)](https://twitter.com/Onedoclabs)
[![YC](https://img.shields.io/badge/Y%20Combinator-W24-orange?style=flat-square)](https://www.ycombinator.com/companies/onedoc)
[![X (formerly Twitter) Follow](https://img.shields.io/twitter/follow/FileforgeLabs)](https://twitter.com/FileforgeLabs)
[![YC](https://img.shields.io/badge/Y%20Combinator-W24-orange?style=flat-square)](https://www.ycombinator.com/companies/fileforge)

</div>

Expand All @@ -33,8 +33,8 @@ https://github.com/OnedocLabs/react-print-pdf/assets/33000377/0d8815a7-e858-4541
# Key Features 🎯

- **Easy to use**: Build your first PDF with react-print-pdf in less than 5 minutes.
- **Open source**: Freedom is beautiful, and so is Onedoc. React-print-pdf is open source and free to use.
- **Components & Templates**: Kickstart your next document by using our list of components and template created by Onedoc's Team and the community.
- **Open source**: Freedom is beautiful, and so is Fileforge. React-print-pdf is open source and free to use.
- **Components & Templates**: Kickstart your next document by using our list of components and template created by Fileforge's Team and the community.
- **100% Layout's control**: Unlike other solutions, you have complete control over 100% of your layout, including margins, headers, footers, and more.
- **Integrate dynamic data to your PDF**: Streamline data from your database and integrate it seamlessly into your PDFs.

Expand All @@ -50,7 +50,8 @@ We believe documents are at the core of communication—invoices, contracts, res

Unlike other solutions, _react-print-pdf_ gives you complete control over your documents, allowing you to design complex layouts with features like footnotes, headers, margins, and more. Additionally, it enables you to track and analyze specific parts of your document, and build and update charts using data from your database. And this is just the beginning—our team and the community will continue to develop great features to simplify the PDF generation process.

![Legacy Solution vs. React-print-pdf](docs/images/legacy-vs-react-print.avif)
![Legacy Solution vs. React-print-pdf](https://github.com/OnedocLabs/react-print-pdf/assets/33000377/a8834372-047e-46ff-a4ff-26083df88594)


# Getting started 🚀

Expand Down Expand Up @@ -89,7 +90,7 @@ import { PageTop, PageBottom, PageBreak } from "@fileforge/react-print";
Integrate your components and include styles where needed.

```javascript
export const document = ({ props }) => {
export const Document = ({ props }) => {
return (
<div>
<PageTop>
Expand All @@ -106,11 +107,18 @@ export const document = ({ props }) => {
};
```

## 4. Generate HTML 💻
```javascript
import { compile } from "@fileforge/react-print";

const html = await compile(<Document />);
```

# Components 🗂️

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. Help us extend this list by actively contributing and adding your favorite components!

[Browse all currently supported components →](https://react.onedoclabs.com/introduction#components)
[Browse all currently supported components →](https://fileforge.docs.buildwithfern.com/react-print/components/compile/compile)

> [!NOTE]
> Help us extend this list by actively contributing and adding your favorite components!
Expand All @@ -119,17 +127,17 @@ A set of standard components to help you build amazing documents without having

PDF designed with _react-print-print_ can be generated, hosted (and more) with your preferred document management providers.

- [Onedoc](https://app.onedoclabs.com/login) : HTML to PDF, cloud hosting, analytics and more.
- [Fileforge](https://app.fileforge.com/login) : HTML to PDF, cloud hosting, analytics and more.
- [Prince XML](https://www.princexml.com/) : simple HTML to PDF tool
- Others _(coming soon..)_

# Contributing 🫂

This project is open-source and is intended to be maintained and built by and for developers. </br>

Wanna help ? Awesome! There are many ways you can contribute ! Take a look at:
Wanna help ? Awesome! There are many ways you can contribute! Take a look at:

- [Contributing Guide](https://react.onedoclabs.com/contributing)
- [Contributing Guide](https://fileforge.docs.buildwithfern.com/react-print/contributing/contributing)

# Authors 🧑‍💻

Expand Down Expand Up @@ -167,8 +175,8 @@ Wanna help ? Awesome! There are many ways you can contribute ! Take a look at:

[![GitHub Repo stars](https://img.shields.io/github/stars/Onedoclabs/react-print)](https://github.com/OnedocLabs/react-print)
[![Discord](https://img.shields.io/discord/1182321379081736192?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.gg/uRJE6e2rgr)
[![X (formerly Twitter) Follow](https://img.shields.io/twitter/follow/Onedoclabs)](https://twitter.com/Onedoclabs)
[![YC](https://img.shields.io/badge/Y%20Combinator-W24-orange?style=flat-square)](https://www.ycombinator.com/companies/onedoc)
[![X (formerly Twitter) Follow](https://img.shields.io/twitter/follow/FileforgeLabs)](https://twitter.com/FileforgeLabs)
[![YC](https://img.shields.io/badge/Y%20Combinator-W24-orange?style=flat-square)](https://www.ycombinator.com/companies/fileforge)

</div>

Expand Down
2 changes: 1 addition & 1 deletion docgen/buildTemplates.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export async function buildTemplates() {
esbuildPlugins: [
mdx({
remarkPlugins: [remarkFrontmatter],
providerImportSource: "@fileforge/react-print/mdx", //TODO: change to fileforge once live
providerImportSource: "@fileforge/react-print/mdx",
}),
RawPlugin(),
],
Expand Down
117 changes: 117 additions & 0 deletions docs/components/css.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
---
title: CSS
icon: css3-alt
description: "Allows adding CSS to the document while securely parsing and escaping it.
NB: While you can add regular CSS with the `<style>` tag, it's recommended to use the `CSS` component to ensure that the CSS is properly escaped, most notably when using URLs or other potentially unsafe content."
---

## CSS

Support

<div style={{
display: "grid",
gridTemplateColumns: "repeat(2, 1fr)",
gap: "0.5rem",
}}><div className="flex items-center p-3 border rounded-md border-gray-700" style={{borderColor: '#374151'}}><svg xmlns="http://www.w3.org/2000/svg" className="h-5 w-5 mr-2" viewBox="0 0 512 512"><path fill="#22c55e" d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM369 209L241 337c-9.4 9.4-24.6 9.4-33.9 0l-64-64c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L335 175c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z"/></svg><span>Client-side</span></div><div className="flex items-center p-3 border rounded-md" style={{borderColor: '#374151'}}><svg xmlns="http://www.w3.org/2000/svg" className="h-5 w-5 mr-2" viewBox="0 0 512 512"><path fill="#22c55e" d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM369 209L241 337c-9.4 9.4-24.6 9.4-33.9 0l-64-64c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L335 175c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z"/></svg><span>Server-side</span></div></div>

### Examples

#### Preview

Use a simple CSS print property to set the page size.

<Frame type="glass"><img src="../images/previews/css-b26814a3/document.1.jpg" style={{ maxHeight: '400px', borderRadius: "0.25rem", overflow: "hidden" }} /></Frame>

<div style={{paddingTop: "1rem", paddingBottom: "1rem"}}><CodeGroup>
```jsx template.tsx
import { CSS } from "@fileforge/react-print";

<CSS>{`@page { size: a4 landscape; }`}</CSS>;

```
```css base.css
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap");

html,
body {
font-size: 28px;
font-family: "Inter", sans-serif;
}

@page {
size: A4;
}

```
</CodeGroup></div>

#### Load a Google Font

Load a Google Font using the `@import` rule.

<Frame type="glass"><img src="../images/previews/css-393a92da/document.1.jpg" style={{ maxHeight: '400px', borderRadius: "0.25rem", overflow: "hidden" }} /></Frame>

<div style={{paddingTop: "1rem", paddingBottom: "1rem"}}><CodeGroup>
```jsx template.tsx
import { CSS } from "@fileforge/react-print";

<React.Fragment>
<CSS>
{`@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300&display=swap');`}
</CSS>
<p style={{ fontFamily: "Roboto, sans-serif" }}>
This text uses the Roboto Light font.
</p>
</React.Fragment>;

```
```css base.css
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap");

html,
body {
font-size: 28px;
font-family: "Inter", sans-serif;
}

@page {
size: A4;
}

```
</CodeGroup></div>

#### Layout

You can 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).

<Frame type="glass"><img src="../images/previews/css-83e5c15a/document.1.jpg" style={{ maxHeight: '400px', borderRadius: "0.25rem", overflow: "hidden" }} /></Frame>

<div style={{paddingTop: "1rem", paddingBottom: "1rem"}}><CodeGroup>
```jsx template.tsx
import { CSS } from "@fileforge/react-print";

<React.Fragment>
<CSS>{`@page {size: A4;margin-top:1cm;margin-right:1cm;margin-left:1cm;margin-bottom:1cm;`}</CSS>
<div>Hello world!</div>
</React.Fragment>;

```
```css base.css
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap");

html,
body {
font-size: 28px;
font-family: "Inter", sans-serif;
}

@page {
size: A4;
}

```
</CodeGroup></div>

5 changes: 5 additions & 0 deletions docs/components/latex/latex.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,16 @@ body {

Write complex LaTeX formulas in your document.

<<<<<<< HEAD:docs/components/latex/latex.mdx
<Frame background="subtle"><img src="../../images/previews/latex-7a00ed36/document.1.jpg" style={{ width: '100%', height: 'auto', maxHeight: '500px', borderRadius: "0.25rem", overflow: "hidden", border: '1px solid #E5E4E2' }} /></Frame>

<div style={{paddingTop: "1rem", paddingBottom: "1rem"}}><CodeBlocks>
<CodeBlock title="template.tsx">
```jsx
=======
<div style={{paddingTop: "1rem", paddingBottom: "1rem"}}><CodeGroup>
```jsx template.tsx
>>>>>>> main:docs/components/latex.mdx
import { Latex } from "@fileforge/react-print";
<Latex>{String.raw`% \f is defined as #1f(#2) using the macro
Expand Down
5 changes: 5 additions & 0 deletions docs/components/markdown/markdown.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,14 @@ You can leverage the `overrides` prop to replace Markdown components with your o

<Frame background="subtle"><img src="../../images/previews/markdown-882cc486/document.1.jpg" style={{ width: '100%', height: 'auto', maxHeight: '500px', borderRadius: "0.25rem", overflow: "hidden", border: '1px solid #E5E4E2' }} /></Frame>

<<<<<<< HEAD:docs/components/markdown/markdown.mdx
<div style={{paddingTop: "1rem", paddingBottom: "1rem"}}><CodeBlocks>
<CodeBlock title="template.tsx">
```jsx
=======
<div style={{paddingTop: "1rem", paddingBottom: "1rem"}}><CodeGroup>
```jsx template.tsx
>>>>>>> main:docs/components/markdown.mdx
import { Markdown } from "@fileforge/react-print";
<Markdown
Expand Down
Loading

0 comments on commit 1bc6166

Please sign in to comment.