Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: pass _INTERNAL__LAYOUT__DATA_ to onRenderCallback in toBuffer #2582

Merged
merged 5 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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