我的代码生成阿拉伯语隐藏文本pdf如下。我在图像下添加文字。制作pdf后,按ctrl + a时无法看到文字。这只发生在阿拉伯字符中,而不是英文字符:
Adobe Reader - >当我按ctrl + a时,它只突出显示位置但不显示文本
Ubuntu文档查看器 - >当我按下ctrl + a时,它会突出显示并显示一些文本。当我尝试用鼠标选择时,它会显示所有这些。
可能是什么原因?当我按ctrl + a按钮时,如何确保查看所有隐藏文本?
...
Document document = new Document();
PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("output.pdf"));
document.open();
Image image = Image.getInstance("/home/burak/IdeaProjects/example.jpg");
image.setAbsolutePosition(0, 0);
document.setPageSize(new Rectangle(image.getWidth(), image.getHeight()));
document.add(image);
PdfContentByte contentByte;
contentByte = writer.getDirectContentUnder();
contentByte.beginText();
contentByte.moveText(100, 100);
contentByte.setFontAndSize(BaseFont.createFont("data/simpo.ttf", BaseFont.IDENTITY_H, true), 30);
contentByte.showText("100-100-ﻡﻭﺱﻯ ﺍﻭﻍﻝﻯ ﺍﺱﻡﺍﻉﻯﻝ");
contentByte.endText();
contentByte.beginText();
contentByte.moveText(100, 200);
contentByte.setFontAndSize(BaseFont.createFont("data/simpo.ttf", BaseFont.IDENTITY_H, true), 30);
contentByte.showText("100-200-ﻡﻭﺱﻯ ﺍﻭﻍﻝﻯ ﺍﺱﻡﺍﻉﻯﻝ");
contentByte.endText();
contentByte.beginText();
contentByte.moveText(100, 300);
contentByte.setFontAndSize(BaseFont.createFont("data/simpo.ttf", BaseFont.IDENTITY_H, true), 30);
contentByte.showText("100-300-ﻡﻭﺱﻯ ﺍﻭﻍﻝﻯ ﺍﺱﻡﺍﻉﻯﻝ");
contentByte.endText();
contentByte.beginText();
contentByte.moveText(0, 0);
contentByte.setFontAndSize(BaseFont.createFont("data/simpo.ttf", BaseFont.IDENTITY_H, true), 30);
contentByte.showText("0-0-ﻡﻭﺱﻯ ﺍﻭﻍﻝﻯ ﺍﺱﻡﺍﻉﻯﻝ");
contentByte.endText();
contentByte.beginText();
contentByte.moveText(120, 290);
contentByte.setFontAndSize(BaseFont.createFont("data/simpo.ttf", BaseFont.IDENTITY_H, true), 30);
contentByte.showText("120-290-ﻡﻭﺱﻯ ﺍﻭﻍﻝﻯ ﺍﺱﻡﺍﻉﻯﻝ");
contentByte.endText();
contentByte.beginText();
contentByte.moveText(120, 310);
contentByte.setFontAndSize(BaseFont.createFont("data/simpo.ttf", BaseFont.IDENTITY_H, true), 30);
contentByte.showText("120-300-ﻡﻭﺱﻯ ﺍﻭﻍﻝﻯ ﺍﺱﻡﺍﻉﻯﻝ");
contentByte.endText();
document.close();
...
提前致谢