Git Product home page Git Product logo

dev-local's Introduction

dev-local

Dev Local
The new way to build documents.
High-quality, unstyled components for creating PDFs.


Getting started

1. Installation

Clone the repository.

npm install

2. Set up environment

  • Copy the .env.example file to .env and fill in the required fields.
FILEFORGE_API_KEY="your_api_key"
  • For a live rendering experience, split your IDE in two views, and open invoice.pdf in your right tab. You can use the PDF Viewer extension if you are using VS Code.

3. Render your first document$

npm run render

4. Have fun !

Build and render documents of your own in just one command line !

5. Remove the watermark

By default, this repository has test: false enabled in ./src/render.tsx. To add the watermark and be in test mode, set test: false in ./src/render.tsx.

dev-local's People

Contributors

pierredge avatar augustelef avatar titou325 avatar pedro12029 avatar

Stargazers

tensorboy avatar Musanje Louis Michael avatar @lpha avatar Sebastian avatar Raymond Xu avatar Fabian Miiro avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

career-tokens

dev-local's Issues

Error during PDF conversion: ReferenceError: File is not defined

I keep getting an error when running npm run render:

import "dotenv/config";

import fs from "fs";
import { FileforgeClient } from '@fileforge/client';
import { compile } from "@fileforge/react-print";
import React from "react";

import { Document } from "./Document";

const ff = new FileforgeClient({
  apiKey:"process.env.FILEFORGE_API_KEY", // replace with your API key
});

(async () => {
  try {
    const HTML = await compile(<Document name="World" />)

    const pdf = await ff.pdf.generate(
      [new File([HTML], "index.html", {
        type: "text/html",
      }),
       new File([fs.readFileSync(__dirname + "/images/fileforge_cover.png")], "fileforge_cover.png", {
        type: "image/png",  
       })
    ],
      {
        options: {
          host: false,
          test: false,
        },
      }
    );

    pdf.pipe(fs.createWriteStream("output.pdf"));
  } catch (error) {
    console.error("Error during PDF conversion:", error);
  }
})();

Screenshot 2024-07-03 at 11 54 51 PM

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.