How to use the @react-pdf/renderer.Font.register function in @react-pdf/renderer

To help you get started, we’ve selected a few @react-pdf/renderer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github n6g7 / httpdf / example / documents / demo.js View on Github external
import React, { PureComponent } from "react"
import PropTypes from "prop-types"
import { Document, Font, Image, Page, StyleSheet } from "@react-pdf/renderer"

import Side from "./Side"

Font.register({
  family: "Montserrat",
  src: "/fonts/montserrat.ttf",
})

const styles = StyleSheet.create({
  page: {
    flexDirection: "row",
    fontFamily: "Montserrat",
    backgroundColor: "#E4E4E4",
  },
  image: {
    width: "80%",
  },
})

export default class Test extends PureComponent {
github bcgov / range-web / src / components / rangeUsePlanPage / pdf / pdf / index.js View on Github external
import { Document, Font } from '@react-pdf/renderer'
import FrontPage from './FrontPage'
import BasicInformation from './BasicInformation'
import Pastures from './Pastures'
import Schedules from './Schedules'
import MinisterIssues from './MinisterIssues'
import AdditionalRequirements from './AdditionalRequirements'
import InvasivePlants from './InvasivePlants'

import latoRegular from './fonts/Lato-Regular.ttf'
import latoItalic from './fonts/Lato-Italic.ttf'
import latoBold from './fonts/Lato-Bold.ttf'
import latoBlack from './fonts/Lato-Black.ttf'
import ManagementConsiderations from './ManagementConsiderations'

Font.register({
  family: 'Lato',
  fonts: [
    { src: latoRegular },
    { src: latoItalic, fontStyle: 'italic' },
    { src: latoBold, fontWeight: 'bold' },
    { src: latoBlack, fontWeight: 'heavy' }
  ]
})

const RUPDocument = ({ plan }) => {
  if (!plan) return 

  return (

@react-pdf/renderer

Create PDF files on the browser and server

MIT
Latest version published 23 days ago

Package Health Score

94 / 100
Full package analysis

Similar packages