2 Replies Latest reply: Mar 30, 2010 12:55 PM by 843807 RSS

    How to remove "Print to file" option

    843807
      I developed a computer graphics drawing program, and, since I allow File>Save,
      I would like that my File>Print doesn't have a "Print to file" option.

      I use PrintJob printJob = Toolkit.getDefaultToolkit().getPrintJob
      (myFrame, null, jobAttributes, pageAttributes)
      and I specify jobAttributes.setDialog(JobAttributes.DialogType.NATIVE)
      and jobAttributes.setDestination(JobAttributes.DestinationType.PRINTER)

      However, in the print window I still see the "Print to file" option.

      How can I get rid of it?

      Thanks in advance!
        • 1. Re: How to remove "Print to file" option
          793415
          BrigitAnanya wrote:
          I developed a computer graphics drawing program, and, since I allow File>Save,
          I would like that my File>Print doesn't have a "Print to file" option.
          It's not relevant what you'd like, since it is not your computer. If the user wants to print to file, that is their business.

          As it happens I have a computer with no printer. I often 'print to file' then load the file onto a portable disk to transport to a computer with a printer (but no Java).
          • 2. Re: How to remove "Print to file" option
            843807
            Well, in this case I would like to use my code for making a pdf file when
            the user chooses "print to File".

            I just add my code at
            if (jobAttributes.getDestination() == JobAttributes.DestinationType.FILE)

            However, the file that gets saved automatically gets the name "out.prn",
            and I would like to name it out.pdf or at least allow Save as "pdf".
            How could I do this?

            Also, even though I can save the file on the C drive, it doesn't allow to
            save the file on the desktop or in "My Documents".
            When I try that, I get the message:
            Cannot write to file ...\out.prn.
            How can I solve this?

            Is it really true that I cannot get rid of the "Print to file" option? Why did
            jobAttributes.setDestination(JobAttributes.DestinationType.PRINTER)
            not do that? My users really don't need to use "Print to file", since they
            can use "Save as" and print the file on another computer.

            Thanks for any response!