问题
Image is not getting printed with ngx-print. I am not sure what am I doing wrong here.
HTML
<button type="button" printTitle="PrintVoucher" [useExistingCss]="true"
printSectionId="printVoucher" ngxPrint>
Print </button>
<div row id="printVoucher" >
<img src="assets/images/logo.png">
</div>
However the image is visible on the screen , but not visible in the print preview section.
回答1:
you have to use absolute path , Not relative path
ie your path should be for example
"http://localhost:3000/assets/images/print-logo.png" not "print-logo.png"
to know the difference between relative and absolute path check this link
to get your current base Url for example ("http://localhost:3000") you can use
let x = window.location.origin;
来源:https://stackoverflow.com/questions/56694343/problem-with-image-printing-using-ngx-print