xhtml使用base64 img src呈现为pdf

时间:2018-02-28 13:37:36

标签: xhtml2pdf xhtmlrenderer

我正在尝试创建应该包含图像的PDF,但不是。转换为PDF的xhtml包含带有正确base64数据的img标记,因为当我在任何html中尝试它时,我看到了正确的内容。我正在使用核心渲染器R8版本。我有点怀疑这可能是一个问题因为它已经8岁了。

这是在xhtml内容中正确设置的示例。

<tr>
    <span>Some info text...</span>
    <img alt="some QR Code" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASIAAAEmAQAAAADuVKANAAADV0lEQVR42u2aPW7bQBCFh2CxLgSwTUfkBi5TWVdJbuAuLoiQAIHwWkvoIssbbBcCITiZN0sHMS3SAhIguwlVyBL0SfLTzps/ifiGi6WDOqh/jfK0e8kD9W3/hb4f1EH915QVrxg105lblj810xl3sxSoXrSYGX7PfFWanptSnlTrAwlQnkpji2nJeT0A9hWZdKhe5AFwSLkOatOiEFXcOpazKiW+kqEQXzY8VgtVtLwVhRFS6u1ejfHL1dUMECG1dCA5j5k8ppK3sm+EFPQYNfNMYpG5mErtpUwSlJWAEmUN0YPcElsvVh/PKVDsc6kK8MRMtZNbWhWqlcZYqR75qPe5g6MdDM6ilt06A8RJSTkrRV6OvKo1TaoCMuz6HOOkcEKiZ1pqgaUKvQVKXAqU5lCCUJwVIi0E2UuN0VIij2EMOZdG6zDOairHLAVq1nzEkw7F5fiAvCrZylESlORQGmEHeghtHNAr8RUnBVtLDp1oJOQjqxm20GNKgNK236IWWA0yKWfIqzwmQcHMOBz1BGlrJ09iR2lQokw9IfJCYRN56Oo4BQqjozZCWpFxVqTjpEmCYm6lhdYSDJdn0AjJY5YEhZqG9kf76BFqQ8ydU6Dg6BBkWdj6YP+DUZ5ToLR5UyDTWey5n0iDssihGRoIzO6IqlAkkqFckMeso2MdHLOeAuKk+kWehFaoBVPYHKZChdByOgDw8/z4qo+OlJLmjbUgsMYXtj6WkqHQ+9uQmSbto3H31XYlUirsrMKuJw97EwwF6ykzUkr1zPhmIltWhaXeWk34kVLLrjYsZ5FhG8zBUyqUrtgYSQlbQi3QVstyMpSV0VG3V0Ej6tx6+o2Zwug4h74orG7LVxvdOCltIMLU2Cx9NEl6uhKFEVLqbd3yU+ijJc3OuOIUqON794M6qN+gsG9/eWmu/Orpb/5mq5M557xNjYUzbMs3KG9cztZ0PFY7lMtdxjZ/g+r7YeBL+wbVDqAuXeZP7325RXV+6EGRP5Evtin57+UdH5+q+89mhzLQOD5VH+puhyqkE+2sUNXOaw36qZJQj2ZHY8sX/non1Mdu5/PqQb0T6lO3/dn/pO6HTcrngwNF1Ymc2Y6JwdcX7u6+nHK/+Vpc3BSFdBPV3ETZP+GOH1khlTts3E3LAAAAAElFTkSuQmCC" />
</tr>

您可以在任何html文档中自行检查它生成的QR码图片。

1 个答案:

答案 0 :(得分:0)

ok guys, solution is simple, so if you are using prehistoric core-renderer R8 rather update to flying-saucer renderer which solved my problem