Node.js를 사용하여 PDF 파일을 인쇄하는 방법
Node.js에서 PDF 파일을 인쇄하려면 운영 체제의 인쇄 스풀러로 문서를 보내야 합니다. pdf-to-printer npm 패키지는 해당 시스템 호출을 Windows, macOS 및 Linux에서 작동하는 Promise 기반 API로 추상화하여, 단 한 번의 메서드 호출로 인쇄 작업을 대기열에 추가할 수 있게 해줍니다. 인쇄 전에 PDF를 생성해야 할 때 — HTML, URL 또는 템플릿을 인쇄 준비 문서로 변환하는 경우 — IronPDF for Node.js는 이 워크플로우와 자연스럽게 짝을 이룹니다.
빠른 시작: Node.js에서 PDF 파일 인쇄
//:path=/static-assets/pdf/content-code-examples/nodejs/how-to/nodejs-print-pdf/quickstart.js
// 1. Install: npm install pdf-to-printer
const printer = require('pdf-to-printer');
// 2. Print the PDF file (returns a Promise)
printer
.print('./invoice.pdf')
.then(() => console.log('Print job queued successfully.'))
.catch((err) => console.error('Print failed:', err));//:path=/static-assets/pdf/content-code-examples/nodejs/how-to/nodejs-print-pdf/quickstart.js
// 1. Install: npm install pdf-to-printer
const printer = require('pdf-to-printer');
// 2. Print the PDF file (returns a Promise)
printer
.print('./invoice.pdf')
.then(() => console.log('Print job queued successfully.'))
.catch((err) => console.error('Print failed:', err));최소 워크플로우 (5단계)
1. Install-Package: `npm install pdf-to-printer` 2. 모듈 가져오기: `const printer = require('pdf-to-printer');` 3. `printer.print('./path/to/file.pdf')` 호출 -- Promise를 반환합니다 4. 성공 시에는 `.then()`을, 오류 시에는 `.catch()`을 사용하여 처리하십시오. 5. 특정 프린터를 지정하거나 복사 매수를 설정하려면 두 번째 인수로 `printer옵션s` 객체를 전달하십시오.Node.js에서 PDF를 인쇄하기 위한 사전 요구 사항은 무엇인가요?
pdf-to-printer를 사용하려면 Node.js 14.x 이상과 npm이 필요합니다. 패키지는 번들 인쇄 엔진 대신 Native OS 인쇄 명령에 의존하므로, 타겟 머신에 프린터 드라이버가 이미 구성되어 있어야 합니다.
Windows에서는 이 패키지가 PowerShell을 통해 SumatraPDF를 호출합니다. 시스템 정책에 의해 PowerShell 스크립트 실행이 차단되지 않았는지 확인하십시오. macOS 및 Linux에서 이 패키지는 CUPS 인쇄 시스템의 일부인 lp 명령을 호출합니다. CUPS가 설치되어 있고, lpstat -p에 최소 한 대의 프린터가 등록되어 있는지 확인하십시오.
pdf-to-printer 패키지는 모든 활성 Node.js LTS 버전을 지원합니다.Node.js 프로젝트를 PDF 인쇄를 위해 설정하려면 어떻게 해야 하나요?
새 프로젝트를 초기화하고 패키지를 설치하며, 인쇄 로직을 작성하기 전에 최소한의 디렉토리 구조를 만드십시오.
//:path=/static-assets/pdf/content-code-examples/nodejs/how-to/nodejs-print-pdf/setup.sh
mkdir pdf-printer
cd pdf-printer
npm init -y
npm install pdf-to-printer//:path=/static-assets/pdf/content-code-examples/nodejs/how-to/nodejs-print-pdf/setup.sh
mkdir pdf-printer
cd pdf-printer
npm init -y
npm install pdf-to-printer설치 후, 인쇄 로직을 위한 index.js 파일을 생성하고, 인쇄할 문서를 보관할 pdfs/ 폴더를 만드십시오. 프린터 설정을 위한 별도의 config.js을 사용하면 핵심 로직에서 프린터 이름을 분리할 수 있습니다. 이는 개발 환경과 운영 환경에서 대상 프린터가 다른 다중 환경 배포 시 유용한 패턴입니다.
모듈은 런타임에 해결되는 네이티브 바인딩을 사용하므로 컴파일 단계가 필요하지 않습니다. node_modules/pdf-to-printer/dist/ 디렉터리에는 감지된 플랫폼용 사전 빌드된 바이너리가 포함됩니다.
PDF 파일을 기본 사용법으로 인쇄하려면 어떻게 해야 하나요?
printer.print()에 절대 경로 또는 상대 경로를 전달하십시오. 이 메서드는 시스템 기본 프린터로 문서를 큐에 놓고 작업이 스풀러에 수락되면 약속을 해결합니다 — 물리적 인쇄가 완료될 때가 아닙니다.
//:path=/static-assets/pdf/content-code-examples/nodejs/how-to/nodejs-print-pdf/basic-print.js
const fs = require('fs').promises;
const printer = require('pdf-to-printer');
async function printPDF(filePath) {
// Verify the file exists before sending to printer
await fs.access(filePath);
const stats = await fs.stat(filePath);
if (stats.size === 0) {
throw new Error('PDF file is empty');
}
await printer.print(filePath);
console.log(`Print job queued: ${filePath}`);
}
printPDF('./pdfs/invoice.pdf').catch((err) => {
if (err.code === 'ENOENT') {
console.error('File not found:', err.path);
} else {
console.error('Print error:', err.message);
}
});//:path=/static-assets/pdf/content-code-examples/nodejs/how-to/nodejs-print-pdf/basic-print.js
const fs = require('fs').promises;
const printer = require('pdf-to-printer');
async function printPDF(filePath) {
// Verify the file exists before sending to printer
await fs.access(filePath);
const stats = await fs.stat(filePath);
if (stats.size === 0) {
throw new Error('PDF file is empty');
}
await printer.print(filePath);
console.log(`Print job queued: ${filePath}`);
}
printPDF('./pdfs/invoice.pdf').catch((err) => {
if (err.code === 'ENOENT') {
console.error('File not found:', err.path);
} else {
console.error('Print error:', err.message);
}
});printer.print()을 호출하기 전에 파일 존재 여부를 확인하면 경로가 잘못되었거나 파일이 이동된 경우 발생하는 무증상 오류를 방지할 수 있습니다. 경로가 확인되지 않으면 fs.access() 호출은 ENOENT을 발생시켜, 일반적인 스풀러 거부 오류 대신 구체적인 오류 메시지를 제공합니다. 일반적인 오류 원인으로는 잘못된 상대 경로, 누락된 프린터 드라이버, 프린터 오프라인 상태가 있습니다.
인쇄 전에 PDF를 생성하려면 어떻게 해야 하나요?
문서가 아직 파일로 존재하지 않는 경우, printer.print()을 호출하기 전에 IronPDF for Node.js를 사용하여 생성하십시오. IronPDF는 별도의 브라우저 인스턴스를 요구하지 않고 HTML, URL 및 템플릿 문자열을 인쇄 가능한 PDF 파일로 렌더링합니다.
//:path=/static-assets/pdf/content-code-examples/nodejs/how-to/nodejs-print-pdf/generate-and-print.js
const { PdfDocument } = require('@ironsoftware/ironpdf');
const printer = require('pdf-to-printer');
async function generateAndPrint(htmlContent, outputPath) {
// Render HTML to a PDF file using IronPDF
const pdf = await PdfDocument.fromHtml(htmlContent);
await pdf.saveAs(outputPath);
// Send the generated file to the default printer
await printer.print(outputPath);
console.log(`Generated and printed: ${outputPath}`);
}
generateAndPrint('<h1>Monthly Report</h1><p>Sales data for May 2026.</p>', './pdfs/report.pdf');//:path=/static-assets/pdf/content-code-examples/nodejs/how-to/nodejs-print-pdf/generate-and-print.js
const { PdfDocument } = require('@ironsoftware/ironpdf');
const printer = require('pdf-to-printer');
async function generateAndPrint(htmlContent, outputPath) {
// Render HTML to a PDF file using IronPDF
const pdf = await PdfDocument.fromHtml(htmlContent);
await pdf.saveAs(outputPath);
// Send the generated file to the default printer
await printer.print(outputPath);
console.log(`Generated and printed: ${outputPath}`);
}
generateAndPrint('<h1>Monthly Report</h1><p>Sales data for May 2026.</p>', './pdfs/report.pdf');이 패턴은 실행 시간에 데이터베이스 레코드나 API 응답에서 PDF 콘텐츠를 조합하는 보고 워크플로우에서 흔하게 사용됩니다. IronPDF의 렌더링 옵션 전체를 다루는 HTML을 PDF로 변환하는 튜토리얼을 참조하여, CSS 지원 및 헤더/푸터 주입을 포함합니다.
사용자 지정 프린터 옵션은 어떻게 지정하나요?
printer옵션s 객체를 printer.print()의 두 번째 인수로 전달하여 특정 프린터를 지정하거나, 복사 매수를 설정하거나, 페이지 범위를 선택하거나, 페이지 확대/축소 비율을 제어할 수 있습니다. 프린터 이름은 printer.getPrinters()에서 반환되는 정확한 값과 일치해야 합니다.
//:path=/static-assets/pdf/content-code-examples/nodejs/how-to/nodejs-print-pdf/custom-options.js
const printer = require('pdf-to-printer');
async function printWith옵션s(filePath) {
// List available printers to find the correct name
const printers = await printer.getPrinters();
printers.forEach((p) => {
console.log(`${p.name} -- default: ${p.isDefault}`);
});
const options = {
printer: 'HP LaserJet Pro', // Exact name from getPrinters()
copies: 2, // Number of copies
pages: '1-3,5', // Pages to print (optional)
scale: 'fit', // 'fit' | 'noscale' | 'shrink'
orientation: 'portrait', // 'portrait' | 'landscape'
};
await printer.print(filePath, options);
console.log(`Printed ${options.copies} copies to "${options.printer}"`);
}
printWith옵션s('./pdfs/shipping-label.pdf').catch(console.error);//:path=/static-assets/pdf/content-code-examples/nodejs/how-to/nodejs-print-pdf/custom-options.js
const printer = require('pdf-to-printer');
async function printWith옵션s(filePath) {
// List available printers to find the correct name
const printers = await printer.getPrinters();
printers.forEach((p) => {
console.log(`${p.name} -- default: ${p.isDefault}`);
});
const options = {
printer: 'HP LaserJet Pro', // Exact name from getPrinters()
copies: 2, // Number of copies
pages: '1-3,5', // Pages to print (optional)
scale: 'fit', // 'fit' | 'noscale' | 'shrink'
orientation: 'portrait', // 'portrait' | 'landscape'
};
await printer.print(filePath, options);
console.log(`Printed ${options.copies} copies to "${options.printer}"`);
}
printWith옵션s('./pdfs/shipping-label.pdf').catch(console.error);getPrinters()를 print()보다 먼저 호출하는 것은 두 가지 목적을 갖습니다. 프린터가 온라인 상태이고 연결 가능한지 확인하는 것과, OS가 인쇄 작업을 라우팅하는 데 사용하는 공식 이름 문자열을 제공하는 것입니다. 프린터 이름은 종종 시스템 설정에 표시되는 표시 이름과 다른 버전 번호나 네트워크 접미사를 포함할 수 있습니다.
getPrinters()은 레지스트리에서 프린터 목록을 반환합니다. macOS/Linux에서는, CUPS를 쿼리합니다. isDefault 플래그는 프린터 이름이 지정되지 않았을 때 작업을 수신하는 프린터를 식별합니다.어떤 프린터 옵션을 구성할 수 있나요?
printer옵션s 객체는 다음 필드를 지원합니다:
| 옵션 | 유형 | 설명 | 예시 값 |
|---|---|---|---|
프린터 | 끈 | getPrinters()에 의해 반환된 정확한 프린터 이름 | 'HP LaserJet Pro' |
사본 | 숫자 | 인쇄할 복사본 수 | 2 |
페이지 | 끈 | 페이지 범위 문자열 | '1-3,5' |
scale | 끈 | 페이지 축척 모드 | 'fit', 'noscale', 'shrink' |
방향 | 끈 | 페이지 방향 재정의 | '세로 방향', '가로 방향' |
PDF 생성 중에가 아닌 인쇄 시 사용자 정의 용지 크기나 특정 페이지 방향이 필요하다면, 파일을 저장하기 전에 IronPDF 렌더링 단계에서 옵션을 구성하십시오.
Node.js에서 배치 인쇄를 구현하려면 어떻게 해야 하나요?
PDF 파일이 포함된 폴더나 동적으로 생성된 목록을 처리하려면 배열을 반복하며 각 파일에 대해 printer.print()을 호출하십시오. for...of을 await과 함께 사용하면 작업이 순차적으로 처리되어, 인쇄 스풀러가 동시 요청으로 인해 과부하되는 것을 방지할 수 있습니다.
//:path=/static-assets/pdf/content-code-examples/nodejs/how-to/nodejs-print-pdf/batch-print.js
const printer = require('pdf-to-printer');
const fs = require('fs').promises;
const path = require('path');
class BatchPrinter {
constructor(printerName = null) {
this.printerName = printerName;
this.queue = [];
}
async addFiles(filePaths) {
for (const filePath of filePaths) {
try {
await fs.access(filePath);
this.queue.push(filePath);
} catch {
console.warn(`Skipped (not found): ${filePath}`);
}
}
}
async printAll(options = {}) {
const results = { successful: 0, failed: 0, errors: [] };
for (const filePath of this.queue) {
try {
const print옵션s = {
...options,
...(this.printerName && { printer: this.printerName }),
};
await printer.print(filePath, print옵션s);
results.successful++;
console.log(`Printed: ${path.basename(filePath)}`);
} catch (err) {
results.failed++;
results.errors.push({ file: filePath, error: err.message });
}
}
this.queue = [];
return results;
}
}
// Usage: print monthly reports to a specific printer
(async () => {
const batch = new BatchPrinter('Office Printer A3');
await batch.addFiles([
'./reports/january.pdf',
'./reports/february.pdf',
'./reports/march.pdf',
]);
const results = await batch.printAll({ copies: 1 });
console.log(`Done -- ${results.successful} printed, ${results.failed} failed.`);
})();//:path=/static-assets/pdf/content-code-examples/nodejs/how-to/nodejs-print-pdf/batch-print.js
const printer = require('pdf-to-printer');
const fs = require('fs').promises;
const path = require('path');
class BatchPrinter {
constructor(printerName = null) {
this.printerName = printerName;
this.queue = [];
}
async addFiles(filePaths) {
for (const filePath of filePaths) {
try {
await fs.access(filePath);
this.queue.push(filePath);
} catch {
console.warn(`Skipped (not found): ${filePath}`);
}
}
}
async printAll(options = {}) {
const results = { successful: 0, failed: 0, errors: [] };
for (const filePath of this.queue) {
try {
const print옵션s = {
...options,
...(this.printerName && { printer: this.printerName }),
};
await printer.print(filePath, print옵션s);
results.successful++;
console.log(`Printed: ${path.basename(filePath)}`);
} catch (err) {
results.failed++;
results.errors.push({ file: filePath, error: err.message });
}
}
this.queue = [];
return results;
}
}
// Usage: print monthly reports to a specific printer
(async () => {
const batch = new BatchPrinter('Office Printer A3');
await batch.addFiles([
'./reports/january.pdf',
'./reports/february.pdf',
'./reports/march.pdf',
]);
const results = await batch.printAll({ copies: 1 });
console.log(`Done -- ${results.successful} printed, ${results.failed} failed.`);
})();BatchPrinter 클래스는 유효성 검사와 실행을 분리합니다. addFiles() 처리 과정에서 존재하지 않는 파일은 건너뛰어, 단 하나의 누락된 파일로 인해 전체 배치 작업이 중단되지 않도록 합니다. printAll() 메서드는 파일별 오류를 기록하고, 로그에 기록하거나 모니터링 서비스로 전달할 수 있는 요약 정보를 반환합니다.
동적으로 생성된 보고서의 경우, 이 패턴을 IronPDF의 HTML 문자열을 PDF로 변환과 결합하여 단일 파이프라인에서 생성 및 인쇄합니다. 대량 인쇄 전에 PDF 압축 예제를 적용하면 네트워크 프린터에서 전송 시간을 줄일 수 있습니다.
await 지연을 추가하십시오. 일부 구형 네트워크 프린터는 빠른 연속 제출을 거부할 수 있습니다. 200-500ms 멈춤이 보통 충분합니다.Node.js PDF 인쇄를 위한 플랫폼별 고려 사항은 무엇입니까?
pdf-to-printer 패키지는 OS마다 서로 다른 시스템 명령어를 사용합니다. 기저 메커니즘을 이해하면 플랫폼별 실패를 진단하는 데 도움이 됩니다.
Windows에서 PDF 인쇄는 어떻게 작동합니까?
Windows에서 pdf-to-printer는 PowerShell 명령을 통해 SumatraPDF를 호출합니다. SumatraPDF는 패키지와 함께 번들로 제공되며 별도의 설치가 필요하지 않습니다. PowerShell 스크립트 실행은 현재 실행 정책에서 허용되어야 합니다. PowerShell에서 Get-ExecutionPolicy을 실행하여 확인하십시오; 결과가 Restricted인 경우, 해당 세션에 대해 RemoteSigned 또는 Bypass로 설정하십시오.
Windows에서 프린터 이름은 대소문자를 구분하며, 설정 > Bluetooth & 장치 > 프린터 및 스캐너에 표시된 값과 정확히 일치해야 하며, 괄호로 묶인 네트워크 접미사도 포함해야 합니다.
macOS 및 Linux에서 PDF 인쇄는 어떻게 작동합니까?
macOS 및 Linux에서 이 패키지는 lp(CUPS의 일부)를 호출합니다. lpstat -p 명령어를 사용하여 CUPS가 실행 중인지 확인하십시오. 이 명령어는 등록된 모든 프린터와 현재 상태를 나열합니다. 프린터가 나타나지 않으면 CUPS 서비스가 시작되지 않았을 수 있습니다; Linux에서는 sudo systemctl start cups를 사용하거나, macOS에서는 시스템 환경설정 > 프린터를 통해 이 기능을 활성화하십시오.
lp 명령어는 Windows SumatraPDF 경로와 동일한 옵션을 모두 지원하지 않습니다. 프린터 드라이버에 따라 scale 및 orientation 옵션은 CUPS 기반 인쇄에 영향을 미치지 않을 수 있습니다. 배포 전에 대상 하드웨어에서 테스트하십시오.
pdf-to-printer 패키지는 현재 로컬 및 네트워크 프린터로만 인쇄할 수 있습니다. 이 패키지를 통해 Microsoft Universal Print와 같은 클라우드 인쇄 서비스는 지원되지 않습니다.PDF 인쇄 시 보안 및 권한 관리는 어떻게 해야 합니까?
민감한 문서를 처리하는 생산 인쇄 시스템 -- 계약서, 금융 기록, 의료 양식 --은 접근 제어 및 감사 로그가 필요합니다. 누가 무엇을 언제 인쇄했는지 추적하는 것은 많은 규제 산업에서 준수 요구 사항입니다.
//:path=/static-assets/pdf/content-code-examples/nodejs/how-to/nodejs-print-pdf/secure-print.js
const printer = require('pdf-to-printer');
const crypto = require('crypto');
class AuditedPrinter {
constructor() {
this.log = [];
}
async print(filePath, userId, options = {}) {
const jobId = crypto.randomBytes(8).toString('hex');
const entry = { jobId, userId, filePath, options, status: 'pending', startedAt: new Date().toISOString() };
this.log.push(entry);
try {
await printer.print(filePath, options);
entry.status = 'completed';
entry.completedAt = new Date().toISOString();
return { success: true, jobId };
} catch (err) {
entry.status = 'failed';
entry.error = err.message;
throw err;
}
}
getLog(userId = null) {
return userId ? this.log.filter((e) => e.userId === userId) : this.log;
}
}
// Usage
const auditedPrinter = new AuditedPrinter();
(async () => {
await auditedPrinter.print('./contracts/nda-2026.pdf', 'user-42', { copies: 1 });
console.log('Audit log:', auditedPrinter.getLog('user-42'));
})();//:path=/static-assets/pdf/content-code-examples/nodejs/how-to/nodejs-print-pdf/secure-print.js
const printer = require('pdf-to-printer');
const crypto = require('crypto');
class AuditedPrinter {
constructor() {
this.log = [];
}
async print(filePath, userId, options = {}) {
const jobId = crypto.randomBytes(8).toString('hex');
const entry = { jobId, userId, filePath, options, status: 'pending', startedAt: new Date().toISOString() };
this.log.push(entry);
try {
await printer.print(filePath, options);
entry.status = 'completed';
entry.completedAt = new Date().toISOString();
return { success: true, jobId };
} catch (err) {
entry.status = 'failed';
entry.error = err.message;
throw err;
}
}
getLog(userId = null) {
return userId ? this.log.filter((e) => e.userId === userId) : this.log;
}
}
// Usage
const auditedPrinter = new AuditedPrinter();
(async () => {
await auditedPrinter.print('./contracts/nda-2026.pdf', 'user-42', { copies: 1 });
console.log('Audit log:', auditedPrinter.getLog('user-42'));
})();AuditedPrinter 클래스는 모든 PRINT 요청에 고유한 작업 ID를 할당하고 사용자 신원, 파일 경로 및 타임스탬프를 기록합니다. this.log을 데이터베이스나 추가 전용 로그 파일에 영구 저장하면 이를 내구성 있는 감사 기록으로 만들 수 있습니다. 개인 식별 정보를 포함하는 문서의 경우, 프린터 대기열에 도착하기 전에 파일을 보호하기 위해 IronPDF의 PDF 암호화 기능을 사용하는 것을 고려하십시오.
HTTP를 통해 인쇄 요청을 수락하는 서버 애플리케이션의 경우, 인쇄 전에 파일 유형과 크기를 검증하십시오 -- 유효하지 않은 PDF 바이너리 업로드를 모두 거부하십시오. 사용자가 제공한 파일 경로를 검증 없이 printer.print()에 직접 전달해서는 안 됩니다.
Node.js PDF 인쇄의 다음 단계는 무엇입니까?
이 가이드에서는 pdf-to-printer을 사용하여 기존 PDF 파일을 로컬 및 네트워크 프린터로 인쇄하는 방법에 대해 다루었습니다. 여기에는 기본적인 단일 파일 인쇄부터 일괄 인쇄 대기열, 사용자 지정 프린터 옵션, 플랫폼 고려 사항, 규제 환경을 위한 감사 로깅까지 포함됩니다.
PDF 생성으로 이 워크플로를 확장하려면 IronPDF for Node.js의 무료 체험판을 시작하고 HTML을 PDF로 변환하는 튜토리얼을 따라 전체 문서 파이프라인을 구축하십시오. 라이선스 옵션 및 볼륨 가격에 대한 자세한 내용은 IronPDF 라이선스 페이지를 참조하십시오.
더 나아갈 준비가 되셨나요? IronPDF for Node.js의 전체 사용법 컬렉션을 탐색하여 PDF 파일 병합, PDF 파일 압축, PDF를 이미지로 변환 방법을 배워보세요.
자주 묻는 질문
Node.js에서 PDF 파일을 인쇄하는 가장 쉬운 방법은 무엇인가요?
Node.js에서 pdf-to-printer npm 패키지를 사용하세요. npm install pdf-to-printer로 설치한 다음, printer.print('./file.pdf')를 호출하세요. 이는 Promise를 반환하고 시스템 기본 프린터로 작업을 한 번의 호출로 큐에 넣습니다.
Node.js에서 PDF를 인쇄하기 위한 필수 조건은 무엇입니까?
Node.js 14.x 이상, npm 및 호스트 머신에 구성된 프린터 드라이버가 필요합니다. Windows에서는 PowerShell 실행 정책이 스크립트 실행을 허용해야 합니다. macOS 및 Linux에서는 CUPS가 설치 및 실행되어야 하며, lpstat -p를 통해 적어도 한 개의 프린터가 등록되어 있어야 합니다.
Node.js에서 특정 프린터로 출력하려면 어떻게 해야 하나요?
printer.print()의 두 번째 인수로 printerOptions 객체를 전달합니다. printer 필드를 printer.getPrinters()에서 반환한 정확한 프린터 이름으로 설정합니다. 프린터 이름은 대소문자를 구분하며 OS 레지스트리 항목과 정확히 일치해야 합니다.
Node.js 스크립트에서 PDF를 생성하고 인쇄할 수 있나요?
네. 먼저 IronPDF for Node.js를 사용하여 파일을 생성하세요: HTML 콘텐츠를 렌더링하려면 PdfDocument.fromHtml(html)을 호출하고, pdf.saveAs(path)로 저장한 다음, 그 경로를 printer.print(path)에 전달하세요. npm install @ironsoftware/ironpdf로 IronPDF를 설치하세요.
pdf-to-printer가 macOS 및 Linux에서 작동하나요?
네. macOS 및 Linux에서는 패키지가 CUPS의 lp 명령어에 위임합니다. lpstat -p를 통해 CUPS가 실행 중인지 확인하세요. scale 및 orientation 옵션이 모든 CUPS 프린터 드라이버에서 적용되지 않을 수 있음을 유의하세요.
Node.js에서 인쇄 작업의 감사 로그를 추가하려면 어떻게 해야 하나요?
printer.print()를 crypto.randomBytes(8).toString('hex')를 사용하여 고유 작업 ID를 부여하고 파일 경로, 사용자 ID 및 타임스탬프를 기록하는 클래스로 래핑합니다. 로그 배열을 애플리케이션의 쓰기 가능한 디렉토리 외부의 데이터베이스나 추가 전용 파일에 저장합니다.





