Jump to content
JasperReports Library 7.0 is now available ×

aradicev

Members
  • Posts

    3
  • Joined

  • Last visited

aradicev's Achievements

Newbie

Newbie (1/14)

  • One Month Later
  • First Post Rare
  • Week One Done
  • Conversation Starter Rare

Recent Badges

0

Reputation

  1. Hi, I have created a template with jaspresoft stucio 7.0.0 for version 6.20.6 which I am using from my spring boot application. When I run it from my local machine it works fine, however after deploying the jar to a linux server the vertical alignment of a static text, which should be bottom aligned, it does not apply any more, it seams to be middle aligned. regards Andrija
  2. Hi Lucian, thank you for you answer but that's exactly what I have done and I got this exception. As I said, after I have added the dependency to the version 6.20.6 I got rid of this exception. regards Andrija
  3. Hi, I'm using community edition of Jaspersoft Studio and have created a very simple template which I am using in my Spring boot application. When I try to create the report, the application breaks with the exception net.sf.jasperreports.engine.JRRuntimeException: Missing JasperReports PDF Extension (jasperreports-pdf-x.x.x.jar) when calling the method JasperExportManager.exportReportToPdf. Can someone tell me what am I doing wrong? ma jrxml file: <!-- Created with Jaspersoft Studio version 7.0.0.final using JasperReports Library version 7.0.0-b478feaa9aab4375eba71de77b4ca138ad2f62aa --> <jasperReport name="machine" language="java" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="5342457c-ca3c-448c-8044-41f83ffc1ed0"> <parameter name="brandLogo" class="java.io.InputStream"/> <parameter name="machineName" class="java.lang.String"/> <query language="sql"><![CDATA[]]></query> <background splitType="Stretch"/> <title height="264" splitType="Stretch"> <element kind="image" uuid="7bc2d9b0-a3d5-46bf-b07f-d0ec01e5d051" x="10" y="10" width="80" height="20" linkType="None" linkTarget="Self"> <expression><![CDATA[$P{brandLogo}]]></expression> <property name="com.jaspersoft.studio.unit.width" value="px"/> </element> <element kind="textField" uuid="92ea5b34-3219-43b6-bcc1-21ccf15f1065" x="10" y="30" width="80" height="30" fontSize="12.0" vTextAlign="Middle"> <expression><![CDATA[$P{machineName}]]></expression> <property name="com.jaspersoft.studio.unit.height" value="px"/> </element> <element kind="frame" uuid="c6e7b692-9163-4148-901f-60bb3fff3e9f" x="10" y="64" width="270" height="200"/> </title> <pageHeader height="35" splitType="Stretch"/> <columnHeader height="61" splitType="Stretch"/> <detail> <band height="125" splitType="Stretch"/> </detail> <columnFooter height="45" splitType="Stretch"/> <pageFooter height="54" splitType="Stretch"/> <summary height="42" splitType="Stretch"/> </jasperReport> my service for pdf creation: @Service public class JasperReportService { private static final Logger log = LoggerFactory.getLogger(JasperReportService.class); public byte[] fetchMachineReport(MachinesInfo machinesInfo) throws Exception { JasperReport jasperReport; try { jasperReport = (JasperReport) JRLoader.loadObject(ResourceUtils.getFile("machine.jrxml")); } catch (FileNotFoundException | JRException e) { try { File file = ResourceUtils.getFile("classpath:machine.jrxml"); jasperReport = JasperCompileManager.compileReport(file.getAbsolutePath()); JRSaver.saveObject(jasperReport, "machine.jasper"); } catch (FileNotFoundException | JRException e1) { log.error(e1.getLocalizedMessage()); e.printStackTrace(); throw new Exception("System error!"); } } // JRBeanCollectionDataSource dataSource = new JRBeanCollectionDataSource(machinesInfo.machineList()); Map<String, Object> parametersMap = new HashMap<>(); JasperPrint jasperPrint = null; byte[] pdfReport = null; InputStream brandLogoInputStream = new ByteArrayInputStream(machinesInfo.machineList().get(0).machinePicture()); parametersMap.put("brandLogo", brandLogoInputStream); parametersMap.put("machineName", machinesInfo.machineList().get(0).machineModel()); try { jasperPrint = JasperFillManager.fillReport(jasperReport, parametersMap, new JREmptyDataSource()); pdfReport = JasperExportManager.exportReportToPdf(jasperPrint); } catch (JRException | JRRuntimeException e) { log.error(e.getLocalizedMessage()); e.printStackTrace(); throw new Exception("System error!"); } return pdfReport; } }
×
×
  • Create New...