Thread: printing landscape

  1. #1
    Registered User
    Join Date
    Mar 2004
    Posts
    66

    printing landscape

    Is there any code i could add to this function to make it print landscape rather than portrait?

    Code:
    /* PRINT CUSTOMER DETAILS */
    void f_print_customer ( void )
    
    {
    
      FILE            *fp = fopen ( "customers", "rb"  );
      FILE            *printer = fopen( printerDevice, "w" );
    
      CUSTOMERRECORD cr;
    
      char continue_c;
      
      if ( printer == NULL )
      {
        	printf( "PRINT HALTED: Unable to access printer" );
        	return;
      }
    
      if ( ( fp = fopen( "customers", "rb" ) ) == NULL )
      {
        	printf( "The file does not exist." );
        	return;
      }
    
                    /* prints time and date */
                    {
                    	time_t rawtime;
                    	time (  &rawtime  );
                    	fprintf ( printer, "Printed on %s\n", ctime ( &rawtime )  );
                    }
    		fprintf( printer, "___________________________________________________________\n" );
    		fprintf( printer, "DESIGNER DETAILS\n\n" );
    
    
        while ( fread( &cr, sizeof( cr ), 1, fp ) == 1 &&
        fprintf( printer, "%d %10s %19s %14s %8s %13s %5s %10s\n", num_of_items_i + 1,
                               cr.surname_s, cr.address1_s,
                               cr.city_s , cr.postcode_s,
                               cr.telephone_s, cr.time_s, cr.date_s ) > 0 )
    
        printf( "Print complete" );
    
        		do{
    			printf ( "\n\nPress y to continue..." );
    			fflush( 0 );
    			scanf ( "%c", &continue_c );
    		  }
    		  while (  continue_c != 'Y'  &&  continue_c != 'y'  );
    
      fclose( fp );
      fclose( printer );
    }

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    You have to use printer specific escape sequences.
    Google for code examples, but you'll have to lookup escape sequences for your printer.

    The other alternitive is to use OS specific printing libraries (like the Win32 API under Windows).

    gg

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C# Printing Problem
    By silverlight001 in forum C# Programming
    Replies: 0
    Last Post: 03-23-2009, 01:13 AM
  2. Printing Lines to .txt File
    By Programmer3922 in forum C Programming
    Replies: 2
    Last Post: 08-02-2008, 12:45 PM
  3. generic printing preferences dialog box
    By stanlvw in forum Windows Programming
    Replies: 8
    Last Post: 06-27-2008, 02:20 AM
  4. printing data to a file
    By coralreef in forum C Programming
    Replies: 3
    Last Post: 11-02-2006, 08:10 PM
  5. need help relating printing?
    By omarlodhi in forum Linux Programming
    Replies: 0
    Last Post: 03-03-2006, 04:46 AM