myteril / node-win-printer

A Node.js package to print PDF files and get the information of available printers on Windows.
Apache License 2.0
3 stars 0 forks source link

SyntaxError: Expected ',' or ']' after array element in JSON #2

Open mustofa-id opened 2 months ago

mustofa-id commented 2 months ago

I ran into an error while calling the getPrinters() function. The error message is SyntaxError: Expected ',' or ']' after array element in JSON at position 1151.

Stack trace:

SyntaxError: Expected ',' or ']' after array element in JSON at position 1151
    at JSON.parse (<anonymous>)
    at C:\my-project\node_modules\.pnpm\@myteril+node-win-printer@1.1.5\node_modules\@myteril\node-win-printer\lib\index.js:97:51
    at Array.forEach (<anonymous>)
    at C:\my-project\node_modules\.pnpm\@myteril+node-win-printer@1.1.5\node_modules\@myteril\node-win-printer\lib\index.js:83:27
    at Array.map (<anonymous>)
    at C:\my-project\node_modules\.pnpm\@myteril+node-win-printer@1.1.5\node_modules\@myteril\node-win-printer\lib\index.js:79:39
    at step (C:\my-project\node_modules\.pnpm\@myteril+node-win-printer@1.1.5\node_modules\@myteril\node-win-printer\lib\index.js:33:23)
    at Object.next (C:\my-project\node_modules\.pnpm\@myteril+node-win-printer@1.1.5\node_modules\@myteril\node-win-printer\lib\index.js:14:53)
    at fulfilled (C:\my-project\node_modules\.pnpm\@myteril+node-win-printer@1.1.5\node_modules\@myteril\node-win-printer\lib\index.js:5:58)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Here is the list of printers on my computer:

PS C:\Users\Me> wmic printer list /format:list
Attributes=3652
Availability=
AvailableJobSheets=
AveragePagesPerMinute=0
Capabilities={4,2}
CapabilityDescriptions={"Copies","Color"}
Caption=ZDesigner GK888t
CharSetsSupported=
Comment=
ConfigManagerErrorCode=
ConfigManagerUserConfig=
CurrentCapabilities=
CurrentCharSet=
CurrentLanguage=
CurrentMimeType=
CurrentNaturalLanguage=
CurrentPaperType=
Default=TRUE
DefaultCapabilities=
DefaultCopies=
DefaultLanguage=
DefaultMimeType=
DefaultNumberUp=
DefaultPaperType=
DefaultPriority=0
Description=
DetectedErrorState=0
DeviceID=ZDesigner GK888t
Direct=FALSE
DoCompleteFirst=TRUE
DriverName=ZDesigner GK888t
EnableBIDI=TRUE
EnableDevQueryPrint=FALSE
ErrorCleared=
ErrorDescription=
ErrorInformation=
ExtendedDetectedErrorState=0
ExtendedPrinterStatus=2
Hidden=FALSE
HorizontalResolution=203
InstallDate=
JobCountSinceLastReset=0
KeepPrintedJobs=FALSE
LanguagesSupported=
LastErrorCode=
Local=TRUE
Location=
MarkingTechnology=
MaxCopies=
MaxNumberUp=
MaxSizeSupported=
MimeTypesSupported=
Name=ZDesigner GK888t
PaperSizesSupported={1}
PNPDeviceID=
PortName=USB002
PowerManagementCapabilities=
PowerManagementSupported=
PrinterPaperNames={"User defined"}
PrinterState=0
PrinterStatus=3
PrintJobDataType=RAW
PrintProcessor=winprint
SeparatorFile=
ServerName=
ShareName=
SpoolEnabled=TRUE
StartTime=
Status=Unknown
StatusInfo=
SystemName=SSEC-TSI
TimeOfLastReset=
UntilTime=
VerticalResolution=203

Attributes=576
Availability=
AvailableJobSheets=
AveragePagesPerMinute=0
Capabilities={4,2,5}
CapabilityDescriptions={"Copies","Color","Collate"}
Caption=Microsoft XPS Document Writer
CharSetsSupported=
Comment=
ConfigManagerErrorCode=
ConfigManagerUserConfig=
CurrentCapabilities=
CurrentCharSet=
CurrentLanguage=
CurrentMimeType=
CurrentNaturalLanguage=
CurrentPaperType=
Default=FALSE
DefaultCapabilities=
DefaultCopies=
DefaultLanguage=
DefaultMimeType=
DefaultNumberUp=
DefaultPaperType=
DefaultPriority=0
Description=
DetectedErrorState=0
DeviceID=Microsoft XPS Document Writer
Direct=FALSE
DoCompleteFirst=TRUE
DriverName=Microsoft XPS Document Writer v4
EnableBIDI=FALSE
EnableDevQueryPrint=FALSE
ErrorCleared=
ErrorDescription=
ErrorInformation=
ExtendedDetectedErrorState=0
ExtendedPrinterStatus=2
Hidden=FALSE
HorizontalResolution=600
InstallDate=
JobCountSinceLastReset=0
KeepPrintedJobs=FALSE
LanguagesSupported={48}
LastErrorCode=
Local=TRUE
Location=
MarkingTechnology=
MaxCopies=
MaxNumberUp=
MaxSizeSupported=
MimeTypesSupported=
Name=Microsoft XPS Document Writer
PaperSizesSupported={7,7,1,1,8,1,1,21,22,1,23,54,55,1,1,1,1,7,15,11,1,1,1,4,5,6,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,49,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}
PNPDeviceID=
PortName=PORTPROMPT:
PowerManagementCapabilities=
PowerManagementSupported=
PrinterPaperNames={"Letter","Letter Small","Tabloid","Ledger","Legal","Statement","Executive","A3","A4","A4 Small","A5","B4 (JIS)","B5 (JIS)","Folio","Quarto","10×14","11×17","Note","Envelope #9","Envelope #10","Envelope #11","Envelope #12","Envelope #14","C size sheet","D size sheet","E size sheet","Envelope DL","Envelope C5","Envelope C3","Envelope C4","Envelope C6","Envelope C65","Envelope B4","Envelope B5","Envelope B6","Envelope","Envelope Monarch","6 3/4 Envelope","US Std Fanfold","German Std Fanfold","German Legal Fanfold","B4 (ISO)","Japanese Postcard","9×11","10×11","15×11","Envelope Invite","Letter Extra","Legal Extra","A4 Extra","Letter Transverse","A4 Transverse","Letter Extra Transverse","Super A","Super B","Letter Plus","A4 Plus","A5 Transverse","B5 (JIS) Transverse","A3 Extra","A5 Extra","B5 (ISO) Extra","A2","A3 Transverse","A3 Extra Transverse","Japanese Double Postcard","A6","Japanese Envelope Kaku #2","Japanese Envelope Kaku #3","Japanese Envelope Chou #3","Japanese Envelope Chou #4","Letter Rotated","A3 Rotated","A4 Rotated","A5 Rotated","B4 (JIS) Rotated","B5 (JIS) Rotated","Japanese Postcard Rotated","Double Japan Postcard Rotated","A6 Rotated","Japan Envelope Kaku #2 Rotated","Japan Envelope Kaku #3 Rotated","Japan Envelope Chou #3 Rotated","Japan Envelope Chou #4 Rotated","B6 (JIS)","B6 (JIS) Rotated","12×11","Japan Envelope You #4","Japan Envelope You #4 Rotated","PRC Envelope #1","PRC Envelope #3","PRC Envelope #4","PRC Envelope #5","PRC Envelope #6","PRC Envelope #7","PRC Envelope #8","PRC Envelope #9","PRC Envelope #10","PRC Envelope #1 Rotated","PRC Envelope #3 Rotated","PRC Envelope #4 Rotated","PRC Envelope #5 Rotated","PRC Envelope #6 Rotated","PRC Envelope #7 Rotated","PRC Envelope #8 Rotated","PRC Envelope #9 Rotated","User Defined Size"}
PrinterState=0
PrinterStatus=3
PrintJobDataType=RAW
PrintProcessor=winprint
SeparatorFile=
ServerName=
ShareName=
SpoolEnabled=TRUE
StartTime=
Status=Unknown
StatusInfo=
SystemName=SSEC-TSI
TimeOfLastReset=
UntilTime=
VerticalResolution=600

Attributes=576
Availability=
AvailableJobSheets=
AveragePagesPerMinute=0
Capabilities={4,2}
CapabilityDescriptions={"Copies","Color"}
Caption=Microsoft Print to PDF
CharSetsSupported=
Comment=
ConfigManagerErrorCode=
ConfigManagerUserConfig=
CurrentCapabilities=
CurrentCharSet=
CurrentLanguage=
CurrentMimeType=
CurrentNaturalLanguage=
CurrentPaperType=
Default=FALSE
DefaultCapabilities=
DefaultCopies=
DefaultLanguage=
DefaultMimeType=
DefaultNumberUp=
DefaultPaperType=
DefaultPriority=0
Description=
DetectedErrorState=0
DeviceID=Microsoft Print to PDF
Direct=FALSE
DoCompleteFirst=TRUE
DriverName=Microsoft Print To PDF
EnableBIDI=FALSE
EnableDevQueryPrint=FALSE
ErrorCleared=
ErrorDescription=
ErrorInformation=
ExtendedDetectedErrorState=0
ExtendedPrinterStatus=2
Hidden=FALSE
HorizontalResolution=600
InstallDate=
JobCountSinceLastReset=0
KeepPrintedJobs=FALSE
LanguagesSupported={48}
LastErrorCode=
Local=TRUE
Location=
MarkingTechnology=
MaxCopies=
MaxNumberUp=
MaxSizeSupported=
MimeTypesSupported=
Name=Microsoft Print to PDF
PaperSizesSupported={7,1,8,1,1,21,22,23,54,55}
PNPDeviceID=
PortName=PORTPROMPT:
PowerManagementCapabilities=
PowerManagementSupported=
PrinterPaperNames={"Letter","Tabloid","Legal","Statement","Executive","A3","A4","A5","B4 (JIS)","B5 (JIS)"}
PrinterState=0
PrinterStatus=3
PrintJobDataType=RAW
PrintProcessor=winprint
SeparatorFile=
ServerName=
ShareName=
SpoolEnabled=TRUE
StartTime=
Status=Unknown
StatusInfo=
SystemName=SSEC-TSI
TimeOfLastReset=
UntilTime=
VerticalResolution=600

Attributes=2624
Availability=
AvailableJobSheets=
AveragePagesPerMinute=0
Capabilities={4,2,3,5}
CapabilityDescriptions={"Copies","Color","Duplex","Collate"}
Caption=L5290 Series(Network)
CharSetsSupported=
Comment=
ConfigManagerErrorCode=
ConfigManagerUserConfig=
CurrentCapabilities=
CurrentCharSet=
CurrentLanguage=
CurrentMimeType=
CurrentNaturalLanguage=
CurrentPaperType=
Default=FALSE
DefaultCapabilities=
DefaultCopies=
DefaultLanguage=
DefaultMimeType=
DefaultNumberUp=
DefaultPaperType=
DefaultPriority=0
Description=
DetectedErrorState=0
DeviceID=L5290 Series(Network)
Direct=FALSE
DoCompleteFirst=TRUE
DriverName=EPSON L5290 Series
EnableBIDI=TRUE
EnableDevQueryPrint=FALSE
ErrorCleared=
ErrorDescription=
ErrorInformation=
ExtendedDetectedErrorState=0
ExtendedPrinterStatus=2
Hidden=FALSE
HorizontalResolution=
InstallDate=
JobCountSinceLastReset=0
KeepPrintedJobs=FALSE
LanguagesSupported={2}
LastErrorCode=
Local=TRUE
Location=
MarkingTechnology=
MaxCopies=
MaxNumberUp=
MaxSizeSupported=
MimeTypesSupported=
Name=L5290 Series(Network)
PaperSizesSupported={22,1,1,1,23,55,1,1,1,1,1,1,11,1,1,7,1,1,8,21,1,1,54,1,1,1,1}
PNPDeviceID=
PortName=EPF1351D:L5290 SERIES
PowerManagementCapabilities=
PowerManagementSupported=
PrinterPaperNames={"A4 210 x 297 mm","10 x 15 cm (4 x 6 in)","13 x 18 cm (5 x 7 in)","A6 105 x 148 mm","A5 148 x 210 mm","B5 182 x 257 mm","B6 128 x 182 mm","9 x 13 cm (3.5 x 5 in)","5 x 8 in (127 x 203 mm)","20 x 25 cm (8 x 10 in)","16:9 wide (4 x 7.11 in)","100 x 148 mm","Envelope #10 105 x 241 mm","Envelope DL 110 x 220 mm","Envelope C6  114 x 162 mm","Letter 8.5 x 11 in (216 x 279 mm)","8.5 x 13 in","Indian-Legal 215 x 345 mm","Legal 8.5 x 14 in (216 x 356 mm)","A3 297 x 420 mm","A3+ 329 x 483 mm","A2 420 x 594 mm","B4 257 x 364 mm","B3 364 x 515 mm","8K 270 x 390 mm","16K 195 x 270 mm","User-Defined"}
PrinterState=0
PrinterStatus=3
PrintJobDataType=RAW
PrintProcessor=winprint
SeparatorFile=
ServerName=
ShareName=
SpoolEnabled=TRUE
StartTime=
Status=Unknown
StatusInfo=
SystemName=SSEC-TSI
TimeOfLastReset=
UntilTime=
VerticalResolution=

Attributes=16448
Availability=
AvailableJobSheets=
AveragePagesPerMinute=0
Capabilities={2,3}
CapabilityDescriptions={"Color","Duplex"}
Caption=Fax
CharSetsSupported=
Comment=
ConfigManagerErrorCode=
ConfigManagerUserConfig=
CurrentCapabilities=
CurrentCharSet=
CurrentLanguage=
CurrentMimeType=
CurrentNaturalLanguage=
CurrentPaperType=
Default=FALSE
DefaultCapabilities=
DefaultCopies=
DefaultLanguage=
DefaultMimeType=
DefaultNumberUp=
DefaultPaperType=
DefaultPriority=0
Description=
DetectedErrorState=0
DeviceID=Fax
Direct=FALSE
DoCompleteFirst=FALSE
DriverName=Microsoft Shared Fax Driver
EnableBIDI=FALSE
EnableDevQueryPrint=FALSE
ErrorCleared=
ErrorDescription=
ErrorInformation=
ExtendedDetectedErrorState=0
ExtendedPrinterStatus=2
Hidden=FALSE
HorizontalResolution=200
InstallDate=
JobCountSinceLastReset=0
KeepPrintedJobs=FALSE
LanguagesSupported=
LastErrorCode=
Local=TRUE
Location=
MarkingTechnology=
MaxCopies=
MaxNumberUp=
MaxSizeSupported=
MimeTypesSupported=
Name=Fax
PaperSizesSupported={7,7,8,1,1,22,1,23,55,1,1,7,15,11,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}
PNPDeviceID=
PortName=SHRFAX:
PowerManagementCapabilities=
PowerManagementSupported=
PrinterPaperNames={"Letter","Letter Small","Legal","Statement","Executive","A4","A4 Small","A5","B5 (JIS)","Folio","Quarto","Note","Envelope #9","Envelope #10","Envelope #11","Envelope #12","Envelope #14","Envelope DL","Envelope C5","Envelope C6","Envelope C65","Envelope B5","Envelope B6","Envelope","Envelope Monarch","6 3/4 Envelope","German Std Fanfold","German Legal Fanfold","Japanese Postcard","Reserved48","Reserved49","Letter Transverse","A4 Transverse","Letter Plus","A4 Plus","A5 Transverse","B5 (JIS) Transverse","A5 Extra","B5 (ISO) Extra","Japanese Double Postcard","A6","Japanese Envelope Kaku #3","Japanese Envelope Chou #3","Japanese Envelope Chou #4","A5 Rotated","Japanese Postcard Rotated","Double Japan Postcard Rotated","A6 Rotated","Japan Envelope Chou #4 Rotated","B6 (JIS)","B6 (JIS) Rotated","Japan Envelope You #4","PRC 16K","PRC 32K","PRC 32K(Big)","PRC Envelope #1","PRC Envelope #2","PRC Envelope #3","PRC Envelope #4","PRC Envelope #5","PRC Envelope #6","PRC Envelope #7","PRC Envelope #8","PRC 32K Rotated","PRC 32K(Big) Rotated","PRC Envelope #1 Rotated","PRC Envelope #2 Rotated","PRC Envelope #3 Rotated","PRC Envelope #4 Rotated","4"x6" 10x15cm","5"x7" 13x18cm","8"x10" 20x25cm","L 89x127mm","2L 127x178mm","Square 5"x5" 13x13cm","Yougata 6 3.86"x7.48"","Card 2.17"x3.58" 55x91mm","LABEL","LetterSmall","Screen","A4Small","A7","A8","A9","A10","ISO B5","ISO B6","JIS B5","JIS B6","FLSA","FLSE","PA4"}
PrinterState=0
PrinterStatus=3
PrintJobDataType=RAW
PrintProcessor=winprint
SeparatorFile=
ServerName=
ShareName=
SpoolEnabled=TRUE
StartTime=
Status=Unknown
StatusInfo=
SystemName=SSEC-TSI
TimeOfLastReset=
UntilTime=
VerticalResolution=200

Attributes=2624
Availability=
AvailableJobSheets=
AveragePagesPerMinute=0
Capabilities={2}
CapabilityDescriptions={"Color"}
Caption=EPSON L5290 Series (FAX)
CharSetsSupported=
Comment=
ConfigManagerErrorCode=
ConfigManagerUserConfig=
CurrentCapabilities=
CurrentCharSet=
CurrentLanguage=
CurrentMimeType=
CurrentNaturalLanguage=
CurrentPaperType=
Default=FALSE
DefaultCapabilities=
DefaultCopies=
DefaultLanguage=
DefaultMimeType=
DefaultNumberUp=
DefaultPaperType=
DefaultPriority=0
Description=
DetectedErrorState=0
DeviceID=EPSON L5290 Series (FAX)
Direct=FALSE
DoCompleteFirst=TRUE
DriverName=EPSON L5290 Series (FAX)
EnableBIDI=TRUE
EnableDevQueryPrint=FALSE
ErrorCleared=
ErrorDescription=
ErrorInformation=
ExtendedDetectedErrorState=0
ExtendedPrinterStatus=2
Hidden=FALSE
HorizontalResolution=
InstallDate=
JobCountSinceLastReset=0
KeepPrintedJobs=FALSE
LanguagesSupported=
LastErrorCode=
Local=TRUE
Location=
MarkingTechnology=
MaxCopies=
MaxNumberUp=
MaxSizeSupported=
MimeTypesSupported=
Name=EPSON L5290 Series (FAX)
PaperSizesSupported={22,7,8}
PNPDeviceID=
PortName=EPF1351D:L5290 SERIES
PowerManagementCapabilities=
PowerManagementSupported=
PrinterPaperNames={"A4","Letter","Legal"}
PrinterState=0
PrinterStatus=3
PrintJobDataType=RAW
PrintProcessor=winprint
SeparatorFile=
ServerName=
ShareName=
SpoolEnabled=TRUE
StartTime=
Status=Unknown
StatusInfo=
SystemName=SSEC-TSI
TimeOfLastReset=
UntilTime=
VerticalResolution=

Attributes=3608
Availability=
AvailableJobSheets=
AveragePagesPerMinute=0
Capabilities={4,2,3,5}
CapabilityDescriptions={"Copies","Color","Duplex","Collate"}
Caption=\\192.168.100.28\EPSON L3110 Series
CharSetsSupported=
Comment=
ConfigManagerErrorCode=
ConfigManagerUserConfig=
CurrentCapabilities=
CurrentCharSet=
CurrentLanguage=
CurrentMimeType=
CurrentNaturalLanguage=
CurrentPaperType=
Default=FALSE
DefaultCapabilities=
DefaultCopies=
DefaultLanguage=
DefaultMimeType=
DefaultNumberUp=
DefaultPaperType=
DefaultPriority=0
Description=
DetectedErrorState=0
DeviceID=\\192.168.100.28\EPSON L3110 Series
Direct=FALSE
DoCompleteFirst=TRUE
DriverName=EPSON L3110 Series
EnableBIDI=TRUE
EnableDevQueryPrint=FALSE
ErrorCleared=
ErrorDescription=
ErrorInformation=
ExtendedDetectedErrorState=0
ExtendedPrinterStatus=2
Hidden=FALSE
HorizontalResolution=
InstallDate=
JobCountSinceLastReset=0
KeepPrintedJobs=FALSE
LanguagesSupported={2}
LastErrorCode=
Local=FALSE
Location=
MarkingTechnology=
MaxCopies=
MaxNumberUp=
MaxSizeSupported=
MimeTypesSupported=
Name=\\192.168.100.28\EPSON L3110 Series
PaperSizesSupported={22,1,1,1,23,55,1,1,1,1,1,1,11,1,1,7,1,1,8,21,1,1,54,1,1,1,1,1,1,1}
PNPDeviceID=
PortName=USB001
PowerManagementCapabilities=
PowerManagementSupported=
PrinterPaperNames={"A4 210 x 297 mm","10 x 15 cm (4 x 6 in)","13 x 18 cm (5 x 7 in)","A6 105 x 148 mm","A5 148 x 210 mm","B5 182 x 257 mm","B6 128 x 182 mm","9 x 13 cm (3.5 x 5 in)","5 x 8 in (127 x 203 mm)","20 x 25 cm (8 x 10 in)","16:9 wide (4 x 7.11 in)","100 x 148 mm","Envelope #10 105 x 241 mm","Envelope DL  110 x 220 mm","Envelope C6  114 x 162 mm","Letter 8.5 x 11 in (216 x 279 mm)","8.5 x 13 in","Indian-Legal 215 x 345 mm","Legal 8.5 x 14 in (216 x 356mm)","A3 297 x 420 mm","A3+ 329 x 483 mm","A2 420 x 594 mm","B4 257 x 364 mm","B3 364 x 515 mm","8K 270 x 390 mm","16K 195 x 270 mm","User-Defined","Long Bond","F4","Label 3x4"}
PrinterState=0
PrinterStatus=3
PrintJobDataType=RAW
PrintProcessor=winprint
SeparatorFile=
ServerName=\\192.168.100.28
ShareName=EPSON L3110 Series
SpoolEnabled=TRUE
StartTime=
Status=Unknown
StatusInfo=
SystemName=\\192.168.100.28
TimeOfLastReset=
UntilTime=
VerticalResolution=

Attributes=2584
Availability=
AvailableJobSheets=
AveragePagesPerMinute=0
Capabilities={4,2,3,5}
CapabilityDescriptions={"Copies","Color","Duplex","Collate"}
Caption=\\192.168.100.29\EPSON L3110 Series
CharSetsSupported=
Comment=
ConfigManagerErrorCode=
ConfigManagerUserConfig=
CurrentCapabilities=
CurrentCharSet=
CurrentLanguage=
CurrentMimeType=
CurrentNaturalLanguage=
CurrentPaperType=
Default=FALSE
DefaultCapabilities=
DefaultCopies=
DefaultLanguage=
DefaultMimeType=
DefaultNumberUp=
DefaultPaperType=
DefaultPriority=0
Description=
DetectedErrorState=0
DeviceID=\\192.168.100.29\EPSON L3110 Series
Direct=FALSE
DoCompleteFirst=TRUE
DriverName=EPSON L3110 Series
EnableBIDI=TRUE
EnableDevQueryPrint=FALSE
ErrorCleared=
ErrorDescription=
ErrorInformation=
ExtendedDetectedErrorState=0
ExtendedPrinterStatus=2
Hidden=FALSE
HorizontalResolution=
InstallDate=
JobCountSinceLastReset=0
KeepPrintedJobs=FALSE
LanguagesSupported={2}
LastErrorCode=
Local=FALSE
Location=
MarkingTechnology=
MaxCopies=
MaxNumberUp=
MaxSizeSupported=
MimeTypesSupported=
Name=\\192.168.100.29\EPSON L3110 Series
PaperSizesSupported={22,1,1,1,23,55,1,1,1,1,1,1,11,1,1,7,1,1,8,21,1,1,54,1,1,1,1,1,1}
PNPDeviceID=
PortName=USB002
PowerManagementCapabilities=
PowerManagementSupported=
PrinterPaperNames={"A4 210 x 297 mm","10 x 15 cm (4 x 6 in)","13 x 18 cm (5 x 7 in)","A6 105 x 148 mm","A5 148 x 210 mm","B5 182 x 257 mm","B6 128 x 182 mm","9 x 13 cm (3.5 x 5 in)","5 x 8 in (127 x 203 mm)","20 x 25 cm (8 x 10 in)","16:9 wide (4 x 7.11 in)","100 x 148 mm","Envelope #10 105 x 241 mm","Envelope DL  110 x 220 mm","Envelope C6  114 x 162 mm","Letter 8.5 x 11 in (216 x 279 mm)","8.5 x 13 in","Indian-Legal 215 x 345 mm","Legal 8.5 x 14 in (216 x 356mm)","A3 297 x 420 mm","A3+ 329 x 483 mm","A2 420 x 594 mm","B4 257 x 364 mm","B3 364 x 515 mm","8K 270 x 390 mm","16K 195 x 270 mm","User-Defined","Long Bond","F4"}
PrinterState=0
PrinterStatus=3
PrintJobDataType=RAW
PrintProcessor=winprint
SeparatorFile=
ServerName=\\192.168.100.29
ShareName=EPSON L3110 Series
SpoolEnabled=TRUE
StartTime=
Status=Unknown
StatusInfo=
SystemName=\\192.168.100.29
TimeOfLastReset=
UntilTime=
VerticalResolution=

Attributes=3608
Availability=
AvailableJobSheets=
AveragePagesPerMinute=0
Capabilities={4,2,3,5}
CapabilityDescriptions={"Copies","Color","Duplex","Collate"}
Caption=\\192.168.100.31\EPSON L3110 Series
CharSetsSupported=
Comment=
ConfigManagerErrorCode=
ConfigManagerUserConfig=
CurrentCapabilities=
CurrentCharSet=
CurrentLanguage=
CurrentMimeType=
CurrentNaturalLanguage=
CurrentPaperType=
Default=FALSE
DefaultCapabilities=
DefaultCopies=
DefaultLanguage=
DefaultMimeType=
DefaultNumberUp=
DefaultPaperType=
DefaultPriority=0
Description=
DetectedErrorState=0
DeviceID=\\192.168.100.31\EPSON L3110 Series
Direct=FALSE
DoCompleteFirst=TRUE
DriverName=EPSON L3110 Series
EnableBIDI=TRUE
EnableDevQueryPrint=FALSE
ErrorCleared=
ErrorDescription=
ErrorInformation=
ExtendedDetectedErrorState=0
ExtendedPrinterStatus=2
Hidden=FALSE
HorizontalResolution=
InstallDate=
JobCountSinceLastReset=3
KeepPrintedJobs=FALSE
LanguagesSupported={2}
LastErrorCode=
Local=FALSE
Location=
MarkingTechnology=
MaxCopies=
MaxNumberUp=
MaxSizeSupported=
MimeTypesSupported=
Name=\\192.168.100.31\EPSON L3110 Series
PaperSizesSupported={22,1,1,1,23,55,1,1,1,1,1,1,11,1,1,7,1,1,8,21,1,1,54,1,1,1,1,1,1}
PNPDeviceID=
PortName=USB004
PowerManagementCapabilities=
PowerManagementSupported=
PrinterPaperNames={"A4 210 x 297 mm","10 x 15 cm (4 x 6 in)","13 x 18 cm (5 x 7 in)","A6 105 x 148 mm","A5 148 x 210 mm","B5 182 x 257 mm","B6 128 x 182 mm","9 x 13 cm (3.5 x 5 in)","5 x 8 in (127 x 203 mm)","20 x 25 cm (8 x 10 in)","16:9 wide (4 x 7.11 in)","100 x 148 mm","Envelope #10 105 x 241 mm","Envelope DL  110 x 220 mm","Envelope C6  114 x 162 mm","Letter 8.5 x 11 in (216 x 279 mm)","8.5 x 13 in","Indian-Legal 215 x 345 mm","Legal 8.5 x 14 in (216 x 356mm)","A3 297 x 420 mm","A3+ 329 x 483 mm","A2 420 x 594 mm","B4 257 x 364 mm","B3 364 x 515 mm","8K 270 x 390 mm","16K 195 x 270 mm","User-Defined","Long Bond","F4"}
PrinterState=0
PrinterStatus=2
PrintJobDataType=RAW
PrintProcessor=winprint
SeparatorFile=
ServerName=\\192.168.100.31
ShareName=EPSON L3110 Series
SpoolEnabled=TRUE
StartTime=
Status=Unknown
StatusInfo=
SystemName=\\192.168.100.31
TimeOfLastReset=
UntilTime=
VerticalResolution=

Attributes=2584
Availability=
AvailableJobSheets=
AveragePagesPerMinute=0
Capabilities={4,2,3,5}
CapabilityDescriptions={"Copies","Color","Duplex","Collate"}
Caption=\\192.168.100.32\EPSON L3110 Series
CharSetsSupported=
Comment=
ConfigManagerErrorCode=
ConfigManagerUserConfig=
CurrentCapabilities=
CurrentCharSet=
CurrentLanguage=
CurrentMimeType=
CurrentNaturalLanguage=
CurrentPaperType=
Default=FALSE
DefaultCapabilities=
DefaultCopies=
DefaultLanguage=
DefaultMimeType=
DefaultNumberUp=
DefaultPaperType=
DefaultPriority=0
Description=
DetectedErrorState=0
DeviceID=\\192.168.100.32\EPSON L3110 Series
Direct=FALSE
DoCompleteFirst=TRUE
DriverName=EPSON L3110 Series
EnableBIDI=TRUE
EnableDevQueryPrint=FALSE
ErrorCleared=
ErrorDescription=
ErrorInformation=
ExtendedDetectedErrorState=0
ExtendedPrinterStatus=2
Hidden=FALSE
HorizontalResolution=
InstallDate=
JobCountSinceLastReset=0
KeepPrintedJobs=FALSE
LanguagesSupported={2}
LastErrorCode=
Local=FALSE
Location=
MarkingTechnology=
MaxCopies=
MaxNumberUp=
MaxSizeSupported=
MimeTypesSupported=
Name=\\192.168.100.32\EPSON L3110 Series
PaperSizesSupported={22,1,1,1,23,55,1,1,1,1,1,1,11,1,1,7,1,1,8,21,1,1,54,1,1,1,1,1,1}
PNPDeviceID=
PortName=USB001
PowerManagementCapabilities=
PowerManagementSupported=
PrinterPaperNames={"A4 210 x 297 mm","10 x 15 cm (4 x 6 in)","13 x 18 cm (5 x 7 in)","A6 105 x 148 mm","A5 148 x 210 mm","B5 182 x 257 mm","B6 128 x 182 mm","9 x 13 cm (3.5 x 5 in)","5 x 8 in (127 x 203 mm)","20 x 25 cm (8 x 10 in)","16:9 wide (4 x 7.11 in)","100 x 148 mm","Envelope #10 105 x 241 mm","Envelope DL  110 x 220 mm","Envelope C6  114 x 162 mm","Letter 8.5 x 11 in (216 x 279 mm)","8.5 x 13 in","Indian-Legal 215 x 345 mm","Legal 8.5 x 14 in (216 x 356mm)","A3 297 x 420 mm","A3+ 329 x 483 mm","A2 420 x 594 mm","B4 257 x 364 mm","B3 364 x 515 mm","8K 270 x 390 mm","16K 195 x 270 mm","User-Defined","Long Bond","F4"}
PrinterState=0
PrinterStatus=3
PrintJobDataType=RAW
PrintProcessor=winprint
SeparatorFile=
ServerName=\\192.168.100.32
ShareName=EPSON L3110 Series
SpoolEnabled=TRUE
StartTime=
Status=Unknown
StatusInfo=
SystemName=\\192.168.100.32
TimeOfLastReset=
UntilTime=
VerticalResolution=

Attributes=2584
Availability=
AvailableJobSheets=
AveragePagesPerMinute=0
Capabilities={4,2,3,5}
CapabilityDescriptions={"Copies","Color","Duplex","Collate"}
Caption=\\ssec-aio07\EPSON L1110 Series
CharSetsSupported=
Comment=
ConfigManagerErrorCode=
ConfigManagerUserConfig=
CurrentCapabilities=
CurrentCharSet=
CurrentLanguage=
CurrentMimeType=
CurrentNaturalLanguage=
CurrentPaperType=
Default=FALSE
DefaultCapabilities=
DefaultCopies=
DefaultLanguage=
DefaultMimeType=
DefaultNumberUp=
DefaultPaperType=
DefaultPriority=0
Description=
DetectedErrorState=0
DeviceID=\\ssec-aio07\EPSON L1110 Series
Direct=FALSE
DoCompleteFirst=TRUE
DriverName=EPSON L1110 Series
EnableBIDI=TRUE
EnableDevQueryPrint=FALSE
ErrorCleared=
ErrorDescription=
ErrorInformation=
ExtendedDetectedErrorState=0
ExtendedPrinterStatus=2
Hidden=FALSE
HorizontalResolution=
InstallDate=
JobCountSinceLastReset=0
KeepPrintedJobs=FALSE
LanguagesSupported={2}
LastErrorCode=
Local=FALSE
Location=
MarkingTechnology=
MaxCopies=
MaxNumberUp=
MaxSizeSupported=
MimeTypesSupported=
Name=\\ssec-aio07\EPSON L1110 Series
PaperSizesSupported={22,1,1,1,23,55,1,1,1,1,1,1,11,1,1,7,1,1,8,21,1,1,54,1,1,1,1}
PNPDeviceID=
PortName=USB003
PowerManagementCapabilities=
PowerManagementSupported=
PrinterPaperNames={"A4 210 x 297 mm","10 x 15 cm (4 x 6 in)","13 x 18 cm (5 x 7 in)","A6 105 x 148 mm","A5 148 x 210 mm","B5 182 x 257 mm","B6 128 x 182 mm","9 x 13 cm (3.5 x 5 in)","5 x 8 in (127 x 203 mm)","20 x 25 cm (8 x 10 in)","16:9 wide (4 x 7.11 in)","100 x 148 mm","Envelope #10 105 x 241 mm","Envelope DL 110 x 220 mm","Envelope C6  114 x 162 mm","Letter 8.5 x 11 in (216 x 279 mm)","8.5 x 13 in","Indian-Legal 215 x 345 mm","Legal 8.5 x 14 in (216 x 356 mm)","A3 297 x 420 mm","A3+ 329 x 483 mm","A2 420 x 594 mm","B4 257 x 364 mm","B3 364 x 515 mm","8K 270 x 390 mm","16K 195 x 270 mm","User-Defined"}
PrinterState=0
PrinterStatus=3
PrintJobDataType=RAW
PrintProcessor=winprint
SeparatorFile=
ServerName=\\ssec-aio07
ShareName=EPSON L1110 Series
SpoolEnabled=TRUE
StartTime=
Status=Unknown
StatusInfo=
SystemName=\\ssec-aio07
TimeOfLastReset=
UntilTime=
VerticalResolution=

Attributes=2584
Availability=
AvailableJobSheets=
AveragePagesPerMinute=0
Capabilities={4,2,3,5}
CapabilityDescriptions={"Copies","Color","Duplex","Collate"}
Caption=\\ssec-pc04\EPSON L3110 Series
CharSetsSupported=
Comment=
ConfigManagerErrorCode=
ConfigManagerUserConfig=
CurrentCapabilities=
CurrentCharSet=
CurrentLanguage=
CurrentMimeType=
CurrentNaturalLanguage=
CurrentPaperType=
Default=FALSE
DefaultCapabilities=
DefaultCopies=
DefaultLanguage=
DefaultMimeType=
DefaultNumberUp=
DefaultPaperType=
DefaultPriority=0
Description=
DetectedErrorState=0
DeviceID=\\ssec-pc04\EPSON L3110 Series
Direct=FALSE
DoCompleteFirst=TRUE
DriverName=EPSON L3110 Series
EnableBIDI=TRUE
EnableDevQueryPrint=FALSE
ErrorCleared=
ErrorDescription=
ErrorInformation=
ExtendedDetectedErrorState=0
ExtendedPrinterStatus=2
Hidden=FALSE
HorizontalResolution=
InstallDate=
JobCountSinceLastReset=0
KeepPrintedJobs=FALSE
LanguagesSupported={2}
LastErrorCode=
Local=FALSE
Location=
MarkingTechnology=
MaxCopies=
MaxNumberUp=
MaxSizeSupported=
MimeTypesSupported=
Name=\\ssec-pc04\EPSON L3110 Series
PaperSizesSupported={22,1,1,1,23,55,1,1,1,1,1,1,11,1,1,7,1,1,8,21,1,1,54,1,1,1,1,1,1}
PNPDeviceID=
PortName=USB002
PowerManagementCapabilities=
PowerManagementSupported=
PrinterPaperNames={"A4 210 x 297 mm","10 x 15 cm (4 x 6 in)","13 x 18 cm (5 x 7 in)","A6 105 x 148 mm","A5 148 x 210 mm","B5 182 x 257 mm","B6 128 x 182 mm","9 x 13 cm (3.5 x 5 in)","5 x 8 in (127 x 203 mm)","20 x 25 cm (8 x 10 in)","16:9 wide (4 x 7.11 in)","100 x 148 mm","Envelope #10 105 x 241 mm","Envelope DL  110 x 220 mm","Envelope C6  114 x 162 mm","Letter 8.5 x 11 in (216 x 279 mm)","8.5 x 13 in","Indian-Legal 215 x 345 mm","Legal 8.5 x 14 in (216 x 356mm)","A3 297 x 420 mm","A3+ 329 x 483 mm","A2 420 x 594 mm","B4 257 x 364 mm","B3 364 x 515 mm","8K 270 x 390 mm","16K 195 x 270 mm","User-Defined","Long Bond","F4"}
PrinterState=0
PrinterStatus=3
PrintJobDataType=RAW
PrintProcessor=winprint
SeparatorFile=
ServerName=\\ssec-pc04
ShareName=EPSON L3110 Series
SpoolEnabled=TRUE
StartTime=
Status=Unknown
StatusInfo=
SystemName=\\ssec-pc04
TimeOfLastReset=
UntilTime=
VerticalResolution=

Thanks for putting together this project. it’s incredibly smart and helpful.

mustofa-id commented 2 months ago

I found a more elegant way to get a list of printers on Windows using the following command:

Get-WmiObject -Class Win32_Printer | ConvertTo-Json

This command produces a direct output in JSON format.

You can even filter the properties you need:

Get-WmiObject -Class Win32_Printer | Select-Object Name, DeviceID, DriverName, Location | ConvertTo-Json -Compress