asp.net core Image in PDF header
-
Hi,
i've a problem with JSReport in asp.net core.I would like to display an image in the PDF header.
How does it work? When i use the <img /> Tag in the Header View, displays the pdf nothing.Many thanks for your helping!
greeting Niklas
-
This is phantomjs "bug" which has the following workaround described in our docs,
You may notice image won't show up when you try to add it into phantom header in a common way:
This is because the header and footer are printed into PDF format in a synchronous way. This means that any asynchronous request like getting image won't finish in time. This is a current limitation of phantom.js
Solution:
Add the same image to template content and hide it with the style display:none. Then, you can add it to the header and it will show up because it is already cached and then no asynchronous request is needed. This is required to do for both images referenced by url as well for Data URI scheme base64 image.
-
Thank you! it works fine!
Now, i have some custom fonts in the View,header and footer. How can i preload the custom fonts ?
Thanks
greeting Niklas
-
Try to check this
https://jsreport.net/blog/fonts-in-pdf-header-when-using-phantomjs
-
Is this tutorial only for "JSReport Studio" ?
Can i parse the assets field in asp.net core MVC ?
-
Assets extension just loads file and applies a transformation like base64 encoding.
You can easily do the same without it, just by hand.