Jump to content
We've recently updated our Privacy Statement, available here ×

rsneha027

Members
  • Posts

    8
  • Joined

  • Last visited

 Content Type 

Profiles

Forum

Events

Featured Visualizations

Knowledge Base

Documentation (PDF Downloads)

Blog

Documentation (Test Area)

Documentation

Dr. Jaspersoft Webinar Series

Downloads

Everything posted by rsneha027

  1. you have to check that the jar file containing the classes org.nothing.MyClass and org.nothing.MyItem is included in the classpath.
  2. Try this format private void createImage(final JasperReportBuilder reportBuilder, byte[] content) { JasperReportBuilder jasperReportBuilder = report(); // Adjust the values according to your requirements int PAGE_HEIGHT = 100; // Set the desired height int PAGE_WIDTH = 600; // Set the desired width ImageBuilder imageBuilder = cmp.image(getContentAsInputStream(content)); imageBuilder.setFixedHeight(PAGE_HEIGHT); imageBuilder.setFixedWidth(PAGE_WIDTH); imageBuilder.setStretchType(StretchType.CONTAINER_HEIGHT); jasperReportBuilder.setPageMargin(margin().setLeft(0).setRight(0).setBottom(0).setTop(0)); // Add the image to the report jasperReportBuilder.detail(imageBuilder); jasperReportBuilder.detail(cmp.pageBreak()); } Set the fixed height and page margins in the ImageBuilder.
  3. One way you can compress the size of the PDF is by reducing the image resolution. You can try the following code to compress the PDF in Jasper with Java // Assuming 'pdfDoc' is your existing PDF document object // Create a new ByteArrayOutputStream to store the compressed PDF data ByteArrayOutputStream compressedStream = new ByteArrayOutputStream(); // Get the parameters of the image to adjust its resolution Image image = imgArr; // Assuming 'imgArr' is your Java Image object int width = image.getWidth(null); int height = image.getHeight(null); // Create a new BufferedImage with reduced resolution BufferedImage newImage = new BufferedImage(width / 2, height / 2, BufferedImage.TYPE_INT_RGB); Graphics2D g2d = newImage.createGraphics(); g2d.drawImage(image, 0, 0, width / 2, height / 2, null); g2d.dispose(); // Write the new compressed image to the ByteArrayOutputStream ImageIO.write(newImage, "jpg", compressedStream); // Convert the ByteArrayOutputStream to a byte array byte[] compressedImageBytes = compressedStream.toByteArray(); // Use the compressed image data for your PDF creation process This code reduces the resolution of the image by half, which effectively compresses the image data and hence reduces the overall PDF size. This just an example… test it on your dev environment. Also i found one tool jpeg compressor if you have small quantity of image and want fine compression of your images then you can use above tool. it supports such as JPEG, JPG, PNG, SVG, WEBP, GIF, and Heic.
  4. First, create the custom page that you want to display when the session expires. This page can be a simple HTML page or a JSP page, depending on your preference. Save the page in a location accessible to your web server. Open the jasperserver-servlet.xml file located in the WEB-INF directory of your JRS deployment. Look for the following line in the jasperserver-servlet.xml file. <prop key="org.springframework.webflow.execution.repository.NoSuchFlowExecutionException">/customSessionExpiredPage.html</prop> Save the changes to the jasperserver-servlet.xml file and redeploy the JRS application for the changes to take effect.
  5. Follow the steps to resolve it’s redirection. Update Jasper Server's `web.xml` In the `web.xml` file of Jasper Server.```xml <web-app> <!-- Other configurations --> <security-constraint> <web-resource-collection> <web-resource-name>Protected Area</web-resource-name> <url-pattern>/*</url-pattern> </web-resource-collection> <user-data-constraint> <transport-guarantee>CONFIDENTIAL</transport-guarantee> </user-data-constraint> </security-constraint> <!-- Other configurations --> </web-app> ``` Now **Configure Apache to handle HTTPS** This includes installing the SSL certificate and configuring the VirtualHost for port 443 (HTTPS). ```apacheconf <VirtualHost *:443> ServerName your_domain.com # SSL Certificate configurations SSLEngine on SSLCertificateFile /path/to/your_ssl_certificate.crt SSLCertificateKeyFile /path/to/your_ssl_private_key.key SSLCertificateChainFile /path/to/your_ssl_certificate_chain.crt (optional) # Proxy configurations for redirecting to Jasper Server ProxyPass /jasperserver/ http://localhost:8080/jasperserver/ ProxyPassReverse /jasperserver/ http://localhost:8080/jasperserver/ # Other configurations specific to your setup </VirtualHost> ``` **Configure JBoss/Jasper Server for Proxy Forwarding** In JBoss, you need to configure it to be aware that it is running behind a proxy. For this, you can set the `proxyName` and `proxyPort` in JBoss's `server.xml` file (usually located in `JBOSS_HOME/server/default/deploy/jbossweb.sar/server.xml`). ```xml <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" proxyName="your_domain.com" proxyPort="443" /> ``` After making these changes, clear your browser cache and check if its working also you can use this tool redirect check to get details redirection report. If you encounter any issues, check the logs of Apache, JBoss, and Jasper Server for any error messages or warnings that might provide more insights into the problem.
  6. Check if the server is using Keep-Alive connections. If so, make sure JMeter is also using Keep-Alive by setting the httpclient4.parameters property in jmeter.properties to http.connection.stalecheck$Boolean=true. Inspect the response data in the View Results Tree to see if there are any clues about the issue. Look for any error messages or other useful information that might help you identify the problem. Also check if the redirection path in the HTTP response is absolute or relative. You can use this tool redirect checker to get it’s detail redirection path and its status code. Sometimes, applications may use relative URLs for redirection. If the redirection path is relative, make sure it is resolved correctly by the client (JMeter) to access the correct URL.
  7. Automatically redirect to a URL using JasperReports, you can achieve this by leveraging the hyperlinkTarget attribute in the hyperlinkReferenceExpression. The hyperlinkTarget attribute specifies the target window or frame in which the URL should be opened. By setting this attribute to "_blank", you can make the URL open in a new browser tab automatically. You can Try this .. <image hyperlinkType="Reference"> <reportElement key="image-1" x="66" y="0" width="20" height="15"/> <imageExpression class="java.lang.String"><![CDATA["images/goto.gif"]]></imageExpression> <hyperlinkReferenceExpression><![CDATA["blablabla.html"]]></hyperlinkReferenceExpression> <hyperlinkTargetExpression><![CDATA["_blank"]]></hyperlinkTargetExpression> </image> In the modified code snippet above, I added the <hyperlinkTargetExpression> element with the value "_blank". This will cause the link to open in a new browser tab when the report is viewed, effectively auto-redirecting the user to the specified URL.
×
×
  • Create New...