Skip to content

Commit

Permalink
Rendering process should support async operations (#71)
Browse files Browse the repository at this point in the history
Fixes #54
  • Loading branch information
diegomura committed May 22, 2017
1 parent 55ad196 commit c2563a3
Show file tree
Hide file tree
Showing 20 changed files with 334 additions and 378 deletions.
Binary file modified examples/fractals/output.pdf
Binary file not shown.
Binary file added examples/page-layout/output.pdf
Binary file not shown.
4 changes: 2 additions & 2 deletions packages/react-pdf-node/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import path from 'path';
import { PDFRenderer, createElement, pdf } from '@react-pdf/core';

export default {
render(element, filePath, callback) {
async render(element, filePath, callback) {
const container = createElement('ROOT');
const node = PDFRenderer.createContainer(container);

PDFRenderer.updateContainer(element, node, null);

const output = pdf(container).toBuffer();
const output = await pdf(container).toBuffer();

fs.open(filePath, 'w', (e, fd) => {
if (e) {
Expand Down

0 comments on commit c2563a3

Please sign in to comment.