-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
SVG patterns do not render when using minified version of pdfmake #1832
Comments
@jpsilva managed to solve the problem? |
I'm also facing this issue with v0.1.68 |
Hi, i also got this issue when working on client side. any update soon ? |
Hello, I have this issue as well. |
Hi guy, good news, i just solve this issue !!. The main issue is constructor of "PDFPattern()" turn it self to "Object" after build. How to fix it up to you for me i add more parameter to check it is pattern fill or not. If you dont know where then follow this suggestion
my edit source.js Screenshot - also work well with image pattern. Sorry for my bad English. |
im getting the same issue with version 0.2.4 |
Tested with 0.2.4 and works correctly. |
@liborm85 I am getting this error with version 0.2.5. Is there any fix or workaround? |
after install the pdfmake you can change the pdfmake.js build file and change around the line 23032 that has
and add another condition to both if blocks
if you're using something like github actions you can copy that modified pdfmake.js file into your project folder and run the following command after run npm install on cloud |
Re-tested with 0.2.5 and works correctly. |
I get exactly the same problem when creating PDFs that contain pattern fills on Heroku Cloud with PDFsave. This is a big issue for our app. I'm using PDFSave v0.2.5. Is the above fix contained in v0.2.5 or not? I tried the suggested workaround, overwriting the minified js file pdfmake.min.js with a custom version, but unfortunately that did NOT solve the issue. That leaves some doubts whether the suggested workaround really fixes the issue in all cases. In my case, the issue shows with rectangles (rect tag) that use fill patterns through style = "fill: url(#my-pattern-id)". Those render in black color using the production build. |
I get the same issue with 0.2.7. The fix on svg-to-pdfkit suggested by ThePongBRIKL solves the issue. |
…iedman on svg-to-pdfkit repo
I also encountered this issue today while using the latest version I fixed it by adding those lines to the build: {
minify: 'terser',
terserOptions: {
keep_classnames: true,
keep_fnames: true
}
}, another solution is simply to disable the minification build: { minify: false }, |
As @rafaeelneto mentioned in his comment we can do same code changes
To execute this we can use npm hooks in
|
Using patterns in SVG works as expected when importing the unminified version of pdfmake (pdfmake/build/pdfmake.js). But they render as solid black when either importing pdfmake.min.js or minimizing the original with Angular. I haven't noticed any other discrepancies between
Result with unminified version:
![image](https://user-images.githubusercontent.com/422263/67484211-954c0e80-f635-11e9-8361-e32811639fc2.png)
Result with minified version:
![image](https://user-images.githubusercontent.com/422263/67484246-a85ede80-f635-11e9-8641-cd86767e8a44.png)
Code used to generate both results:
The text was updated successfully, but these errors were encountered: