IRONSOFTWAREHOME
將 QR 碼蓋印至 PDF
using IronQr;
using IronPdf;
using IronSoftware.Drawing;

// Generate QR code and save as bitmap
AnyBitmap qrBitmap = QrWriter.Write("hello world").Save();

// Load an existing PDF document
PdfDocument pdf = PdfDocument.FromFile("sample.pdf");

// Stamp the QR code onto the first page at position x=505, y=20 (top-right corner)
pdf.DrawBitmap(qrBitmap, PageIndex: 0, X: 505, Y: 20, DesiredWidth: 70, DesiredHeight: 70, PixelFormat: PixelFormat.Format32bppArgb, IgnorePageRotation: false);

// Save the modified PDF
pdf.SaveAs("output.pdf");
Imports IronQr
Imports IronPdf
Imports IronSoftware.Drawing

' Generate QR code and save as bitmap
Dim qrBitmap As AnyBitmap = QrWriter.Write("hello world").Save()

' Load an existing PDF document
Dim pdf As PdfDocument = PdfDocument.FromFile("sample.pdf")

' Stamp the QR code onto the first page at position x=505, y=20 (top-right corner)
pdf.DrawBitmap(qrBitmap, PageIndex:=0, X:=505, Y:=20, DesiredWidth:=70, DesiredHeight:=70, PixelFormat:=PixelFormat.Format32bppArgb, IgnorePageRotation:=False)

' Save the modified PDF
pdf.SaveAs("output.pdf")
NuGet Download
PM > Install-Package IronQR
將 QR 碼蓋印至 PDF

將 QR 碼蓋印至 PDF

直接將QR碼蓋印在現有的PDF頁面上,嵌入可掃描的資訊而不需重新結構化文件。 IronQR通過三個步驟處理此問題:用DrawBitmap,以精準控制蓋印的尺寸。

將QR碼蓋印到PDF的三步指南

  • AnyBitmap qrBitmap = QrWriter.Write("hello world").Save();
  • PdfDocument pdf = PdfDocument.FromFile("sample.pdf");
  • pdf.DrawBitmap(qrBitmap, pageIndex: 0, x: 505, y: 20, desiredWidth: 70, desiredHeight: 70, pixelFormat: PixelFormat.Format32bppArgb, ignorePageRotation: false);

程式碼說明

AnyBitmap返回。 位圖被傳遞給載入的DrawBitmap。 y值從左上角以PDF點為單位(A4頁面為595 × 842點),而height精確設置蓋印尺寸——此處70 × 70點將一個緊湊的QR碼放在右上角。 調用pdf.SaveAs()來寫入結果。

常見用例包括在發票上嵌入付款連結,為法律文件新增驗證碼,以及在活動票證上放置追蹤ID。 為平衡尺寸和資料,配置一個不同錯誤更正級別的QrWriter.Write。

探索如何使用IronQR將QR碼蓋印到PDF頁面上。

準備好開始了嗎?

Nuget Downloads 76,271版本:2026.10剛剛發布

Key in blue circle

立即免費取得 30 天試用金鑰。

Your trial license will be sent to your email address

無任何限制。100% 解鎖。無需信用卡。

bullet_checked無需信用卡或建立帳號無任何限制。100% 解鎖。無需信用卡。
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronQR
預約您的免費現場演示
Booking Badge

受到全球數百萬工程師的信賴

Iron Software的客戶標誌
獲取您的無義務諮詢
您的詳細資訊將始終保密。
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
受到全球數百萬工程師的信賴
立即獲取您的30天試用金鑰。
無需信用卡或帳戶建立
C#的NuGet PDF程式庫
使用NuGet安裝

版本: 2026.10

PM > Install-Package IronQR
nuget.org/packages/IronQR/
  1. 在Solution Explorer中,右鍵點擊引用,管理NuGet包
  2. 選擇瀏覽並搜尋'IronQR'
  3. 選擇包並安裝
C# PDF DLL
下載DLL

版本: 2026.10

  1. 下載並解壓IronQR到您的Solution目錄中的如~/Libs等位置
  2. 在Visual Studio Solution Explorer,右鍵點擊引用。選擇瀏覽,選擇'IronQR.dll'

從$999起的授權