Hitachi Vantara Pentaho Community Forums
Results 1 to 3 of 3

Thread: Print On Page Of Different Size

  1. #1

    Default Print On Page Of Different Size

    Hi Friends,
    I am trying to print on a paper with size 15.2X15.3 mm. I have no Idea of how to set the size of it.
    Thanking You,
    Sohil Surti

  2. #2

    Default

    Hi,

    I think you have to use the following classes :

    from JFreeReport :
    PageDefinition (SimplePageDefinition)

    from Java :
    PageFormat
    Paper

    and set the PageDefinition to the JFreeReport Object.
    May the Moo force be with you,
    Said Mimil

    A student of JFree & Pentaho Academies,
    Cedric Pronzato

  3. #3

    Default Ok I Got It

    Code:
    import java.awt.print.PageFormat;
    import java.awt.print.Paper;
    import org.jfree.report.SimplePageDefinition;
    import org.jfree.report.util.PageFormatFactory;
    
    report.setPageDefinition(createPageDefinition());
    
    private SimplePageDefinition createPageDefinition()
    	{		
    		SimplePageDefinition definition = null;
    		try
    		{		
    			final PageFormatFactory pff = PageFormatFactory.getInstance();
    			Paper paper = new Paper();
    			paper.setSize(6*75,6*75);
    			//paper,top,left,bottom,right
    			pff.setBorders(paper,20,40,10,10);
    			PageFormat format = pff.createPageFormat(paper,PageFormat.PORTRAIT);
    			definition = new SimplePageDefinition(format);
    		}
    		catch(Exception ex)
    		{
    			JOptionPane.showMessageDialog(cp,"Error In CreatePageDefinition : " + ex ,"Report Error",JOptionPane.ERROR_MESSAGE);
    		}
    		return definition;
    	}
    This Is The PageDefinition Code I Have Used.
    If Any One Has Some Confusion Than I Will Try To Give More Code.

    Thank You.
    Thanking You,
    Sohil Surti

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.