Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Es druckt net...

Empfohlene Antworten

Veröffentlicht

Hi, ich hab mich jetzt mal ein wenig mit dem Thema Drucken befasst, und habs auch schon geschafft nen Bild auszudrucken. Doch irgendwie wills net einen String ausdrucken... wisst ihr viell. wieso??

import javax.print.*;


/**

 * <p>Überschrift: </p>

 * <p>Beschreibung: </p>

 * <p>Copyright: Copyright (c) 2005</p>

 * <p>Organisation: </p>

 * @author unbekannt

 * @version 1.0

 */


public class Unbenannt1 {

  public Unbenannt1() {

    try {

     PrintService service = PrintServiceLookup.lookupDefaultPrintService();

    DocPrintJob job = service.createPrintJob();

    Doc doc = new SimpleDoc("Die ******e druckt net!!!!!",DocFlavor.STRING.TEXT_PLAIN, null);

    job.print(doc, null);

   } catch (PrintException e) {

   }

  }


  public static void main(String[] args) {

    Unbenannt1 unbenannt11 = new Unbenannt1();

  }


}

Danke für eure hilfe!

Also genau dieses Beispiel geht bei mir! ;)

Hast du dir eine evtl. auftretende Exception mal ausgeben lassen?

jo, des ist die Exception:

sun.print.PrintJobFlavorException: invalid flavor

	at sun.print.Win32PrintJob.print(Win32PrintJob.java:296)

	at drucken.Unbenannt1.<init>(Unbenannt1.java:19)

	at drucken.Unbenannt1.main(Unbenannt1.java:24)

Exception in thread "main" 

Komisch... bei mir geht dein CodeSchnipsel.

Ich nutze Gentoo Linux. Versuch vielleicht mal einen anderen Flavor...

Es gab auch ne Methode mit der man sich einen Druck-Dialog anzeigen lassen konnte...

Vielleicht hilft das weiter, wenn du einfach nur einen anderen Drucker auswählst...

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.