jasper-reports
pdf로 내보내기
수색…
비고
pdf에서 글꼴을 올바르게 렌더링하려면 글꼴 확장 을 항상 사용해야합니다 (classpath에서)
IDE (통합 개발 환경)
재스퍼 소프트 스튜디오
미리보기에서 녹색 화살표를 클릭하여 보고서를 실행합니다. 오류가 없으면 내보내기 메뉴가 활성화되고 내보내기 버튼 (디스크 이미지)을 클릭하고 "PDF로 내보내기"를 선택합니다.
Java 사용
엑스포트하려면 JasperPrint 개체를 얻기 위해 보고서 를 작성 해야합니다.
단일 JasperPrint (단일 jrxml)를 파일로 내보내기
// 1. Create exporter instance
JRPdfExporter exporter = new JRPdfExporter();
// 2. Set exporter input document
exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
// 3. Set file path for exporter output
exporter.setExporterOutput(new SimpleOutputStreamExporterOutput("/path/filename.pdf"));
// 4. Create configuration instance
SimplePdfExporterConfiguration configuration = new SimplePdfExporterConfiguration();
// 5. Associate configuration with exporter
exporter.setConfiguration(configuration);
// 6. Fill export and write to file path
exporter.exportReport();
여러 JasperPrint (다중 jrxml)를 단일 파일로 내보내기
첫 번째 단계 만 이전 세트와 다릅니다.
List<JasperPrint> jasperPrintList = new ArrayList<>();
jasperPrintList.add(jasperPrint1);
jasperPrintList.add(jasperPrint2);
JRPdfExporter exporter = new JRPdfExporter();
exporter.setExporterInput(SimpleExporterInput.getInstance(jasperPrintList));
나머지 단계는 동일합니다.
exporter.setExporterOutput(new SimpleOutputStreamExporterOutput("/path/filename.pdf"));
SimplePdfExporterConfiguration configuration = new SimplePdfExporterConfiguration();
exporter.setConfiguration(configuration);
exporter.exportReport();
구성에 대한 자세한 내용은 SimplePdfExporterConfiguration API 를 참조하십시오.
Modified text is an extract of the original Stack Overflow Documentation
아래 라이선스 CC BY-SA 3.0
와 제휴하지 않음 Stack Overflow