简体   繁体   English

从jsPDF库生成的pdf文件,无法在Adobe Reader中打开

[英]generated pdf file from jsPDF library , does not open in adobe reader

I have a html page. 我有一个html页面。 There are two images on this page. 此页面上有两个图像。 both images are base64 encoded. 这两个图像都是base64编码的。 I am printing images on html as 我在html上将图像打印为

<img src='data:image/png;base64,<?php echo $img ?>' />

I set css properties position, left and right to bring one image over other image. 我将CSS属性位置设置为左右,以将一个图像移到其他图像上。

Now I am using jsPDF to generate pdf file of a section of the page where these 2 images are present. 现在,我正在使用jsPDF生成页面的一部分的pdf文件,其中存在这两个图像。

generated pdf files from jsPDF works fine if I open it on FireFox , chrome or Document Viewer (ubuntu machine) but if I try to open this pdf file on a windows machine with Adobe reader then Adobe reader throws an error: There was an error processing a page. 如果我在FireFox,chrome或Document Viewer(ubuntu机器)上打开jsPDF生成的pdf文件,则可以正常工作,但是如果我尝试使用Adobe Reader在Windows机器上打开此pdf文件,则Adobe Reader会引发错误:处理错误页面。 There was a problem reading this document (110) PDF error 阅读该文档时出现问题(110)PDF错误

If any one has any suggestion then kindly let me know. 如果有任何建议,请告诉我。

I had a similar issue using the fromHTML plugin, apparently the code puts out the text color resulting in it placing "rgb(0, 0, 0)" in places it should not. 使用fromHTML插件时,我遇到了类似的问题,显然,该代码将文本颜色显示出来,导致其将“ rgb(0,0,0)”放置在不应放置的位置。

The github recomended changing jspdf.dist.js in the line: github建议在线更改jspdf.dist.js:

this.pdf.internal.write("q", "BT 0 g", this.pdf.internal.getCoordinateString(this.x), this.pdf.internal.getVerticalCoordinateString(this.y), style.color, "Td");

changing the "style.color" to "null" solved my issue. 将“ style.color”更改为“ null”解决了我的问题。

this.pdf.internal.getCoordinateString(this.x), this.pdf.internal.getVerticalCoordinateString(this.y), null, "Td");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM