Skip to content

Commit

Permalink
feat: pass _INTERNAL__LAYOUT__DATA_ to onRenderCallback in toBuffer (d…
Browse files Browse the repository at this point in the history
  • Loading branch information
SethThoburn authored Feb 13, 2024
1 parent da10a9b commit fab09cc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/ninety-glasses-count.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@react-pdf/renderer': minor
---

Pass \_INTERNAL\_\_LAYOUT\_\_DATA\_ to onRenderCallback in toBuffer
1 change: 1 addition & 0 deletions packages/layout/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import resolveLinkSubstitution from './steps/resolveLinkSubstitution';
const layout = asyncCompose(
resolveZIndex,
resolveOrigins,
resolveAssets,
resolvePagination,
resolveTextLayout,
resolvePercentRadius,
Expand Down
9 changes: 7 additions & 2 deletions packages/renderer/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,13 @@ const pdf = (initialValue) => {

// TODO: rename this method to `toStream` in next major release, because it return stream not a buffer
const toBuffer = async () => {
callOnRender();
return (await render()).fileStream;
const {
layout: _INTERNAL__LAYOUT__DATA_,
fileStream,
} = await render();
callOnRender({_INTERNAL__LAYOUT__DATA_});

return fileStream;
};

/*
Expand Down

0 comments on commit fab09cc

Please sign in to comment.