문제 설명
Icepdf 특수 문자 렌더링 문제 (Icepdf special character rendering issue)
PDF 생성을 위한 매우 상세한 렌더링 기능이 있기 때문에 PDF 파일을 생성하기 위해 itext
라이브러리를 사용합니다. 사용자가 버튼을 클릭할 때마다 템플릿을 작성하고 DB의 빈 셀을 채웁니다.
사용자에게 보여주고 생성된 pdf 파일을 출력하기 위해 Icepdf
라이브러리를 사용합니다.
하지만 Icepdf에는 문자 인코딩 문제가 있는 것 같습니다. Icepdf
에서 PDF를 만들고 호출하면 터키어 문자 중 하나가 정사각형으로 보입니다. 터키어 문자는 이 링크에서 볼 수 있습니다. 모든 문자가 성공적으로 렌더링되었지만 그림의 8번째 문자는 렌더링되지 않았습니다.
생성된 pdf 파일의 파일 경로(에 의해 생성됨)로 이동할 때 itext
라이브러리) 모든 문자가 올바르게 표시되도록 Adobe Acrobat Reader를 사용하여 수동으로 엽니다. 그러나 프로그램 방식으로 Icepdf
파일을 열고 사용자에게 표시하면 그림의 8번째 문자가 정사각형으로 보입니다.
Icepdf의 문자 인코딩을 변경해야 하지만 아직 할 수 없습니다. Icepdf
의 문자 및 Font
인코딩에 대한 많은 기사를 읽었지만 아직 성공하지 못했습니다. 이 문자 문제를 해결하면 내 애플리케이션을 배포할 준비가 됩니다.
생성된 PDF 파일을 다운로드할 수 있습니다. 여기.
Adobe Acrobat으로 이 파일을 열면 다음과 같이 표시됩니다.
Than i add below lines to top of my createPDF
method.
Font fontBase = FontFactory.getFont("/resources/times.ttf",
BaseFont.IDENTITY_H,
BaseFont.EMBEDDED,
0.8f, Font.NORMAL,
BaseColor.BLACK);
BaseFont bf = fontBase.getBaseFont();