"Cannot enlarge memory arrays" when Page components is used with wrap prop
See original GitHub issueFirst of all, awesome work!
OS: Ubuntu Linux 16.04
React-pdf version: 1.0.0-alpha.15
Description: When rendering a small pdf on client-side it renders ok. If i try to add wrap
prop on my Page
component, the pdf didn’t render and i got this message on dev console:
Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value 134217728, (2) compile with -s ALLOW_MEMORY_GROWTH=1 which allows increasing the size at runtime but prevents some optimizations, (3) set Module.TOTAL_MEMORY to a higher value before the program runs, or (4) if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0
How to replicate issue including code snippet (if applies):
Component file:
class Profile extends Component {
render () {
return (
<div>
<Document style={{height: '500px', width: '100%'}}>
<Page size="A4" style={styles.page} wrap>
<View style={styles.header} fixed>
<Image src='/logo.png' />
</View>
<View>
<Text style={styles.mainTitle} >Profile</Text>
<Text style={styles.titleDetail}>{new Date().toLocaleDateString('pt-BR', {day: 'numeric', month: 'long', year: 'numeric'})}</Text>
</View>
<View style={styles.section}>
<Text>Section #1</Text>
</View>
<View style={styles.section}>
<Text>Section #2</Text>
</View>
</Page>
</Document>
</div>
)
}
}
App.js
import { Profile } from 'some-path'
...
<Route path="/mypdf" exact={true} component={Profile} />
Issue Analytics
- State:
- Created 5 years ago
- Comments:12 (5 by maintainers)
I’m running into the same issue. The work around I’m currently using because I can’t think of a better way, is to modify
node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js
. Around line 460 there is the integer134217728
. I’m increasing it and it gets around the issue.Not the best solution, and definitely not permanent since it will just get erased when the package is updated. It at least is a work around the issue although it generates a warning about the heap size.
I’m open to a more permanent solution.
@diegomura I’m also running into this - checking to see if there’s an update on when a fix for this would be released. Thanks for the help!