title: Why JavaFX PrintJob cannot print node's text properly?
body: <p>I try to print a javafx scene with texts on it. I have created this very simple test code. As you can see it's a standard hello world application with a button that says "Say Hello World. </p>
  
  <p>The application supposes to print out this scene with the button that shows "Say 'Hello World'". The program prints out the form fine. However, the texts on the button are shown as unrecognizable characters instead. I use Mac. </p>
  
  <p>I am trying to implement a javafx report, and it requires to print out a javafx scene. </p>
  
  <p>Any help will be greatly appreciated. Please let me know if you can successfully print the characters. Therefore, at least, I know it's my printer's problem.</p>
  
  <p>To make the test easy, you can save the result as a pdf file instead of printing it out.</p>
  
  <pre><code>package javafxprinttest;
  
  import javafx.application.Application;
  import javafx.event.ActionEvent;
  import javafx.event.EventHandler;
  import javafx.print.PrinterJob;
  import javafx.scene.Node;
  import javafx.scene.Scene;
  import javafx.scene.control.Button;
  import javafx.scene.layout.StackPane;
  import javafx.stage.Stage;
  
  
  public class JavaFXPrintTest extends Application {
  
  @Override
  public void start(Stage primaryStage) {
      Button btn = new Button();
      btn.setText("Say 'Hello World'");
  
  
      StackPane root = new StackPane();
      root.getChildren().add(btn);
      btn.setOnAction(new EventHandler&lt;ActionEvent&gt;() {
  
          @Override
          public void handle(ActionEvent event) {
              System.out.println("Hello World!");
              print(root);
          }
      });
  
      Scene scene = new Scene(root, 300, 250);
  
      primaryStage.setTitle("Hello World!");
      primaryStage.setScene(scene);
      primaryStage.show();
  }
  
  /**
   * @param args the command line arguments
   */
  public static void main(String[] args) {
      launch(args);
  }
  
  private void print(Node node) 
  {
      // Define the Job Status Message
              System.out.println("Creating a printer job...");
      // Create a printer job for the default printer
      PrinterJob job = PrinterJob.createPrinterJob();
  
      if (job != null &amp;&amp; job.showPrintDialog(node.getScene().getWindow())) 
      {
          // Print the node
          boolean printed = job.printPage(node);
  
          if (printed) 
          {
              // End the printer job
              job.endJob();
          } 
          else 
          {
              // Write Error Message
                              System.out.println("Printing failed.");
          }
      } 
      else 
      {
          // Write Error Message
                      System.out.println("Could not create a printer job.");
      }
  }
  
  }
  </code></pre>