Menu

#348 DrJava won't save to PDF (mac)

v1.0 (example)
open
nobody
None
5
2018-11-10
2018-11-09
Christian
No

I'm trying to make a program that creates a new PDF file using reportPrinter. However, upon running the program, the print menu opens, and picking "Save as PDF" does nothing. It doesn't save a new PDF file, nor does it change an old one if I try to overwrite it. Printing the code itself also does not work.

The code I am trying to print is:

`package Assign_6_1;

import BasicIO.; // for IO classes
import java.util.
; // for Dates
import static BasicIO.Formats.; // for field formats
import static java.lang.Math.
; // for math constants and functions

/* This class ...
*
* @author <your name="">
* @version 1.0 (<date>) </date></your>
/

public class A {

// private ASCIIDataFile f;
private ReportPrinter report;
// private ASCIIOutputFile o;
// instance variables

/** This constructor ...                                                     */

public A ( ) { 
 // f = new ASCIIDataFile();
//  o = new ASCIIOutputFile();
  report = new ReportPrinter();
  //report.addField("name", "Team Name", 10);
 report.addField("points", "Points", 10);
//  for ( ;; ) {

  //  if (f.isEOF()) break;

   report.writeString("points","this is a test");
  //  o.writeInt(calcPoints(1,3));
//  };

   // o.close();
    System.out.println("save");

    report.close();

    System.out.println("closed");

    // statements

}; // constructor

 private int calcPoints ( int goalsFor, int goalsAgainst ) { 
   int points;
   points = 1;
   if (goalsFor > goalsAgainst) {
     points++;
   };
   if (goalsFor < goalsAgainst) {
     points--;
   };
   return points;
 };

public static void main ( String[] args ) { A c = new A(); };

 `
 The multiple commented code lines are all things I've tried that didn't change the result. DrJava simply won't print to PDF on my computer (MacBook Pro 2018 running 10.14 Mojave). I do get the "save" and "closed" lines in my interactions pane, so the code does proceed past those points, but it just won't save the file.

 The DrJava information is:

DrJava Version : drjava-20160913-225446
DrJava Build Time: 20160913-225446

DrJava Configuration File: /Users/work/.drjava

Used memory: about 120.56 megabytes
Free memory: about 254.94 megabytes
Total memory: about 375.50 megabytes
Total memory can expand to: about 3.56 gigabytes

(this version is mandatory - it must be that one)

Related

Support Requests: #348

Discussion

  • Christian

    Christian - 2018-11-09

    Sorry about the formatting issues regarding the code.

     
    • Robert Cartwright

      Hi Christian,

      I have never used the ReportPrinter library class. Does your program run
      from the command line? If you send me the source code for your program (as
      an attachment?) I can try running it on my Linux and Windows machines. I
      no longer use Macs for a variety of reasons. I don't own one personally
      and we no longer have any Macs in my research lab.

      Best,

      Corky

      On Fri, Nov 9, 2018 at 3:00 PM Christian halt19@users.sourceforge.net
      wrote:

      Sorry about the formatting issues regarding the code.

      Status: open
      Group: v1.0 (example)
      Created: Fri Nov 09, 2018 08:58 PM UTC by Christian
      Last Updated: Fri Nov 09, 2018 08:58 PM UTC
      Owner: nobody

      I'm trying to make a program that creates a new PDF file using
      reportPrinter. However, upon running the program, the print menu opens, and
      picking "Save as PDF" does nothing. It doesn't save a new PDF file, nor
      does it change an old one if I try to overwrite it. Printing the code
      itself also does not work.

      The code I am trying to print is:

      `package Assign_6_1;

      import BasicIO.
      ; // for IO classes import java.util.; // for Dates
      import static BasicIO.Formats.
      ; // for field formats import static java.lang.Math.; // for math
      constants and functions

      /*

      • This class ... * @author <your name=""> * @version 1.0 (<date>)
        </date></your>
        /

      public class A {

      // private ASCIIDataFile f;
      private ReportPrinter report;
      // private ASCIIOutputFile o;
      // instance variables

      /* This constructor ... /
      public A ( ) {
      // f = new ASCIIDataFile();
      // o = new ASCIIOutputFile();
      report = new ReportPrinter();
      //report.addField("name", "Team Name", 10);
      report.addField("points", "Points", 10);
      // for ( ;; ) {

      // if (f.isEOF()) break;

      report.writeString("points","this is a test");
      // o.writeInt(calcPoints(1,3));
      // };

      // o.close();
      System.out.println("save");

      report.close();
      
      System.out.println("closed");
      
      // statements
      

      }; // constructor

      private int calcPoints ( int goalsFor, int goalsAgainst ) {
      int points;
      points = 1;
      if (goalsFor > goalsAgainst) {
      points++;
      };
      if (goalsFor < goalsAgainst) {
      points--;
      };
      return points;
      };
      public static void main ( String[] args ) { A c = new A(); };

      `
      The multiple commented code lines are all things I've tried that didn't change the result. DrJava simply won't print to PDF on my computer (MacBook Pro 2018 running 10.14 Mojave). I do get the "save" and "closed" lines in my interactions pane, so the code does proceed past those points, but it just won't save the file.

      The DrJava information is:

      DrJava Version : drjava-20160913-225446
      DrJava Build Time: 20160913-225446

      DrJava Configuration File: /Users/work/.drjava

      Used memory: about 120.56 megabytes
      Free memory: about 254.94 megabytes
      Total memory: about 375.50 megabytes
      Total memory can expand to: about 3.56 gigabytes

      (this version is mandatory - it must be that one)

      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/drjava/support-requests/348/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

       

      Related

      Support Requests: #348

      • Christian

        Christian - 2018-11-10

        I ran the program on a Windows machine and it worked, so I assume it was something to do with the OS and the way Macs handle printing. Thank you for offering to help, but I think I'll just work from the other machines in the lab. I was just wondering if anyone with a Mmac had run into problems with save to PDF, as it also does not work on saving the code itself (not just the output report, but the actual code).

         

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.