Jasper report
15317 ワード
jasper report Studio
https://sourceforge.net/projects/jasperstudio/

1.ダウンロードしてDBに接続します。




globals.属性のDB情報を参照してください



進行中のプロジェクトlibのojdbc 6.jarがあるので追加できます.



成功した場合、接続は成功しました

2.レポートテンプレートの作成








下に枠線だけを付ける場合は、上の枠線をクリックし、ペン幅を0.00に設定します.














3.pdfハングルの設定
それをそのままプロジェクトに入れてプリントアウトすれば、ハングルはありません.
オールですが、出力だけでいいのですが・・・


あなたが使っているフォントをFontNameに書くことができます.
fontsフォルダに澄んだゴシックを入れるのでmalgun.ttfを使用するように設定します.
4.vo形式に名前を変更

あとはプレビューできないかも・・・
5.テンプレート完了

注:大学の成績のように、いくつかの行に分けてテキストを印刷するには、shift+enterだけでいいです.
Javaプロジェクトとともにpdfを出力
1.jasper reportテンプレートをプロジェクトに配置する
プロジェクトリソースの下にフォルダを作成し、作成したテンプレートを入れます.

2.依存項目の追加
<!-- https://mvnrepository.com/artifact/net.sf.jasperreports/jasperreports -->
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>6.17.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/net.sf.jasperreports/jasperreports-functions -->
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports-functions</artifactId>
<version>6.17.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/net.sf.jasperreports/jasperreports-fonts -->
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports-fonts</artifactId>
<version>6.17.0</version>
</dependency>
3.フォント&フォントを保存します。xmlの生成

ttfファイルに入れればいいです.
プロジェクトでpdfを生成する場合、jasper report studioに指定した明確なゴシックフォントを見つけさせます.xmlを作成します.
<?xml version="1.0" encoding="UTF-8"?>
<fontFamilies>
<fontFamily name="맑은 고딕">
<normal>fonts/malgun.ttf</normal>
<pdfEncoding>Identity-H</pdfEncoding>
<pdfEmbedded>true</pdfEmbedded>
<exportFonts>
<export key="net.sf.jasperreports.html">'맑은 고딕', 'Malgun Gothic', Arial, sans-serif</export>
<export key="net.sf.jasperreports.xhtml">'맑은 고딕', 'Malgun Gothic', Arial, sans-serif</export>
</exportFonts>
</fontFamily>
</fontFamilies>
4.jasperプロパティの作成

propertiesに入れます.
net.sf.jasperreports.extension.registry.factory.fonts=net.sf.jasperreports.engine.fonts.SimpleFontExtensionsRegistryFactory
net.sf.jasperreports.extension.simple.font.families.ireportfamily1629770262716=fonts/fontsfamily1629770262716.xml

5.サーバ上でpdfを作成する
画面でボタンをクリックしたときにpdfを生成して画面に表示したいです.
ボタン->コントローラpdf生成->ファイル名return->jspのpdfObject.jsで開く
ajaxに移動してからファイル名を受信できます.
5-1. controller
@RequestMapping(value = "매핑주소", method = RequestMethod.POST, produces = MediaType.TEXT_PLAIN_VALUE)
@ResponseBody
public String generatedReportMozipInwon(MozipInwonStatusVO mozipInwonStatusVO, HttpServletRequest request) throws Exception {
// 데이터 조회
List<?> mozipInwonList = mozipInwonStatusService.generateReportData(mozipInwonStatusVO);
//pdf 생성하여 파일이름 리턴받음
String resultStr = mozipInwonStatusService.generateReportMozipInwon(mozipInwonList, request);
return resultStr;
}
5-2. service

jsp団は6日...
6. pdf.js + pdfObject.jsを使用してpdfを画面に出力
サーバにpdf自体を投げ出し、jpsにembedsrcを入れてもpdfが見えますがEXでは実現できません.
だからpdfjsまたはpdfObjectと書いてあります.

pdf.jsとpdfObject.jsをすべてjpsに入れた後

シナリオを書いてあげます.
6-1. jsp関数の作成
function fn_print() {
$.ajax({
type :'POST',
url :'${contextPath}/매핑주소',
data : $("#searchVO").serialize(),
dataType: 'text',
async : false,
success : function(data){
var options = {
pdfOpenParams: {
navpanes: 0,
toolbar: 0,
statusbar: 0,
view: "FitV",
page: 1
},
width : "100%",
height: "600px",
forcePDFJS: true,
PDFJS_URL: "${contextPath }/resources/default/js/pdf/pdfjs/web/viewer.html"
}
PDFObject.embed("${contextPath}/pdf/"+data+".pdf", "#myPdf", options);
popOpen("#pop-print");
},
error : function(error) {
alert(error.status);
}
})
}

Reference
この問題について(Jasper report), 我々は、より多くの情報をここで見つけました https://velog.io/@ysb0118/Jasper-reportテキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol