!143 OFD修复部分文字未显示的问题,完善OFD兼容性处理.

Merge pull request !143 from 高雄/OFD
pull/144/MERGE
陈精华 2023-06-03 05:36:59 +00:00 committed by Gitee
commit 7b59edcf28
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 122 additions and 56 deletions

View File

@ -11,7 +11,7 @@
<link rel="stylesheet" href="css/cnofd.css">
<script src="js/jquery-3.6.0.min.js"></script>
<script src="js/jszip-utils-0.1.0.min.js"></script>
<script src="js/Typr.js"></script>
<script src="js/Typr.js"></script>
<script src="js/Typr.U.js"></script>
<script src="js/cnofd.umd.min.js"></script>
</head>
@ -45,7 +45,7 @@
</div>
<div id="zoomSelect" class="select-icon" title="缩放比例">
<select id="zoomValue">
<option value="width"></option>
<option value="width"></option>
<option value="4.0">400%</option>
<option value="3.0">300%</option>
<option value="2.0">200%</option>
@ -111,6 +111,12 @@
d="M820 436h-40c-4.4 0-8 3.6-8 8v40c0 4.4 3.6 8 8 8h40c4.4 0 8-3.6 8-8v-40c0-4.4-3.6-8-8-8zm32-104H732V120c0-4.4-3.6-8-8-8H300c-4.4 0-8 3.6-8 8v212H172c-44.2 0-80 35.8-80 80v328c0 17.7 14.3 32 32 32h168v132c0 4.4 3.6 8 8 8h424c4.4 0 8-3.6 8-8V772h168c17.7 0 32-14.3 32-32V412c0-44.2-35.8-80-80-80zM360 180h304v152H360V180zm304 664H360V568h304v276zm200-140H732V500H292v204H160V412c0-6.6 5.4-12 12-12h680c6.6 0 12 5.4 12 12v292z">
</path>
</svg>
</div>
<div id="line" onclick="line('1')" title="线条" class="btn-icon">
</div>
<div id="line" onclick="line('0')" title="线条" class="btn-icon">
</div>
</div>
</header>
@ -129,5 +135,15 @@
<script src="js/cnofd-view.js"></script>
</body>
<script>
function line(line) {
var url = window.location.href;
if(line ==1){
url = url + "&line=1";
}else{
url = url + "&line=0";
}
window.location.href = url;
}
</script>
</html>

View File

@ -171,33 +171,15 @@ function fileChanged() {
var ext = this.file.name.replace(/.+\./, "");
if (["ofd"].indexOf(ext) === -1) {
this.$alert("error", "仅支持ofd文件类型", {
confirmButtonText: "确定",
callback: function callback(action) {
this.$message({
type: "info",
message: "action: ".concat(action)
});
}
});
window.alert("error仅支持ofd文件类型");
return;
}
if (this.file.size > 10 * 1024 * 1024) {
this.$alert("error", "文件大小超过10MB", {
confirmButtonText: "确定",
callback: function callback(action) {
this.$message({
type: "info",
message: "action: ".concat(action)
});
}
});
if (this.file.size > 20 * 1024 * 1024) {
window.alert("error文件大小超过20MB");
return;
}
// 新打开OFD文件时还原成页面实际尺寸显示
//Object(cnofd["setScaleValue"])(1.0);
Object(cnofd["setScaleValue"])(this.pageZoomScale);
var selectZoom = document.getElementById("zoomValue");
if (selectZoom)
@ -212,7 +194,6 @@ function fileChanged() {
};
this.getOfdDocument(this.file, this.screenWidth, this.pageZoomScale);
//$("#file")[0].value = null;
}
function getOfdDocument(file, screenWidth, pageZoomScale) {
@ -239,15 +220,7 @@ function getOfdDocument(file, screenWidth, pageZoomScale) {
},
fail: function fail(error) {
$("#loading").hide();
alert("OFD打开失败", error, {
confirmButtonText: "确定",
callback: function callback(action) {
this.$message({
type: "info",
message: "action: ".concat(action)
});
}
});
console.log('OFD');
}
});
}
@ -443,9 +416,7 @@ function print() {
}
}
// IE浏览器在iframe里调用打印
function printIE(printhtml) {
//新建一个iframe
var iframe = document.createElement("iframe");
iframe.id = "printf";
iframe.style.width = "0";
@ -453,7 +424,6 @@ function printIE(printhtml) {
iframe.style.height = "0";
iframe.style.border = "none";
//将iframe插入到printBody里
document.body.appendChild(iframe);
setTimeout(function () {

View File

@ -17427,12 +17427,13 @@
s["@_DeltaX"] && s["@_DeltaX"].length > 0 && (c = b(s["@_DeltaX"])),
s["@_DeltaY"] && s["@_DeltaY"].length > 0 && (u = b(s["@_DeltaY"]));
var d = s["#text"];
if (d) {
if ("undefined" == typeof d && "string" == typeof s && (d = s),
d) {
d += "",
d = C(d),
d = d.replace(/&#x20;/g, " ");
for (var l = 0; l < d.length; l++) {
l > 0 && c.length > 0 && (e += c[l - 1]),
l > 0 && c.length > 0 && (l <= c.length ? e += c[l - 1] : e += c[c.length - 1]),
l > 0 && u.length > 0 && (r += u[l - 1]);
var f = d.substring(l, l + 1)
, h = {
@ -22007,7 +22008,13 @@
var M = 0;
while (a["FDSelect"][M + 2] <= e)
M += 2;
R = a["FDArray"][a["FDSelect"][M + 1]]["Private"]
try{
R = a["FDArray"][a["FDSelect"][M + 1]]["Private"]
}
catch(e){
R = a["FDArray"][a["FDSelect"][M + 1]]
}
}
f["_drawCFF"](a["CharStrings"][e], N, a, R, n)
} else if (t["glyf"])
@ -22228,7 +22235,8 @@
}
},
_drawCFF: function(t, e, r, n, o) {
var a = e.stack
try{
var a = e.stack
, s = e.nStems
, c = e.haveWidth
, u = e.width
@ -22253,6 +22261,35 @@
val: 0,
size: 0
};
}
catch(e){
var a = e.stack
, s = e.nStems
, c = e.haveWidth
, u = e.width
, d = e.open
, l = 0
, f = e.x
, h = e.y
, p = 0
, m = 0
, b = 0
, g = 0
, y = 0
, v = 0
, S = 0
, w = 0
, C = 0
, _ = 0
, A = i["T"].CFF
, I = i["U"]["P"]
, E = 0
, T = {
val: 0,
size: 0
};
}
while (t && l < t.length) {
A.getCharString(t, l, T);
var x = T.val;
@ -24359,7 +24396,12 @@
, p = function(t, e, r, i, o, a, s) {
var c = document.createElement("div");
c.setAttribute("style", "overflow: hidden;z-index:0;position:relative;");
var u = e["appearance"]["@_Boundary"];
try{
var u = e["appearance"]["@_Boundary"];
}
catch(e){
var u = e["appearance"];
}
if (u) {
var d = Object(n["d"])(Object(n["k"])(u));
c.setAttribute("style", "overflow: hidden;z-index:0;position:absolute; left: ".concat(d.x, "px; top: ").concat(d.y, "px; width: ").concat(d.w, "px; height: ").concat(d.h, "px"))
@ -24428,10 +24470,18 @@
}
}
, b = function t(e, r, i, o, a, s, u, d, l, f, h) {
var p = null
try{
var p = null
, m = null
, b = Object(n["e"])(.353)
, y = s["@_DrawParam"];
}
catch(e){
var p = null
, m = null
, b = Object(n["e"])(.353)
, y = null;
}
if (y && Object.keys(i).length > 0 && i[y]) {
if (i[y]["relative"]) {
var v = i[y]["relative"];
@ -24443,8 +24493,12 @@
i[y]["StrokeColor"] && (m = Object(n["i"])(i[y]["StrokeColor"])),
i[y]["LineWidth"] && (b = Object(n["e"])(i[y]["LineWidth"]))
}
var C = s["ofd:ImageObject"]
, _ = [];
try{
var C = s["ofd:ImageObject"], _ = [];
}
catch(e){
var C = null, _ = [];
}
_ = _.concat(C);
var A, I = c(_);
try {
@ -24463,8 +24517,12 @@
} finally {
I.f()
}
var P = s["ofd:PathObject"]
, k = [];
try{
var P = s["ofd:PathObject"], k = [];
}
catch(e){
var P = null, k = [];
}
k = k.concat(P);
var D, O = c(k);
try {
@ -24480,8 +24538,13 @@
} finally {
O.f()
}
var M = s["ofd:TextObject"]
, B = [];
try{
var M = s["ofd:TextObject"] , B = [];
}
catch(e){
var M = null , B = [];
}
B = B.concat(M);
var F, j = c(B);
try {
@ -24497,8 +24560,13 @@
} finally {
j.f()
}
var U = s["ofd:CompositeObject"]
, X = [];
try{
var U = s["ofd:CompositeObject"], X = [];
}
catch(e){
var U = null, X = [];
}
X = X.concat(U);
var z, G = c(X);
try {
@ -24536,8 +24604,13 @@
} finally {
G.f()
}
var tt = s["ofd:PageBlock"]
, et = [];
try{
var tt = s["ofd:PageBlock"] , et = [];
}
catch(e){
var tt = null , et = [];
}
et = et.concat(tt);
var rt, nt = c(et);
try {
@ -24738,7 +24811,6 @@
Y = et.split(" ")
}
var rt, nt = 0, it = c(w);
try {
for (it.s(); !(rt = it.n()).done; ) {
var ot = rt.value;
@ -24891,9 +24963,17 @@
}
}
var T = e["ofd:FillColor"];
var url = window.location.href;
var spliceLength2 = url.lastIndexOf("=");
var pathType = url.slice(spliceLength2 + 1);
if (T) {
T["@_Value"] && ((T["@_Value"])),
if(pathType ==1){
T["@_Value"] && ((T["@_Value"])), T["@_Alpha"] && 0 == T["@_Alpha"] && (r = "none");
}else{
T["@_Value"] && (r = Object(n["i"])(T["@_Value"])),
T["@_Alpha"] && 0 == T["@_Alpha"] && (r = "none");
}
var x = T["ofd:AxialShd"];
if (x) {
!0;
@ -25967,7 +26047,7 @@
}
};
function O() {
}
var R = function(t) {
Object(a["n"])(t)