我正在尝试找到一种可以将WinAnsiEncoding更改为Unicode 的方法,我尝试过像这样设置字体,
PDDocument doc = new PDDocument();
PDPage page = new PDPage(PDRectangle.A4);
doc.addPage(page);
File unicodeFileLocation = new File(getServletContext().getRealPath("/lib/ARIALUNI.TTF"));
PDTrueTypeFont unicodeFont = PDTrueTypeFont.loadTTF(doc, unicodeFileLocation);
...
// Create Table using boxable API
BaseTable table = new BaseTable(yStart, yStartNewPage, bottomMargin, tableWidth, margin, doc, page, true, drawContent);
// Title Field
Row<PDPage> titleRow = table.createRow(rowHeight);
Cell<PDPage> cell = titleRow.createCell(30, "Title");
cell = titleRow.createCell(70, TitleText);
cell.setFont(unicodeFont);
table.draw();
Run Code Online (Sandbox Code Playgroud)
对于简单的文本,这工作正常,我可以看到 Helvetica 的字体变化,但如果文本包含 UTF-8 字符(例如 U+0083 等),我只会看到抛出以下异常,
java.lang.IllegalArgumentException:U+0083在此字体的编码中不可用:WinAnsiEncoding org.apache.pdfbox.pdmodel.font.PDTrueTypeFont.encode(PDTrueTypeFont.java:371) org.apache.pdfbox.pdmodel.font.PDFont。编码(PDFont.java:316)org.apache.pdfbox.pdmodel.font.PDFont.getStringWidth(PDFont.java:345)be.quodlibet.boxable.text.PipelineLayer.push(PipelineLayer.java:65)be.quodlibet。 boxable.Paragraph.getLines(Paragraph.java:341) be.quodlibet.boxable.Paragraph.getHeight(Paragraph.java:465) be.quodlibet.boxable.Cell.getTextHeight(Cell.java:392) be.quodlibet.boxable。 Cell.getCellHeight(Cell.java:367) …
希望你们一切顺利。这可能是一个简单的问题,也是一个非常简单的解决方案,但我有点陷入这个问题,不太确定如何摆脱它。希望,如果你们中有人能帮忙的话。问题如下,
我有一个包含 3 个输入、文件 + 2 个文本输入的表单。表单的代码如下,
<form id="image_upload_form" enctype="multipart/form-data" method="POST">
Select File : <input type="file" id="image_file" /><br>
Time to Display :<input type="text" id="time_to_display" /><br>
Sequence No: <input type="text" id="sequence_no" />
</form>
Run Code Online (Sandbox Code Playgroud)
该表单出现在 jQuery 的对话框内,因此当我按下对话框上的“保存”按钮时,它会提交值。其代码如下,
$( "#someDivDialogBox" ).dialog({
autoOpen: false,
height: 300,
width: 576,
modal: true,
buttons: {
Save: function() {
$("#image_upload_form").submit(function(e) {
var url = Util.getBaseURL() + "Uploads/Images?sid=" + Math.random();
$(this).attr("action", url);
});
$("#image_upload_form").submit();
},
Cancel: function() {
// Do Something Here
},
close: function() {
$(this).hide();
}
} …Run Code Online (Sandbox Code Playgroud) 似乎标题是不言自明的,但要详细说明,这里是我遇到的麻烦,我有一系列折线,我在地图上显示,现在我的目标是,当我将鼠标悬停在列表中的某个折线,只有该折线突出显示(或更改颜色).我现在所拥有的是这样的(这段代码在一个循环中,最后用polyline数据填充polyLineArray,
var pointList = [];
// pointList is an array and lat/lngs
var polyLineProperties = {
color: 'red',
opacity: 1,
weight: 5,
clickable: true
}
var polyLine = new L.polyline(pointList, polyLineProperties);
polyLine.on('mouseover', function() {
// WHAT TO DO HERE to HIGHLIGHT that specific polyline.
});
polyLineArray.push(polyLine);
Run Code Online (Sandbox Code Playgroud)
希望有人可以帮助我,这将是很好的,如果有人甚至可以建议如何改变折线的任何属性,而不仅仅是颜色.
谢谢你,等待你的回复:)
我对jQuery比较陌生,我试图解决这个代码但是经常失败,我面临的问题是,我有一个gloval数组(Roles_Permission),我能够在我的AJAX请求中使用它,我也是能够对阵列的内容进行更改,但是当我出来的那一刻,所有的全局值都回归原始值,为什么?!?需要帮忙.请看下面的代码,
// Global Variable
var Role_Permission = {
"Value1" : true;
"Value2" : true;
"Value3" : true;
}
Run Code Online (Sandbox Code Playgroud)
现在我有一个如下功能,
function checkRoles(){
requestData(
"roleData",
{ roleName: "testUser"},
function(result){
Role_Permission["Value2"] = false;
alert(Role_Permission["Value2"]);
}
});
alert(Role_Permission["Value2"]);
}
Run Code Online (Sandbox Code Playgroud)
AJAX外部的警报将Value2的值返回为True但是,在其中返回为FALSE,为什么?!?请帮忙
谢谢