GitHub Copilot과 함께 IronPrint 사용 방법
화물 창고는 탑승구를 떠나는 모든 트레일러에 대해 운송인 인계 양식을 인쇄합니다. 창고의 웹 포털은 운전자, 봉인 번호, 팔레트 수 및 위험 물질을 위한 필드가 있는 채워진 PDF로 각 양식을 저장하고, Visual Studio 솔루션의 .NET 서비스는 각 양식의 두 부를 인쇄합니다. 서비스를 편집하는 도우미는 이미 팀이 사용하는 편집기 내에서 그 솔루션에서 작업해야 합니다.
GitHub Copilot은 Visual Studio 및 VS Code 내에서 채팅 및 에이전트 모드를 제공하고, 터미널용 Copilot CLI 및 할당된 문제에 대한 풀 요청으로 응답하는 GitHub 클라우드 에이전트를 제공합니다. IronPrint는 PrintSettings 객체에서 용지 크기, 사본 수, 해상도 및 양식 평면화가 설정된 .NET에서 프린터로 PDF와 이미지를 보냅니다. 이들 Copilot 인터페이스는 저장소의 지침 파일에서 IronPrint 규칙을 읽습니다.
아래 프롬프트는 Copilot에게 IronPrint를 기반으로 한 인쇄 코드를 요청합니다. 프린터 하드웨어 선택 또는 인쇄 서버 구성은 저장소에서 도우미가 수행할 수 없는 별도의 작업입니다. 평면화 가이드는 이러한 양식이 의존하는 IronPrint 설정을 설명합니다.
빠른 시작솔루션 폴더에서 copilot을 실행하고 프롬프트를 보냅니다. CLI에서는 경로 앞에 @가 그 파일을 첨부합니다. Visual Studio에서는 Copilot Chat이 같은 목적으로 #를 사용합니다.
Fill in @src/Depot.Printing/HandoverPrinter.cs so the depot can print its handover forms.
Use IronPrint 2026.10.1, the version Directory.Packages.props already pins.
Give the class three public static members:
- InstalledPrinters() returns the names from Printer.GetPrinterNames.
- BuildSettings(string printerName) returns the PrintSettings that @docs/print-profile.md describes.
- PrintAsync(string pdfPath, string printerName) checks the name first, then sends the job.
An unknown name throws an ArgumentException whose message lists the installed printers.
Build the solution and fix every error.
Then list the files you changed.
프롬프트는 개별 설정을 명시하지 않습니다. docs/print-profile.md에 있는 인쇄 프로필에는 모든 항목이 나열되어 있으며, Flatten도 그 중 하나입니다.
라이선스 키는 Copilot이 실행되는 환경에 있는 IRONPRINT_LICENSE_KEY에 있습니다. IronPrint 자체는 해당 변수를 읽지 않습니다. 테스트에서 프로그램이 License.LicenseKey에 값을 할당할 때까지 변수가 설정된 상태로 License.IsLicensed은 거짓인 상태로 남아 있었습니다. 키가 지원되는 다른 장소들은 라이선스 키 가이드에 나열되어 있습니다.
최소 워크플로우(5단계)
- NuGet에서 C# 인쇄 라이브러리 다운로드
- .github/copilot-instructions.md와 경로별 지침 파일에 IronPrint 규칙을 작성하세요.
- 모든 양식 작업에 Flatten을 설정하고 설치된 목록과 프린터 이름을 확인하세요.
- 실제 작업을 보내는 대신 코드에서 구축하는 PrintSettings를 테스트하세요.
- 다음 변경 내용을 클라우드 에이전트에 이슈로 할당하고 IronPrint API 레퍼런스에 대해 풀 요청을 검증하세요.
Copilot에 대한 IronPrint 규칙을 어떻게 설정합니까?
프로젝트 전반의 규칙은 .github/copilot-instructions.md에 속합니다. GitHub의 지원 매트릭스는 Visual Studio, VS Code 및 JetBrains IDE의 Copilot Chat, Copilot CLI, Copilot 코드 리뷰 및 클라우드 에이전트에서 그 파일에 대한 지원을 보여줍니다. Visual Studio는 GitHub, Copilot, Copilot Chat 옵션 설정에서 사용자 정의 지침 체크박스를 선택할 때만 Copilot Chat 요청에 파일을 추가합니다.
These rules apply to printing code in this repository:
- Handover forms print through IronPrint. The NuGet package and the namespace are both IronPrint.
- Add no other printing library and no System.Drawing.Printing code.
- Keep the IronPrint version that Directory.Packages.props sets. Only an upgrade task changes it.
- IRONPRINT_LICENSE_KEY holds the license key.
- IronPrint does not read that variable, so Program.cs copies its value into License.LicenseKey.
- Never print the value, and don't dump environment variables either.
- docs/print-profile.md is the print contract. Leave it as it is and suggest changes in your reply.
- https://ironsoftware.com/print/csharp/llms.txt indexes IronPrint's docs for agents.
- No printer on this machine finishes a job without someone answering a dialog.
- Don't send a print job from a session, a test or a dry run.
Printing tests follow these rules:
- Test the PrintSettings the code builds.
- A test never calls Printer.Print or Printer.PrintAsync with a printer name that exists.
마지막 인쇄 규칙은 테스트 기계에서 나옵니다. 그곳에서 Microsoft Print to PDF는 파일 이름을 묻고 Adobe PDF는 Create Adobe PDF 창을 열었으며, 따라서 어느 프린터에든 보낸 작업은 대답할 사람이 대기합니다.
인쇄 코드에 고유한 규칙을 어떻게 부여합니까?
.github/instructions/printing.instructions.md의 applyTo 패턴은 이 경우 소스 및 테스트 프로젝트에 대해 규칙을 트리의 일부로 제한합니다. GitHub의 CLI 문서는 CLI가 경로별 파일을 문맥에 추가하는 것이 applyTo 값과 일치하는 파일 작업에만 해당됨을 설명합니다. 우리의 실행에서, printing.instructions.md는 Copilot이 프롬프트 1에서 처음으로 연 파일이었습니다.
---
applyTo: "src/**,tests/**"
---
Source and test code here follow these IronPrint rules:
- Set Flatten = true for every handover form.
- With Flatten false, IronPrint sends the page with four empty boxes.
- Those boxes are Driver, SealNumber, PalletCount and Hazmat.
- Check a printer name against Printer.GetPrinterNames before a job.
- IronPrint throws nothing for a name it cannot match, even by case or a trailing space.
- It prints on the Windows default printer instead.
- GetPrinterTrays returns an empty list for an unknown name, as it does for some real printers.
- So an empty tray list cannot prove that a printer exists.
- NumberOfCopies reaches the driver as a copy count.
- The job itself holds one page per PDF page.
- With no key, Printer.Print throws an AggregateException that wraps a LicensingException.
- PrintAsync throws the LicensingException itself.
- Margins takes millimeters, in the order left, top, right, bottom.
그 규칙 각각은 IronPrint 2026.10.1로 측정되었습니다. 아래 Flatten 및 프린터 이름 섹션은 첫 번째 규칙 뒤의 측정값을 제공합니다.
왜 양식 필드가 Flatten 없이 비어있는 상태로 인쇄됩니까?
이 측정값들은 시뮬레이션된 프린터를 사용했습니다. Windows에서 IronPrint는 모든 작업을 WPF 인쇄 대화의 PrintDocument 호출로 보냅니다. 그 호출의 훅은 모든 작업의 페이지와 인쇄 티켓을 XPS 파일에 저장했으며, 어떤 인쇄 큐도 작업을 받지 않았습니다. 네 가지 인계 양식이 평면화 가이드의 결합된 예제 설정으로 통과되었습니다. 결과는 물리적 프린터의 용지가 아닌 프린터 드라이버에 IronPrint가 제공하는 페이지를 설명합니다.
아래 비교는 모든 필드에 값을 저장한 상태로 저장된 인계 양식 HO-1001을 사용합니다.
Flatten가 기본값인 false로 남아 있는 경우, 드라이버, 봉인 번호, 팔레트 수 및 위험물 박스는 네 가지 양식 모두 비어 있었습니다. 세 양식은 필드의 외관 스트림을 포함하고 있었으며, 그 박스들도 비어 있었습니다.Flatten = true의 경우, 모든 값이 인쇄되었습니다. 외관 스트림 없이 저장된 양식도 그 값을 인쇄했습니다.- 각 PDF 페이지는 ISO A4 세로 페이지에서 300 DPI로 A4인 2479x3508 픽셀의 이미지 하나가 되었습니다. 두 페이지 양식은 두 페이지를 생성했습니다.
- 인쇄 티켓은 2의 사본 수를 포함하고 있는 동안, 문서는 PDF 페이지당 한 페이지를 보유했습니다.
- 예제에서의 10mm 마진은 이미지를 이동시키지 않았으며, 이미지는 왼쪽 상단 모서리에서 페이지를 채웠습니다.
산출
HO-1001은 처음에 Flatten이 false인 상태로 그리고 다음에 Flatten이 true인 상태로 두 번 훅을 통과했습니다. 아래 각 PDF는 캡처된 작업 하나의 페이지 이미지로, 수정되지 않았고 원래 크기입니다.
IronPrint가 작업을 구축한 대로 Flatten이 false인 HO-1001은 프린터 대신 파일에 캡처되었습니다.
IronPrint가 작업을 구축한 대로 Flatten이 true인 HO-1001은 프린터 대신 파일에 캡처되었습니다.
평면화 가이드는 프린터 드라이버가 양식 레이어를 건너뛰어 빈 필드를 만드는 것을 설명합니다. 캡처에서, 값은 이미 어느 드라이버가 받기 전에 페이지에서 누락되었습니다.
작업을 보내지 않고 양식 폴더를 어떻게 인쇄합니까?
배치 작업은 프린터 없이 테스트할 수 있도록 드라이 런이 필요합니다. 드라이 런은 각 양식이 받게 될 설정을 기록하며, 검토자는 그 로그를 인쇄 프로필과 비교할 수 있습니다.
Turn @src/Depot.PrintJob/Program.cs into the batch job that prints forms/inbox.
It accepts two options:
- --printer <name> picks the printer for every form.
- --dry-run writes the log and sends nothing.
The job runs in this order:
1. Exit with code 2 when the printer isn't installed, and list the installed ones on the console.
2. Read every PDF in forms/inbox in file name order.
3. Get each form's settings from HandoverPrinter.BuildSettings.
4. Append a line per form to out/print-log.csv, then print the form unless it's a dry run.
Paths are relative to the solution root.
The log is semicolon-delimited, with this header line:
Form;Printer;Flatten;Copies;PaperSize;Orientation;Dpi;Grayscale
Run the job twice with --dry-run.
Use --printer "Adobe PDF" the first time and --printer "Depot Laser 2" the second.
Show me both exit codes and the log.
Adobe PDF는 테스트 기계의 프린터입니다. 자신의 프린터 리스트에서 이름을 사용하세요.
프린터 이름이 일치하지 않으면 어떻게 됩니까?
IronPrint는 Windows에서 보고된 이름과 PrinterName를 문자별로 비교하며, 비교가 실패하면 오류를 발생시키지 않습니다. 캡처된 작업은 'NoSuchPrinter 7', 소문자의 'adobe pdf' 및 공백이 붙은 'Adobe PDF'로 주소 지정되었습니다. Windows 기본 프린터인 Microsoft Print to PDF는 세 가지 모두를 받았으며, 정확한 이름만이 Adobe PDF로 갔습니다. 알려지지 않은 이름으로의 라이선스된 작업은 예외를 발생시키지 않았으며 Microsoft Print to PDF의 '다른 이름으로 저장' 대화가 응답된 후에만 반환되었습니다.
GetPrinterTrays는 이름 확인을 대체할 수 없습니다. 해당 코드는 알 수 없는 이름과 Fax 및 Microsoft Print to PDF에 대해 빈 목록을 반환하였습니다. GetPrinterNames이 라이선스 키 없이 네 대의 프린터를 모두 반환했으므로, 그 검사는 라이선스 키 없이 실행되는 테스트에서도 작동합니다.
인쇄 설정을 어떻게 테스트합니까?
Copilot CLI에서 Shift+Tab을 눌러 플랜 모드가 활성화될 때까지 누른 후, 아래 프롬프트를 보냅니다.
Plan an xUnit project in tests/Depot.Printing.Tests and add it to the solution.
Hold off on code until I approve the plan.
Its tests cover these cases:
- Every setting BuildSettings fills in matches @docs/print-profile.md.
- PaperMargins and Tray stay null, so the printer's own defaults apply.
- PrintAsync refuses a name with the wrong case or a trailing space.
- That refusal names every printer InstalledPrinters() returns.
Once the plan is approved, add the tests and run dotnet test.
Then give me the pass and fail counts.
계획을 처음 검토하는 것은 테스트가 기계의 프린터 리스트에 의존하기 전에 스위트가 실제 프린터 이름을 얻는 방법을 보여줍니다.
양식 필드를 빈 상태로 남기는 재인쇄를 어떻게 수정합니까?
메인 서비스와 별도로 작성된 재인쇄 경로는 메인 서비스가 적용하는 설정을 누락할 수 있습니다. 이 경우, 팀원의 ReprintService는 자신의 PrintSettings을 Flatten 없이 구축하며, 운전자는 빈 박스를 포함한 재인쇄를 받습니다.
Drivers say reprinted handover forms have empty Driver, Seal number and Pallet count boxes.
First prints look right. The reprint code is @src/Depot.Printing/ReprintService.cs.
Work out the cause before you edit anything:
1. Compare ReprintService.BuildSettings with HandoverPrinter.BuildSettings.
2. Open IronPrint.xml inside the IronPrint package in the NuGet cache.
3. Quote its summary for the setting that explains the empty boxes.
Then fix ReprintService.cs, and keep a reprint at one copy.
Leave the other source files alone.
Add a test for the reprint settings and run dotnet test.
Tell me the cause you found and the test result.
배송된 IronPrint.xml은 한 문장에서 설정을 증상과 연결하며, Flatten을 양식 필드 값 표시를 위해 유용하다고 설명합니다. 없을 때 값이 누락된다는 내용은 서술하지 않습니다.
클라우드 에이전트가 작동할 수 있는 문제는 무엇입니까?
Copilot은 할당된 이슈 시 제목, 설명 및 기존 댓글과 선택 사항인 프롬프트 필드의 텍스트를 받습니다. GitHub의 문서는 에이전트가 할당 후 댓글을 인식하지 못한다고 명시하므로, 이슈 본문에는 작업 완료 시점을 명시해야 합니다.
Title: Log the printer each reprint was sent to
The work involves these files and settings:
- Files: src/Depot.Printing/ReprintService.cs, tests/Depot.Printing.Tests
- IronPrint version: unchanged from Directory.Packages.props
- Framework: net9.0-windows
After the change, reprints behave like this:
- Every reprint appends a line to out/reprint-log.csv.
- The line holds the form, the printer name, the time and the copy count.
- A printer name that Windows does not report stops the reprint before anything is sent.
Today, reprints leave no record, and ReprintAsync sends a job to any name it receives.
Keep to these limits:
- Keep the ReprintAsync signature.
- Follow .github/instructions/printing.instructions.md.
- Add no packages.
Acceptance means these checks pass:
- Every existing test passes.
- A new test passes "adobe pdf" in lower case and expects an ArgumentException before any job.
테스트는 설치된 프린터와 대소문자만 다른 이름을 사용하므로, 대소문자를 무시하는 검사는 실패합니다.
IronPrint 프로젝트에서 클라우드 에이전트의 테스트가 실패하는 이유는 무엇입니까?
저장소가 다른 실행자를 구성하지 않는 경우, 에이전트의 환경은 Ubuntu Linux입니다. IronPrint의 제품 페이지는 Windows, macOS, iOS, Android를 언급하며 Linux를 언급하지 않으며, 이 솔루션 내의 모든 프로젝트는 net9.0-windows를 타겟으로 합니다. GitHub은 클라우드 에이전트용으로 Windows 64비트 실행자를 지원합니다. 그 통합 방화벽은 Windows와 호환되지 않으므로, GitHub은 자신 호스팅 실행자 또는 Azure 프라이빗 네트워킹을 갖춘 더 큰 GitHub 호스팅 실행자를 권장합니다.
Agents 비밀 없이는 해당 환경에 라이선스 키도 없습니다. 프로브에서 모든 라이선스가 없는 인쇄 호출이 0.2초 이내에 'Production License Required'를 발생시켰으며, 어떤 작업도 생성되기 전에 발생했습니다.
.github/workflows/copilot-setup-steps.yml의 copilot-setup-steps 작업이 에이전트가 작업을 시작하기 전에 실행되며, GitHub은 기본 브랜치가 파일을 포함한 후에만 트리거합니다.
The cloud agent has to build this solution, so add a setup workflow for it.
Its path is .github/workflows/copilot-setup-steps.yml.
Copilot looks for one job, and it has to be named copilot-setup-steps.
The job works like this:
- Run it on windows-latest, because every project targets net9.0-windows.
- Its only permission is contents: read.
- Start it from workflow_dispatch and from pull requests that edit this workflow file.
- Its steps are a checkout, a .NET 9 SDK install, a restore and a Release build.
Printing calls need IRONPRINT_LICENSE_KEY, which is stored as an Agents secret.
The job sees that secret as an environment variable.
Add a step that tests whether the key is set:
- For pull_request and workflow_dispatch events, a missing key is a warning and the step passes.
- For every other event, a missing key fails the step with a message that names the secret.
That step goes last, since Copilot skips every setup step after one that fails.
Create the file and show me the YAML.
키를 위한 Agents 비밀 사용: 클라우드 에이전트는 Actions, Codespaces, Dependabot 비밀을 읽을 수 없습니다. IRONPRINT_LICENSE_KEY을 리포지토리 설정의 보안 그룹에 있는 Secrets 및 변수의 Agents 페이지에 추가하세요. 그런 후, 에이전트는 환경 변수로 키를 받습니다.
병합 전에 무엇을 확인해야 합니까?
리뷰를 고유의 copilot -p 명령으로 보내세요. --continue나 --resume 없이, 해당 명령은 코딩 세션으로부터 어떤 기록도 없는 새로운 세션을 시작합니다.
/review the changes made since this branch's first commit.
Compare each IronPrint call with .github/instructions/printing.instructions.md.
Then compare it with the IronPrint.xml that ships in the IronPrint NuGet package.
Name every place where the code and those two sources disagree.
Flag any of these as well:
- a PrintSettings for a handover form that leaves Flatten unset or false
- a print call whose printer name was never checked against Printer.GetPrinterNames
- a test that sends a real print job
- a catch block that would miss the LicensingException a print call throws
- any line that writes IRONPRINT_LICENSE_KEY to the console or a log
Report what you find and leave every file unchanged.
실제 실행에서 프롬프트가 무엇을 생성했습니까?
총 여섯 개의 프롬프트는 이 가이드를 위해 구축된 건물 솔루션에서 키보드에 사람이 없는 상태로 Copilot CLI에서 차례로 실행될 예정이었습니다. 프롬프트마다 커밋이 재구축되고 그 위에서 배치 작업이 실행되었습니다. 그 각 양식에 대한 설정이 IronPrint를 통해 전달되었으며, 인쇄 호출이 가로채어져 어떤 작업도 프린터에 도달하지 않았습니다.
- 실행 전, HandoverPrinter는 빈 정적 클래스였으며 배치 작업은 코드 1로 종료하는 스텁이었습니다.
- 첫 번째 프롬프트는 HandoverPrinter.cs만 변경했습니다.
- 첫 번째 프롬프트 후, BuildSettings는 Flatten 켜짐, 2부, A4, 세로, 300 DPI 및 그레이스케일을 반환했습니다.
- 대기열과 마진은 설정되지 않아, 프린터 기본값이 적용되었습니다.
- PrintAsync는 대소문자를 구별하는 순서 비교로 프린터 이름을 확인했습니다.
- 모든 필드 값이 네 가지 양식의 캡처된 페이지에 나타났습니다.
- 각 양식의 인쇄 티켓은 2부, ISO A4 세로, 모노Chrome 출력 및 300 DPI를 담고 있었습니다.
- 2페이지 양식의 캡처된 작업은 두 페이지를 보유했고, 다른 작업은 각각 한 페이지를 보유했습니다.
- 두 개의 프롬프트 모두 후 솔루션은 0 오류와 함께 구축되었습니다.
- 두 번째 프롬프트 후 Adobe PDF의 드라이런이 코드 0으로 종료되었으며, 양식당 한 줄을 기록했습니다.
- 기록된 각 행은 인쇄 프로필과 일치하며, Flatten 및 그레이스케일이 모두 참이었습니다.
- Depot Laser 2의 드라이런은 코드 2로 종료되었으며, 콘솔 출력에 네 개의 설치된 프린터 이름을 포함했습니다.
- 드라이런 중 어떤 하나도 인쇄 호출을 수행하지 않았습니다.
- 실행 중 어떤 큐에서도 인쇄 작업이 나타나지 않았습니다.
- 일부 단계는 페이지와 달리 작동했습니다. 두 번째 프롬프트에서 월간 Copilot 사용량이 다 되었으나, Copilot이 작업을 구축한 후 및 드라이런 실행 전이었습니다. 드라이런 둘 다 Copilot 외부에서 실행되었습니다. 프롬프트 3~6은 실행되지 않았으므로 계획 모드, 재인쇄 수정, 설정 워크플로 및 리뷰는 이 페이지에 실행 결과가 없습니다. 이슈, 클라우드 에이전트 및 Agents 비밀은 호스팅된 저장소가 필요하므로 아무것도 테스트되지 않았습니다.
Cursor는 파일 패턴으로 규칙을 범위로 설정하고, Claude Code는 코드 변화 전 승인된 계획을 기다립니다. 공유 실행 기록에는 CLI 버전, Auto가 선택한 모델, 총 실행 시간 및 하드웨어가 포함됩니다.
문제 해결
- 인쇄 전에 PDF 평면화하는 방법은 비어 있는 상태로 인쇄되는 양식 필드에 대해
- 프린터 이름 얻는 방법은 Windows가 보고하는 이름에 대해
- 프린터 이름 지정 방법은 잘못된 프린터에 도달하는 작업에 대해
- WPF 및 WinForms에서 Print() 메소드가 중단되는 경우는 인터페이스를 정지시키는 인쇄 호출에 대해
- 라이선스 키 적용은 키가 설정될 수 있는 모든 장소에 대해
질문?
질문이 있으시면 support@ironsoftware.com으로 문의하세요.
커티스 차우는 칼턴 대학교에서 컴퓨터 과학 학사 학위를 취득했으며, Node.js, TypeScript, JavaScript, React를 전문으로 하는 프론트엔드 개발자입니다. 직관적이고 미적으로 뛰어난 사용자 인터페이스를 만드는 데 열정을 가진 그는 최신 프레임워크를 활용하고, 잘 구성되고 시각적으로 매력적인 매뉴얼을 제작하는 것을 즐깁니다.