Skip to content

Commit

Permalink
Add method to get printer by name.
Browse files Browse the repository at this point in the history
  • Loading branch information
5AbhishekSaxena committed May 30, 2022
1 parent 16fec21 commit 1b9a803
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package tech.developingdeveloper.printms.services

import tech.developingdeveloper.printms.services.dtos.PrinterDTO
import javax.print.PrintService


interface PrinterService {
Expand All @@ -10,6 +9,8 @@ interface PrinterService {

fun getDefaultPrinter(): PrinterDTO

fun getPrinter(printerName: String): PrinterDTO

fun isPrinterPresent(printerName: String): Boolean

fun printPdf(path: String, printerServiceName: String)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ class PrinterServiceImpl(
)
}

override fun getPrinter(printerName: String): PrinterDTO {
val printerService = findPrinter(printerName)
return printerDTOFactory.createPrinter(
name = printerService.name,
printerIsAcceptingJobsAttribute = printerService.getPrinterIsAcceptingJobsAttribute()
)
}

override fun printPdf(path: String, printerServiceName: String) {
val file = File(path)

Expand Down

0 comments on commit 1b9a803

Please sign in to comment.