You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
2.2 KiB
51 lines
2.2 KiB
package com.fr.plugin.ajhdf.export; |
|
|
|
import com.fanruan.api.i18n.I18nKit; |
|
import com.fanruan.api.log.LogKit; |
|
import com.fr.general.ComparatorUtils; |
|
import com.fr.io.exporter.PDFExporter; |
|
import com.fr.main.workbook.ResultWorkBook; |
|
import com.fr.page.PagePainterProvider; |
|
import com.fr.page.ReportPageProvider; |
|
import com.fr.plugin.ajhdf.painter.PagePainterPlus; |
|
import com.fr.plugin.ajhdf.provider.PdfExportAttr; |
|
import com.fr.plugin.context.PluginContexts; |
|
import com.fr.stable.bridge.StableFactory; |
|
|
|
import java.awt.*; |
|
import java.io.OutputStream; |
|
import java.util.HashMap; |
|
|
|
/** |
|
* 直接继承默认的pdf导出exporter,PDFExporter |
|
*/ |
|
public class PDFExporterPlus extends PDFExporter { |
|
private float scale; |
|
|
|
public PDFExporterPlus() { |
|
} |
|
|
|
@Override |
|
public void export(OutputStream outputStream, ResultWorkBook resultWorkBook, int[] ints) throws Exception { |
|
if (ComparatorUtils.equals(this.scale, 0.0f)) { |
|
try { |
|
PdfExportAttr pdfExportAttr = resultWorkBook.getAttrMark(PdfExportAttr.XML_TAG); |
|
this.scale = pdfExportAttr.getStrokeScale(); |
|
} catch (Exception e) { |
|
} |
|
} |
|
super.export(outputStream, resultWorkBook, ints); |
|
} |
|
|
|
@Override |
|
protected PagePainterProvider getPagePainterProvider(ReportPageProvider reportPageProvider, Graphics2D graphics2D, HashMap<String, Class> hashMap) { |
|
if (PluginContexts.currentContext() == null || !PluginContexts.currentContext().isAvailable()) { |
|
LogKit.error(I18nKit.getLocText("Plugin-ajhdf_licence_Expired")); |
|
return StableFactory.getMarkedInstanceObjectFromClass("PagePainter", new Object[]{reportPageProvider, graphics2D, Integer.valueOf(String.valueOf(96)), Boolean.FALSE}, hashMap, PagePainterProvider.class, null); |
|
} |
|
if (ComparatorUtils.equals(this.scale, 0.0f)) { |
|
return StableFactory.getMarkedInstanceObjectFromClass("PagePainter", new Object[]{reportPageProvider, graphics2D, Integer.valueOf(String.valueOf(96)), Boolean.FALSE}, hashMap, PagePainterProvider.class, null); |
|
} |
|
return new PagePainterPlus(reportPageProvider, graphics2D, 96, Boolean.FALSE, this.scale); |
|
} |
|
}
|
|
|