Jump to content

venkatesh.kannuru

Members
  • Posts

    1
  • Joined

  • Last visited

 Content Type 

Forum

Downloads

Featured Visualizations

Knowledge Base

Documentation (PDF Downloads)

Blog

Documentation (Test Area)

Documentation

Dr. Jaspersoft Webinar Series

Security Advisories

Events

Profiles

Posts posted by venkatesh.kannuru

  1. 1.Create a Class as follows:-

    public class ReportUtils
    {
        public static void mirrorLayout(JasperPrint print)
        {
        int pageWidth = print.getPageWidth();
        for (Iterator it = print.getPages().iterator(); it.hasNext();)
        {
            JRPrintPage page = (JRPrintPage) it.next();
            mirrorLayout(page.getElements(), pageWidth);
        }
        }
     
        protected static void mirrorLayout(List elements, int totalWidth)
        {
        for (Iterator it = elements.iterator(); it.hasNext();)
        {
            JRPrintElement element = (JRPrintElement) it.next();
            int mirrorX = totalWidth - element.getX() - element.getWidth();
            element.setX(mirrorX);
     
            if (element instanceof JRPrintFrame)
            {
            JRPrintFrame frame = (JRPrintFrame) element;
            mirrorLayout(frame.getElements(), frame.getWidth());
            }
        }
        }
    }

    2. Call this method from your present Class,  like follows

    try {
                Connection con = JavaConnection.GetCon();
                JasperDesign jd = JRXmlLoader.load("report1.jrxml"); // your report path and name
                JasperReport jr = JasperCompileManager.compileReport(jd);
                JasperPrint jp = JasperFillManager.fillReport(jr, null, con);
                ReportUtils.mirrorLayout(print); //for Arabic print right to left mirror
                JasperPrintManager.printReport(jp,false);// it will send print directly to printer
            } catch (JRException e) {
                JOptionPane.showMessageDialog(null, e);
            }

×
×
  • Create New...