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.

PDF mit JAVA drucken

Empfohlene Antworten

Veröffentlicht

Hallo zusammen,

ich muss ein PDF Dokument mit JAVA an einen Drucker schicken bzw. das Dokument drucken.

Da ich n JAVA Frischling bin hab ich gar keinen Plan wie das funktionieren soll.

Gibt es Klassen oder Packages mit denen ich so etwas möglichst einfach realisieren kann?

Falls es nicht zuviel Aufwand ist würde ich mich sehr über ein Code -Beispiel freuen.

Vielen Dank im Voraus

ten13

Hi,

danke für die Antwort.

Hab schon etwas geschrieben mit dem ich drucken kann, allerdings nur GIF Dateien...

Ich will aber PDF Files drucken und das hab ich nciht hinbekommen...

Anbei mal der Quelltext :

public class DruckenGIF {

public static void main(String[] args) {

try {

PrintService service = PrintServiceLookup.lookupDefaultPrintService();

FileInputStream textStream = null;

try {

textStream = new FileInputStream("C:/test.gif") ;

} catch(FileNotFoundException ex) {

ex.printStackTrace();

}

DocFlavor formatSTREAM = DocFlavor.INPUT_STREAM.GIF;

DocPrintJob job = service.createPrintJob();

Doc doc = new SimpleDoc(textStream,formatSTREAM,null);

job.print(doc, null);

} catch (PrintException e) {

e.printStackTrace();

}

}

}

Wäre Super wenn mir das jmd. erweitern könnte damit ich PDF s drucken kann.

Danke im Voraus

MFG

ten13

DocFlavor flavor = DocFlavor.INPUT_STREAM.PDF;

PrintService pservice = PrintServiceLookup.lookupDefaultPrintServices();

DocPrintJob pj = pservice.createPrintJob();

Doc doc = new InputStreamDoc("test.pdf", flavor);

try {

pj.print(doc, null);

} catch (PrintException e) {

}

Hi, eigentlich würde das passen nur der Drucker kann leider kein PDF native drucken.

Darum strebe ich eine Postscript lösung an.

Suche daher eine Java Library mit der ich TIF zu PS oder PDF to PSumwandeln kann.

Das ganze soll kostenfrei sein.

Für Codebeispiele bin ich wieder sehr dankbar : D

MFG

ten13

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.