3737import java .io .IOException ;
3838import java .io .InputStream ;
3939import java .net .URL ;
40+ import java .nio .charset .StandardCharsets ;
4041import java .util .ArrayList ;
4142import java .util .Arrays ;
4243import java .util .LinkedHashSet ;
@@ -125,7 +126,14 @@ public ReportDocument export() throws IOException {
125126 case XML :
126127 exporter .setConfiguration (createXmlExporterConfiguration ());
127128 exporter .setReportContext (createXmlReportContext ());
129+ exporter .setExporterOutput (
130+ new SimpleOutputStreamExporterOutput (out ));
131+ break ;
128132 case PDF :
133+ exporter .setConfiguration (createPdfExporterConfiguration ());
134+ exporter .setExporterOutput (
135+ new SimpleOutputStreamExporterOutput (out ));
136+ break ;
129137 default :
130138 exporter .setExporterOutput (
131139 new SimpleOutputStreamExporterOutput (out ));
@@ -136,6 +144,9 @@ public ReportDocument export() throws IOException {
136144 exporter .setExporterInput (exporterInput );
137145 exporter .exportReport ();
138146 bytes = out .toByteArray ();
147+ if (ReportFormat .PDF .equals (format )) {
148+ logPdfActualTextDiagnostic (bytes );
149+ }
139150 } catch (final Exception ex ) {
140151 final String msg = "Could not export report" ;
141152 LOG .log (Level .SEVERE , msg , ex );
@@ -401,6 +412,17 @@ private SimpleCsvExporterConfiguration createCsvExporterConfiguration() {
401412 return new SimpleCsvExporterConfiguration ();
402413 }
403414
415+ private SimplePdfExporterConfiguration createPdfExporterConfiguration () {
416+ final SimplePdfExporterConfiguration configuration = new SimplePdfExporterConfiguration ();
417+ configuration .setCompressed (false );
418+ return configuration ;
419+ }
420+
421+ private void logPdfActualTextDiagnostic (final byte [] bytes ) {
422+ final String pdfContent = new String (bytes , StandardCharsets .ISO_8859_1 );
423+ LOG .info ("PDF ActualText marker present=" + pdfContent .contains ("/ActualText" ));
424+ }
425+
404426 /**
405427 * Creates a data source outside of the parameter map used in marshaling.
406428 *
0 commit comments