IronPrintとChatGPT Codexの使い方
倉庫では、毎晩、注文ごとにピッキングリストを印刷します。 一部の注文はピッカー用に1部、他はパッカー用に2部目、請求担当者に3部目が必要です。 コピー数が間違っていても、何も失敗しません。 パッカーはパートナーのコピーがないシートを見つけたり、請求デスクが1つの注文の9枚を受け取ったりしますが、それでもプリントログにはその注文が送信済みと報告されます。
ChatGPT Codex、OpenAIのコーディングエージェントは、リポジトリのファイルを編集し、dotnet runやその他のコマンドを実行し、行ったことを報告します。 それはChatGPTのデスクトップアプリ、IDE、ターミナル、およびクラウドで動作します。 IronPrint、Iron Softwareの.NET印刷ライブラリは、PDFおよび画像ファイルをインストールされたプリンターに送り、オペレーティングシステムの印刷ダイアログを通じて、またはサイレントで、用紙サイズ、向き、DPI、グレースケール、およびPrintSettingsオブジェクト上で設定されたコピー数と共に印刷します。
Codexはピッキングリスト注文の夜と予想結果のマニフェストを受け取ります。 Codexからのすべてのコピー数はCSVファイルから来ており、任意のジョブがプリンタに送信される前に全バッチが計画されています。
クイックスタート.NETコンソールプロジェクト内でOrdersフォルダと一緒にCodexを実行します。
$ironprint Install IronPrint 2026.10.1 from NuGet in this console project.
Program.cs should then plan the six orders in Orders/sample/ without sending a job.
Give each sample PDF a row in out/quickstart.csv. The columns are:
- file
- copies, from that order's row in Orders/manifest.csv
- printer, the PrinterName in appsettings.json
- found, yes or no, whether Printer.GetPrinterNames lists that printer
Read the total copies back from that CSV and show it.
Program.cs gets the key from IRONPRINT_LICENSE_KEY by itself.
Don't show the key's value anywhere, and don't list environment variables.
Keep the PrintCapture.Install line first in Program.cs.
Don't call Print, PrintAsync or ShowPrintDialog yet.
Stop after three failed builds or runs, and tell me what came out.
$ironprintメンションはIronPrintのスキルをセッションに読み込みます。
最小限のワークフロー(5ステップ)
- NuGetからC#印刷ライブラリをダウンロードする
- IronPrintのスキルを.agents/skills/ironprint/SKILL.mdとして保存することで、
$ironprintメンションを解決します。 - プリンタ名のソースを指定し、すべてのカウントにCSVを必要とするAGENTS.mdをコミットします。
Printer.GetPrinterNamesに対する正確な一致後に、そのコピー数で注文ごとにPrintSettingsを構築します。- 任意のジョブが送信される前に計画ファイルとマニフェストを比較します。
ChatGPT Codexとは何か、.NET印刷の仕事にどのように適合するのか?
CodexのCLIドキュメントはインストールとターミナルの使い方を説明し、ソースコードとリリースはGitHubにあります。
CodexはIronPrintのトレーニングデータとコンテキスト内のファイルに依存しており、不正なメンバー名はビルドを失敗させます。
IronPrintはWindows、macOS、iOS、Androidをサポートしています。 このガイドのプロジェクトはnet9.0-windowsをターゲットにしています。
IronPrintプロンプトの書き方とCodexの設定方法は?
IronPrintバッチプロンプトは入力を名前付けします(Orders/manifest.csv内のすべての注文)、プリンタとその名前のソース(Printer.GetPrinterNamesでチェックされたappsettings.json)、各ジョブの設定(マニフェストからのコピー数、用紙サイズ、ポートレート、グレースケール、150 DPI)、プローブ(注文ごとに1行のプランCSV)、基準(マニフェストの予想ステータス)および制約(正確なプリンタ名とShowPrintDialogを呼び出さないこと)。
Codexは作業ディレクトリと上位の各ディレクトリをリポジトリのルートまで検索し、.agents/skillsフォルダを探します。 各スキルフォルダには名前と説明を記したSKILL.mdファイルがあります。 IronPrintのskill.mdを.agents/skills/IronPrint/SKILL.mdにコピーすると、$ironprintメンションが解決されます。 スキル内の単一ファイルの例はIronPrint 2026.8.1を固定し、クイックスタートは2026.10.1をインストールします。
作業を始める前に、Codexはリポジトリのルートから作業フォルダまでのパスのAGENTS.mdファイルを読み込みます。 1ディレクトリにつき1つを超えて読みませんが、2つが競合するときは、作業フォルダに近いファイルが優先されます。 /initを実行すると出発点のドラフトが生成されます。
テスト機にはダイアログなしでジョブを完了するプリンタはなく、ダイアログは無人実行を停止させます。 よって、テストリポジトリにはIronPrintがWindowsに送信するジョブを傍受し、それをXPSファイルに書き込む小さなキャプチャークラスが含まれますので、ジョブはスプールされません。 作業プリンタがあるプロジェクトはそれを除外します。
Write a root-level AGENTS.md containing a section called Nightly picking lists.
These are its rules:
- IronPrint is the only printing library. Its package and namespace are both IronPrint.
- The target framework stays net9.0-windows.
- For the API, check the ironprint skill in .agents/skills/ironprint/.
- The installed IronPrint.xml settles any doubt about a member.
- Orders/ is read-only.
- The printer name comes from appsettings.json and has to appear in Printer.GetPrinterNames.
- The first line of Program.cs installs PrintCapture. It stays first, and Capture/ stays as it is.
- Print and PrintAsync run only from Program.cs, after that line.
- Tests never call them, and code that runs never calls ShowPrintDialog.
- The key lives in IRONPRINT_LICENSE_KEY. No output, log or file ever contains its value.
- A count in a reply has to come from a CSV that the same turn wrote.
- Name that CSV in the reply.
Show me the file once it's written.
IronPrintを追加しライセンスをチェックするにはどうすれば?
Show me the IronPrint PackageReference in PickingBatch.csproj and the version that restore picked.
Then quote each IronSoftware package from the output of dotnet list package --include-transitive.
Don't touch any package reference.
nuget.orgでは、IronPrint 2026.10.1は3つの依存関係、IronSoftware.Common 2026.4.2、IronSoftware.Abstractions 2026.1.2およびIronSoftware.System.Drawing 2026.8.2をリストしています。 私たちの実行では、復元によりIronSoftware.Drawing.Abstractions 2026.1.2も追加されました。 各ビルドはIronPrintのネイティブランタイムファイルを出力フォルダにコピーします。 IronPrintの変更履歴をレビューしてからリリースを固定します。
Printer.GetPrinterNames、Printer.GetPrinterTraysおよび新しいPrintSettingsはすべてキーなしで成功するので、プリンタリストはライセンスについて何も証明しません。 キーなしの印刷呼び出しは、ジョブが作成される前にライセンス例外を投げ、そのメッセージはProduction License Requiredと読みます。 同期PrintはAggregateExceptionで包みますが、PrintAsyncは直接投げます。 IronPrint 2026.10.1の外のコードはライセンス例外型を参照できません。 よってハンドラーがExceptionをキャッチし型名を比較します。
Create Startup.ApplyIronPrintKey and make it the call right after PrintCapture in Program.cs.
It copies IRONPRINT_LICENSE_KEY into License.LicenseKey and reports License.IsLicensed.
Next, show me what IronPrint does with no key.
Run the program twice as child processes with the variable cleared for that child only:
1. A --licence-check run that lists the printers and builds a PrintSettings for PL-1023.
2. A --licence-check --send run that also calls Printer.Print once on Orders/sample/PL-1023.pdf.
Both runs use the printer from appsettings.json.
Log every call in out/licence-check.csv.
Its columns are run, call, result, exception type, inner type and message.
Give up after three repair attempts.
IronPrintはIRONPRINT_LICENSE_KEYを未読のままにするので、プログラムはその値をLicense.LicenseKeyにコピーします。 キーはappsettings.json、Web.configまたはApp.configに入れることもでき、ライセンスキーのページに説明があります。
IronPrintは1つのドキュメントの複数コピーをどのように印刷しますか?
コピーガイドはNumberOfCopiesを1回設定して1つのジョブを送り、ループ内でPrintを呼ぶ代わりに、キャリブレーションプローブは2ページのピッキングリストを3部印刷し、IronPrintはコピー数3のプリントチケットのある2ページの1つのジョブを作成しました。 プリンタドライバーが追加のコピーを作成します。 Microsoft Print to PDFはそのチケットを1つの6ページファイルに変換し、ページ1、2、1、2、1、2として折り畳まれました。
Make a throwaway console project in scratch/copies-probe/ on your own.
Exclude scratch/** from PickingBatch.csproj with a Compile Remove item.
Run it yourself to find what NumberOfCopies holds on a new PrintSettings.
It also tries 0, -1 and 1000 and records what reads back.
Then the explorer agent answers these from IronPrint.xml and the ironprint skill:
- What the XML says happens when a driver can't make several copies.
- What GetPrinterTrays returns for each installed printer.
- Whether PrintSettings.DefaultSettings is static or belongs to an instance.
Nobody sends a job, and Services/ and Program.cs stay as they are.
Write all the answers to out/copies-probe.csv.
Beside each answer, quote IronPrint.xml, the ironprint skill or the probe output.
Where a page and the probe disagree, say so.
NumberOfCopiesはデフォルトで1であり、プロパティは0、-1および1000を受け入れます。 コピーガイドは、0または負の値が単一コピーに戻ると述べています。 キャリブレーションでは、印刷呼び出しが0と-1を拒絶し、そのメッセージはValue must be positiveというArgumentOutOfRangeExceptionであり、ジョブは作成されませんでした。 よってバッチは、設定が構築される前にそれらの注文を拒否します。 XMLの注釈は、いくつかのプラットフォームが値を無視し単一コピーを印刷することを付け加えています。
各ページはジョブのDPIで画像としてプリンタに送られます。 プローブでは150DPIでA4ページが1240 x 1753ピクセルでした。 Grayscaleが設定されているとプリントチケットの出力色はモノChromeでした。
夜間の印刷ジョブのバッチをどのように計画しますか?
Have the worker agent write Services/PickingPrinter.cs.
It applies Orders/README.md to every row of Orders/manifest.csv and follows these rules:
- A --printer option overrides the name in appsettings.json.
- An --inbox option picks the PDF folder. Orders/inbox/ is the default.
- Check the printer name against Printer.GetPrinterNames before reading any order.
- Match the name exactly, case included.
- An unknown name stops the run with a message that lists the installed printers.
- Build a new PrintSettings for each Ready order.
- NumberOfCopies comes from the copies column, and PaperSize from the paper column.
- Every order gets portrait, grayscale and 150 DPI.
- An empty file, or one without a %PDF header, is Unreadable.
Add a --plan mode that sends nothing and writes out/print-plan.csv with these columns:
- order_id and file
- status, always one of the README's four
- NumberOfCopies, PaperSize, PaperOrientation, Dpi and Grayscale as the job would send them
- printer
Add a --send mode that awaits PrintAsync once per Ready order, in manifest order.
It writes out/send-log.csv with order_id, file and NumberOfCopies, and no plan file.
Don't run --send yet.
Run --plan over Orders/inbox/ and report the status counts from print-plan.csv.
IronPrintは印刷呼び出しがそれを読むことのみで破損ファイルを報告します。 空のファイルは難読化された名前空間からの例外タイプでキャリブレーションに失敗し、そのメッセージはIronPDFトラブルシューティングページにリンクし、.pdfというテキストファイルはInvalidDataExceptionで失敗しました。 プラン内のPDFヘッダーのチェックが両方をジョブリストから除外します。
各印刷ジョブが何を持っているか確認するにはどうしますか?
6つのサンプル注文の1つであるPL-1028.pdfは、各SKUにビンと数量を持つ2ページのA4ピッキングリストであり、マニフェストはそれに3部を与えました。
Now run --send with --inbox Orders/sample/.
Orders whose PDF isn't in that folder count as Missing and aren't sent.
PrintCapture writes each job to out/captured/ and adds a row to out/captured/jobs.csv.
Match send-log.csv to jobs.csv in sending order.
Then write out/sample-send.csv with one row per sent order and these columns:
- order_id and the NumberOfCopies it was sent with
- copies, pages, media and color from its jobs.csv row
Tell me whether each order went out as a single job carrying its copy count.
出力
以下のPDFは、IronPrintがテスト実行でPL-1028のために作成したジョブであり、キャプチャされたXPSファイルからページごとに変換されたものです。
IronPrintがジョブを作成したピッキングリストPL-1028、プリンタの代わりにファイルにキャプチャされたもの。 ジョブには150DPIのA4縦ページ2ページがグレースケールで含まれており、プリントチケットは3部を要求します。
プリンタ名が一致しない場合にどうなりますか?
プリンタ名ガイドは、名前はオペレーティングシステムのものと完全に一致する必要があり、大文字小文字も含まれ、ミスマッチは"無音で失敗するかエラーをスローする"ことを述べています。 キャリブレーションジョブは例外を引き起こしませんでした。 存在しないキューWarehouse Laser 01のジョブ、および小文字でadobe pdfのジョブの両方がMicrosoft Print to PDFにルーティングされ、これはテスト機がデフォルトプリンタとして使用しています。
IronPrint sends a job with an unknown printer name to the Windows default printer.
Show me that PickingPrinter refuses before that can happen.
Run --plan two times, passing each of these names with --printer:
1. "Warehouse Laser 01", a queue this machine doesn't have.
2. "adobe pdf", the installed name in the wrong case.
Neither run may change out/print-plan.csv.
Write out/printer-check.csv with the columns run, printer, exit code, message and plan rows written.
Tell me which printers the message listed.
印刷されたシートが誤っているときに診断する方法は?
-iフラグ(--image)はセッションの最初のプロンプトまたはそれを再開するプロンプトに画像を添付し、インタラクティブコンポーザーは貼り付けた画像を受け入れます。
I attached a scan of a picking list with -i.
The packer found it alone, without the copies that should have come with it.
Read the order number from the image.
Look that order up in out/print-plan.csv and Orders/manifest.csv.
Tell me the copy count and paper size that the plan sends.
Also say whether the page in the image fits that paper.
Don't change any code.
不正なバッチ出力を端から端までデバッグする方法は?
Find out why last night's run printed the wrong number of picking lists.
Logs/nightly-2026-10-14/print.log reports these five orders as sent.
Orders/warehouse-complaint.csv lists what the warehouse counted by hand for them.
Have the explorer agent read Jobs/NightlyPrint.cs and that log before you write anything.
Your findings go in out/nightly-diagnosis.md, covering:
- the cause behind each count in the complaint file
- the smallest fix
- a --plan command that proves the fix without sending a job
Don't run or edit any code.
Then tell me what you found.
診断を読んでから編集を許可します。 健全な診断もログが成功として報告する理由を説明します。ログは各呼び出しを記録し、印刷されたシートではありません。
一度限りのコードを再利用可能でテスト済みのコンポーネントに変えるにはどうすればよいですか?
Put the worker agent on a PrintQueueService class, built like this:
- Install Microsoft.Extensions.DependencyInjection and resolve the service from its container.
- Configure it with a PrintOptions record holding printer, DPI, grayscale and plan-only.
- Keep the README rules and the printer check from PickingPrinter.
- PrintQueueService.cs stays under 150 lines, with XML doc comments.
- Nothing calls Jobs/NightlyPrint.cs.
Run it plan-only over Orders/inbox/ into out/final-plan.csv.
Then compare every status and copy count with manifest.csv and list any difference.
リファクターではプリンタチェックを失い、なおかつコンパイル可能です。
Add an xUnit project at tests/PickingBatch.Tests.
Keep it out of the main project's compile items, and put both projects in one solution.
Write tests on the real Orders/ files that check these:
- a 3-copy order gets NumberOfCopies 3 in a single PrintSettings
- a Letter order gets PaperSize.Letter, and an A4 order gets PaperSize.A4
- an order with copies 0 is Rejected and gets no settings
- the empty file and the text file are both Unreadable
- an unknown printer name is refused with a message naming the installed printers
Assert on settings objects and statuses.
Run the tests with dotnet test and a trx logger writing to out/tests/.
Report how many passed and how many failed, reading the trx file.
設定オブジェクトに対するアサーションはスイートがジョブを送信するのを防ぎますが、正確な名前チェックには依然としてインストール済みのプリンタが必要です。
$ironprint Look in the installed IronPrint.xml.
List every Printer member that sends a job or opens a dialog, then tell me:
- Which ones take a byte array instead of a path?
- Which ones show the operating system's print dialog?
- Which ones are asynchronous?
Back each member with one compiling line in a probe project under scratch/.
Build that probe with dotnet build only, and never run it.
It's the one place a ShowPrintDialog call may appear.
Then show me the line in PrintQueueService that stops plan-only mode from sending a job.
これらのプロンプトを別の印刷バッチで再利用する方法は?
新しいファイル名、プリンタ名、コピー規則と共に、同じプロンプトが発送ラベルや請求書を扱います。 IronPrint AIコーディングアシスタントガイドは、すべてのアシスタントが共有するセットアップをカバーしています。
プロンプトが実運用で生成したものは何ですか?
Codexは上記のプロンプトを順に、単一のセッションで受け取りました。 .NET 9プロジェクトには40の注文、それらのピッキングリストおよび各注文の予想ステータスとコピーカウントが含まれたマニフェストがありました。 別々のスクリプトがすべての出力ファイルを再確認しました。
- バッチの前に、マニフェストは35の準備完了の注文、コピーが0の注文2つ、欠落ファイルが1つ、不読ファイルが2つリストされました。
- プランはすべての40注文でマニフェストと一致しました。
- プランのすべての準備完了の注文は、グレースケールの150DPIで縦方向に印刷されたマニフェストコピー数および用紙サイズがありました。
- 6つのサンプル注文を送信すると、それぞれのジョブがキャプチャされました。
- 6つのプリントチケットのコピーカウントは1、2、2、1、3および3であり、マニフェストと等しかったです。
- 6つのジョブは11ページを保持し、コピーカウントで20枚のシートに増えました。
- レター注文は215.9 x 279.4 mmのページとしてキャプチャされ、A4注文は210 x 297 mmのページとしてキャプチャされました。
- キャプチャされた6つのジョブの各ページは、赤い優先バンドは灰色だったため、着色されたピクセルがない150DPI画像でした。
- キーなしではプログラムは4つのプリンタをリストし、設定を構築し、印刷呼び出しはProduction License Requiredで失敗しました。
- どちらの不正なプリンタ名も、行が書き込まれる前にプランを停止し、メッセージは4つのインストール済みプリンタをリストしました。
- スキャンから、Codexは注文PL-1024を特定し、A4からプランで3部を報告しました。
- 夜間診断は、9、4、および18枚のシートをフルコピー数ですでに設定されている印刷呼び出しをコピーごとに1回で追跡しました。
- ゼロコピー注文のシートは、0を1にクランプしたクランプに追跡しました。
- リファクタリングされたPrintQueueServiceは51行であり、そのプランはすべてのステータスとコピー数においてマニフェストと一致しました。
- すべての7つのテストはCodexセッションで合格し、新しいクローンでも再び合格しました。
- Codexはジョブを送るかダイアログを開く8つのプリンタメンバーをリストし、それらのためにプローブを作成しましたが実行しませんでした。
- 一部のステップはページと異なる方法で実行されました。 Quickstartは3回の失敗した試行後にCSVを書かずに停止しました。ライセンスチェック試行の1つはキーが設定されたままで実行し、キャプチャクラスがその印刷呼び出しを傍受しました。 エクスプローラは各プリンタをクエリーせずにXMLからトレイの質問に答えました。 Codexは、プラン専用チェックがProgram.csにあり、PrintQueueServiceにはないと報告しました。
Google Antigravityガイドは、同じ非同期印刷呼び出しを待つASP.NET Coreページを構築します。 Claude Codeガイドでは、各ドキュメントタイプがそれぞれのプリンタに送られ、サブエージェントがプリンタ名チェックをレビューします。 Codexバージョン、モデル、テスト機およびこの実行のタイミングについては、共有されている実行記録を参照してください。
トラブルシューティング
- 複数コピーの印刷方法 コピー数が無視される場合
- プリンタ名の指定方法 ジョブがデフォルトプリンタに行く場合
- Print()メソッドがWPFおよびWinFormsでハングする場合 インターフェースが印刷呼び出し中に応答を停止する場合
- web.configライセンス設定 すべての印刷呼び出しが同じライセンスメッセージで失敗する場合
質問ありますか?
質問がある場合は、support@ironsoftware.com にお問い合わせください。
Curtis Chauは、カールトン大学でコンピュータサイエンスの学士号を取得し、Node.js、TypeScript、JavaScript、およびReactに精通したフロントエンド開発を専門としています。直感的で美しいユーザーインターフェースを作成することに情熱を持ち、Curtisは現代のフレームワークを用いた開発や、構造の良い視覚的に魅力的なマニュアルの作成を楽しんでいます。