Giter Club home page Giter Club logo

onedoclabs / react-print-pdf Goto Github PK

View Code? Open in Web Editor NEW
1.9K 10.0 52.0 12.77 MB

Build and generate PDF using React ๐Ÿ“„ UI kit for PDFs and print documents. Simple, reusable components and templates to create great invoices, docs, brochures. Use your favorite front-end framework React to build your next PDF.

Home Page: https://react.onedoclabs.com/

License: Apache License 2.0

CSS 1.88% TypeScript 47.36% MDX 50.75%
layout pdf react print ui-kit react-print ui front-end html javascript

react-print-pdf's People

Contributors

augustelef avatar boukew99 avatar dependabot[bot] avatar jbl0ndie avatar kkahihu avatar pedro12029 avatar pierredge avatar the-homeless-god avatar titou325 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-print-pdf's Issues

React print not working when hosted on vercel

When I hosted my Nextjs 14 website on vercel, I was generating the pdf on a server component using tailwincss in the pdf template component.

It worked well on my computer but was throwing errors when hosted. I then changed it to generate on the backend using a route handler and I got an error saying that a particular tailwindcss module couldn't be found.

I changed the styling to plain CSS and I got a status 500 error. All this time, it worked perfectly on my computer so I wonder why it doesn't work when hosted on vercel.

react-print/server module not found

Trying to import Tailwind component according to this documentation results in error:
Cannot find module '@onedoc/react-print/server' or its corresponding type declarations.
I am trying to use it in Next.js server side components.

Documentation could be clearer

so i started reading the docs of this project specifically the getting started part and at page
page
a tag called index.jsx is used instead of index.tsx minor mistake but yeah should be fixed

Properties like justify-content and gap are not working

I have tried to make a CV template . You can see the code using this github gist:
https://gist.github.com/career-tokens/990b71d0d4a74e0795de5e3fc888b7a9

Here you will find that I have used justify-evenly and gap in some places . I have also checked that they are working fine when I am simply rendering it as a page instead of pdf.

But when I am trying to see the pdf version of it using react-print-pdf , they are not working .
(Font too seems to be an issue but I have addressed it in another issue)

image

In the above image you can see the difference , left is the pdf and right is the normal rendering .

This issue if solved can improve developer experience since otherwise you need to address it by using margins.

Runtime error

Trying to use it as simple as:

const MyDocument = () => {
  return (
    <div>
      <PageTop>
        <span>Top</span>
      </PageTop>
      <div>Content</div>
      <PageBottom>
        <div className="text-gray-400 text-sm">Bottom</div>
      </PageBottom>
      <PageBreak />
      <span>New page</span>
    </div>
  )
}

const App = () => {
  return <MyDocument />
}

And getting:

@onedoc_react-print.js?v=61065e32:17695 Uncaught (in promise) TypeError: os.platform is not a function
   at node_modules/fast-glob/out/utils/path.js (@onedoc_react-print.js?v=61065e32:17695:34)
   at __require2 (chunk-WGAPYIUP.js?v=61065e32:19:50)
   at node_modules/fast-glob/out/utils/index.js (@onedoc_react-print.js?v=61065e32:20835:17)
   at __require2 (chunk-WGAPYIUP.js?v=61065e32:19:50)
   at node_modules/fast-glob/out/managers/tasks.js (@onedoc_react-print.js?v=61065e32:20850:18)
   at __require2 (chunk-WGAPYIUP.js?v=61065e32:19:50)
   at node_modules/fast-glob/out/index.js (@onedoc_react-print.js?v=61065e32:22736:23)
   at __require2 (chunk-WGAPYIUP.js?v=61065e32:19:50)
   at node_modules/tailwindcss/lib/lib/content.js (@onedoc_react-print.js?v=61065e32:22979:46)
   at __require2 (chunk-WGAPYIUP.js?v=61065e32:19:50)
   
   Version: 0.1.108
   macOS: 14.3.1

CSS property not exported from react-print

I wanted to add a google font to my template . Hence I tried to follow the docs :
image

But on running , I get the error "'CSS' is not exported from '@onedoc/react-print' (imported as 'CSS')."
image

Another way as mentioned in the docs: using the import url in a css file and then using it is not working either.

It would be great if this issue could be fixed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.