如何使用IronPDF在C#中合併兩個PDF字節陣列
在.NET應用中將JPG轉換為PDF是開發人員在企業文件管理系統或合規驅動工作流程中常見的需求。 構建文件存檔工具、照片儲存庫或自動化報告系統為受監管行業經常引入這種需求。 免費的JPG到PDF線上服務存在可進行快速轉換——您可以上傳圖像並立即下載轉換後的PDF。 但對於具有審核追蹤需求的嚴肅企業自動化,這些基於瀏覽器的解決方案缺乏程式化控制、安全性以及軟體工程師需要的合規保證。
IronPDF提供一個強大的JPG到PDF轉換器,只需幾行C#程式碼即可將圖像文件轉換為專業的PDF文件,並附帶數位簽名功能和加密選項。 不像那些可能將上傳文件暴露於資料風險的線上工具,IronPDF完全在您的應用基礎設施中運行——安全、自托管的解決方案將敏感資料安全地保存在您自己的Azure或本地伺服器上。
// Convert JPG to PDF in one line!
IronPdf.ImageToPdfConverter.ImageToPdf("photo.jpg").SaveAs("output.pdf");
// Convert JPG to PDF in one line!
IronPdf.ImageToPdfConverter.ImageToPdf("photo.jpg").SaveAs("output.pdf");
' Convert JPG to PDF in one line!
IronPdf.ImageToPdfConverter.ImageToPdf("photo.jpg").SaveAs("output.pdf")
如何在C#中將JPG文件轉換為PDF文件?
使用IronPDF的ImageToPdfConverter類調用一個方法即可將單個JPG文件轉換為PDF文件。 這個圖像到PDF轉換器會自動處理整個轉換過程,保持圖像質量,同時生成符合PDF/A合規標準的正確格式的PDF文件以供長期存檔。
using IronPdf;
// Convert a single JPG image to PDF
PdfDocument pdf = ImageToPdfConverter.ImageToPdf("inputImage.jpg");
// Add metadata for compliance tracking
pdf.MetaData.Author = "Enterprise System";
pdf.MetaData.CreationDate = DateTime.Now;
pdf.MetaData.Keywords = "JPG-Conversion,Compliance-Ready";
// Apply security settings for sensitive documents
pdf.SecuritySettings.AllowUserPrinting = true;
pdf.SecuritySettings.AllowUserEditing = false;
pdf.SecuritySettings.AllowUserCopyPasteContent = false;
// Save the converted PDF to disk
pdf.SaveAs("output.pdf");
using IronPdf;
// Convert a single JPG image to PDF
PdfDocument pdf = ImageToPdfConverter.ImageToPdf("inputImage.jpg");
// Add metadata for compliance tracking
pdf.MetaData.Author = "Enterprise System";
pdf.MetaData.CreationDate = DateTime.Now;
pdf.MetaData.Keywords = "JPG-Conversion,Compliance-Ready";
// Apply security settings for sensitive documents
pdf.SecuritySettings.AllowUserPrinting = true;
pdf.SecuritySettings.AllowUserEditing = false;
pdf.SecuritySettings.AllowUserCopyPasteContent = false;
// Save the converted PDF to disk
pdf.SaveAs("output.pdf");
Imports IronPdf
' Convert a single JPG image to PDF
Dim pdf As PdfDocument = ImageToPdfConverter.ImageToPdf("inputImage.jpg")
' Add metadata for compliance tracking
pdf.MetaData.Author = "Enterprise System"
pdf.MetaData.CreationDate = DateTime.Now
pdf.MetaData.Keywords = "JPG-Conversion,Compliance-Ready"
' Apply security settings for sensitive documents
pdf.SecuritySettings.AllowUserPrinting = True
pdf.SecuritySettings.AllowUserEditing = False
pdf.SecuritySettings.AllowUserCopyPasteContent = False
' Save the converted PDF to disk
pdf.SaveAs("output.pdf")
轉換器與您現有的日誌基礎設施整合,啟用詳細的審核追踪以進行合規報告。 對於需要高可用性的企業部署,考慮實施異步轉換模式以有效處理並發請求。
轉換後的PDF輸出看起來是什麼樣的?

ImageToPdf方法接受您的JPG或JPEG圖像的文件路徑並返回支持高級操作功能的PdfDocument物件。 這個PDF轉換器支持儲存在磁碟、網路位置或Azure Blob Storage的圖像,以適應雲原生架構。 生成的PDF文件保持原有的解析度和色彩保真度,確保照片、掃描文件和合規檔如預期中顯示。
IronPDF的轉換器支持Windows、Mac和Linux操作系統,包括在Docker和AWS Lambda中的容器化部署,因此無需額外的軟體依賴即可在任何企業環境中部署您的圖像到PDF解決方案。
如何將多個JPG圖像轉換成一個PDF文件?
將多個JPG文件合併到一個PDF檔是建立合併報告、存檔掃描批次文件或組裝多頁合規包的關鍵。 JPG到PDF轉換器接受一個文件路徑陣列,將所有圖像合併為一個PDF,每個圖像位於自己的頁面上,同時保持正確的頁碼編號。
using IronPdf;
// Define multiple JPG images to convert
string[] jpgImages = { "page1.jpg", "page2.jpeg", "page3.jpg" };
// Validate all files exist before processing
foreach (var imagePath in jpgImages)
{
if (!File.Exists(imagePath))
{
throw new FileNotFoundException($"Required image not found: {imagePath}");
}
}
// Convert all images into a single PDF document
PdfDocument pdf = ImageToPdfConverter.ImageToPdf(jpgImages);
// Add headers for document identification
pdf.AddHtmlHeaders(new HtmlHeaderFooter()
{
HtmlFragment = "<div style='text-align:center'>Confidential - {date}</div>",
Height = 25
});
// Apply compression for optimal file size
pdf.CompressImages(70);
// Save the combined PDF
pdf.SaveAs("combined-document.pdf");
using IronPdf;
// Define multiple JPG images to convert
string[] jpgImages = { "page1.jpg", "page2.jpeg", "page3.jpg" };
// Validate all files exist before processing
foreach (var imagePath in jpgImages)
{
if (!File.Exists(imagePath))
{
throw new FileNotFoundException($"Required image not found: {imagePath}");
}
}
// Convert all images into a single PDF document
PdfDocument pdf = ImageToPdfConverter.ImageToPdf(jpgImages);
// Add headers for document identification
pdf.AddHtmlHeaders(new HtmlHeaderFooter()
{
HtmlFragment = "<div style='text-align:center'>Confidential - {date}</div>",
Height = 25
});
// Apply compression for optimal file size
pdf.CompressImages(70);
// Save the combined PDF
pdf.SaveAs("combined-document.pdf");
Imports IronPdf
' Define multiple JPG images to convert
Dim jpgImages As String() = {"page1.jpg", "page2.jpeg", "page3.jpg"}
' Validate all files exist before processing
For Each imagePath In jpgImages
If Not File.Exists(imagePath) Then
Throw New FileNotFoundException($"Required image not found: {imagePath}")
End If
Next
' Convert all images into a single PDF document
Dim pdf As PdfDocument = ImageToPdfConverter.ImageToPdf(jpgImages)
' Add headers for document identification
pdf.AddHtmlHeaders(New HtmlHeaderFooter() With {
.HtmlFragment = "<div style='text-align:center'>Confidential - {date}</div>",
.Height = 25
})
' Apply compression for optimal file size
pdf.CompressImages(70)
' Save the combined PDF
pdf.SaveAs("combined-document.pdf")
這種方法使您能夠按照所需順序轉換多個JPG圖像——只需相應地安排您的陣列中的文件路徑。 即使是大量JPG圖片,PDF轉換器也能高效運行,在現代硬體上處理數百張圖像僅需幾秒鐘。
對於企業場景,如發票處理、醫療記錄數位化或法律文件存檔,您可以在目錄中枚舉圖像文件並直接傳遞給轉換器。 這支持自動化工作流程,無需手動干預即可將JPG轉換為PDF,支持符合HIPAA的工作流程,並具有適當的安全控制如加密和權限限制。
JPG到PDF轉換器支持哪些圖像格式?
IronPDF的圖像到PDF工具支持多種圖像格式,超過JPG和JPEG,為多樣的企業需求提供靈活性。 您可以使用相同的簡單API轉換PNG、BMP、GIF和TIFF文件,確保您的應用能夠處理業務過程所需的各種圖像格式。
下表總結了支持的圖像格式及其典型用例:
| 格式 | 擴展名(s) | 典型用例 | 說明 |
|---|---|---|---|
| JPEG | .jpg, .jpeg | 照片,掃描文件 | 有損壓縮;適合拍攝照片 |
| PNG | .png | 截圖,具有透明度的圖形 | 無損;保留透明背景 |
| TIFF | .tif, .tiff | 醫學成像,檔案掃描 | 支持多頁TIFF文件 |
| BMP | .bmp | 傳統掃描系統 | 未壓縮;文件尺寸大 |
| GIF | .gif | 簡單圖形,圖標 | 有限色彩調色板(256色) |
using IronPdf;
// Convert any supported image format using the same API
string imagePath = "document.tiff";
PdfDocument pdf = ImageToPdfConverter.ImageToPdf(imagePath);
// Apply enterprise metadata standards
pdf.MetaData.Producer = "Enterprise Document System v2.0";
pdf.SaveAs("output.pdf");
using IronPdf;
// Convert any supported image format using the same API
string imagePath = "document.tiff";
PdfDocument pdf = ImageToPdfConverter.ImageToPdf(imagePath);
// Apply enterprise metadata standards
pdf.MetaData.Producer = "Enterprise Document System v2.0";
pdf.SaveAs("output.pdf");
Imports IronPdf
' Convert any supported image format using the same API
Dim imagePath As String = "document.tiff"
Dim pdf As PdfDocument = ImageToPdfConverter.ImageToPdf(imagePath)
' Apply enterprise metadata standards
pdf.MetaData.Producer = "Enterprise Document System v2.0"
pdf.SaveAs("output.pdf")
PNG到PDF轉換質量如何比較?

轉換器自動檢測圖像格式並應用適當的處理,保持對醫學成像或者設計文件至關重要的色彩準確性。 無論是來自移動裝置的壓縮JPEG照片,帶透明度的高保真PNG圖形,還是從掃描系統獲得的傳統BMP文件,PDF轉換都能產生一致的高質量結果。
這同樣的轉換器架構還可以處理DOCX文件和其他文件型別,使IronPDF成為您整個企業內容管理堆中的萬用文件處理解決方案。
如何在轉換後的PDF中保留圖像質量?
在PDF轉換過程中保持圖像質量對於專業文件至關重要,尤其是在像醫療成像或工程圖那樣具有嚴格的視覺保真度要求的行業中。 IronPDF預設保持JPG圖像的原始解析度,確保在轉換過程中不會發生降級。 您還可以應用無損壓縮選項來管理文件大小而不犧牲視覺保真度。
using IronPdf;
// Convert image maintaining original quality
PdfDocument pdf = ImageToPdfConverter.ImageToPdf("high-res-scan.jpg");
// Apply linearization for fast web viewing (archival quality)
pdf.SaveAsLinearized("output-linearized.pdf");
// Alternatively, apply controlled compression when file size matters
pdf.CompressImages(90); // 90 = near-lossless
pdf.SaveAs("output-compressed.pdf");
using IronPdf;
// Convert image maintaining original quality
PdfDocument pdf = ImageToPdfConverter.ImageToPdf("high-res-scan.jpg");
// Apply linearization for fast web viewing (archival quality)
pdf.SaveAsLinearized("output-linearized.pdf");
// Alternatively, apply controlled compression when file size matters
pdf.CompressImages(90); // 90 = near-lossless
pdf.SaveAs("output-compressed.pdf");
Imports IronPdf
' Convert image maintaining original quality
Dim pdf As PdfDocument = ImageToPdfConverter.ImageToPdf("high-res-scan.jpg")
' Apply linearization for fast web viewing (archival quality)
pdf.SaveAsLinearized("output-linearized.pdf")
' Alternatively, apply controlled compression when file size matters
pdf.CompressImages(90) ' 90 = near-lossless
pdf.SaveAs("output-compressed.pdf")
對於需要在文件大小和圖像質量之間達成平衡以優化雲儲存的場景,IronPDF提供細緻的壓縮控制,讓您在控制質量權衡時減少轉換後PDF的大小。 您還可以在來源圖像的掃描過程中因方向不正確而需要旋轉PDF頁面。
PDF轉換器支持高解析度照片和掃描文件,而不會像免費服務替代品那樣施加任意限制,這些替代品可能會壓縮或在輸出中新增水印。 這確保數位簽章文件保持其法律效力,存檔記錄得以在法庭上被接受。 關於JPEG壓縮和圖像質量權衡的背景資訊,請參閱
如何自定義頁面尺寸和方向?
控制輸出PDF格式為不同企業用例提供靈活性,從標準信筒大小的報告到自定義表單。 IronPDF允許您在從圖像建立新PDF文件時指定頁面尺寸和方向,支持標準紙張尺寸和自定義尺寸。
using IronPdf;
// Create renderer with custom page settings
ChromePdfRenderer renderer = new ChromePdfRenderer();
// Configure for standard business documents
renderer.RenderingOptions.PaperSize = IronPdf.Rendering.PdfPaperSize.A4;
renderer.RenderingOptions.PaperOrientation = IronPdf.Rendering.PdfPaperOrientation.Portrait;
renderer.RenderingOptions.MarginTop = 25;
renderer.RenderingOptions.MarginBottom = 25;
renderer.RenderingOptions.MarginLeft = 20;
renderer.RenderingOptions.MarginRight = 20;
// Apply a corporate logo header
renderer.RenderingOptions.HtmlHeader = new HtmlHeaderFooter()
{
HtmlFragment = "<img src='corporate-logo.png' style='height:30px'/>",
Height = 40
};
// Wrap the image in HTML to control layout precisely
string imageHtml = @"
<html>
<body style='margin:0'>
<img src='wide-photo.jpg' style='width:100%; max-width:100%'/>
</body>
</html>";
PdfDocument pdf = renderer.RenderHtmlAsPdf(imageHtml);
// Add page numbers for multi-page documents
pdf.AddTextFooters("{page} of {total-pages}", IronPdf.Font.FontFamily.Arial, 10);
pdf.SaveAs("formatted-document.pdf");
using IronPdf;
// Create renderer with custom page settings
ChromePdfRenderer renderer = new ChromePdfRenderer();
// Configure for standard business documents
renderer.RenderingOptions.PaperSize = IronPdf.Rendering.PdfPaperSize.A4;
renderer.RenderingOptions.PaperOrientation = IronPdf.Rendering.PdfPaperOrientation.Portrait;
renderer.RenderingOptions.MarginTop = 25;
renderer.RenderingOptions.MarginBottom = 25;
renderer.RenderingOptions.MarginLeft = 20;
renderer.RenderingOptions.MarginRight = 20;
// Apply a corporate logo header
renderer.RenderingOptions.HtmlHeader = new HtmlHeaderFooter()
{
HtmlFragment = "<img src='corporate-logo.png' style='height:30px'/>",
Height = 40
};
// Wrap the image in HTML to control layout precisely
string imageHtml = @"
<html>
<body style='margin:0'>
<img src='wide-photo.jpg' style='width:100%; max-width:100%'/>
</body>
</html>";
PdfDocument pdf = renderer.RenderHtmlAsPdf(imageHtml);
// Add page numbers for multi-page documents
pdf.AddTextFooters("{page} of {total-pages}", IronPdf.Font.FontFamily.Arial, 10);
pdf.SaveAs("formatted-document.pdf");
Imports IronPdf
' Create renderer with custom page settings
Dim renderer As New ChromePdfRenderer()
' Configure for standard business documents
renderer.RenderingOptions.PaperSize = IronPdf.Rendering.PdfPaperSize.A4
renderer.RenderingOptions.PaperOrientation = IronPdf.Rendering.PdfPaperOrientation.Portrait
renderer.RenderingOptions.MarginTop = 25
renderer.RenderingOptions.MarginBottom = 25
renderer.RenderingOptions.MarginLeft = 20
renderer.RenderingOptions.MarginRight = 20
' Apply a corporate logo header
renderer.RenderingOptions.HtmlHeader = New HtmlHeaderFooter() With {
.HtmlFragment = "<img src='corporate-logo.png' style='height:30px'/>",
.Height = 40
}
' Wrap the image in HTML to control layout precisely
Dim imageHtml As String = "
<html>
<body style='margin:0'>
<img src='wide-photo.jpg' style='width:100%; max-width:100%'/>
</body>
</html>"
Dim pdf As PdfDocument = renderer.RenderHtmlAsPdf(imageHtml)
' Add page numbers for multi-page documents
pdf.AddTextFooters("{page} of {total-pages}", IronPdf.Font.FontFamily.Arial, 10)
pdf.SaveAs("formatted-document.pdf")
PDF輸出有什麼自定義選項?

這種技術將圖像嵌入HTML中,讓您能夠精確控制JPG圖像在PDF頁面上的顯示,同時保持CSS樣式的一致性。 您可以設置邊距,應用縮放,新增水印,並在單個PDF文件中精確定位圖像,支持合規文件的複雜佈局要求。
對於包括視窗控制和JavaScript渲染延遲的高級渲染自定義,請探索IronPDF的渲染選項文件。
如何在轉換的PDF中新增頁眉、頁腳和水印?
使用IronPDF在轉換后的PDF中新增頁眉、頁腳和水印非常簡單。 這些元素對於合規工作流程、品牌一致性和企業系統中的文件識別是必需的。 頁眉和頁腳可以包含動態內容,如當前日期、頁碼和自定義HTML。 水印——包括文字和圖像水印——可以使用自定義水印API蓋印到每個頁面上。
using IronPdf;
// Convert JPG to PDF
PdfDocument pdf = ImageToPdfConverter.ImageToPdf("invoice-scan.jpg");
// Add a text watermark for draft documents
pdf.ApplyWatermark("<h1 style='color:red;opacity:0.3'>DRAFT</h1>", rotation: 45, opacity: 80);
// Add a footer with the page number and date
pdf.AddHtmlFooters(new HtmlHeaderFooter()
{
HtmlFragment = "<div style='text-align:right;font-size:10px'>Page {page} of {total-pages} -- {date}</div>",
Height = 20
});
pdf.SaveAs("watermarked-invoice.pdf");
using IronPdf;
// Convert JPG to PDF
PdfDocument pdf = ImageToPdfConverter.ImageToPdf("invoice-scan.jpg");
// Add a text watermark for draft documents
pdf.ApplyWatermark("<h1 style='color:red;opacity:0.3'>DRAFT</h1>", rotation: 45, opacity: 80);
// Add a footer with the page number and date
pdf.AddHtmlFooters(new HtmlHeaderFooter()
{
HtmlFragment = "<div style='text-align:right;font-size:10px'>Page {page} of {total-pages} -- {date}</div>",
Height = 20
});
pdf.SaveAs("watermarked-invoice.pdf");
Imports IronPdf
' Convert JPG to PDF
Dim pdf As PdfDocument = ImageToPdfConverter.ImageToPdf("invoice-scan.jpg")
' Add a text watermark for draft documents
pdf.ApplyWatermark("<h1 style='color:red;opacity:0.3'>DRAFT</h1>", rotation:=45, opacity:=80)
' Add a footer with the page number and date
pdf.AddHtmlFooters(New HtmlHeaderFooter() With {
.HtmlFragment = "<div style='text-align:right;font-size:10px'>Page {page} of {total-pages} -- {date}</div>",
.Height = 20
})
pdf.SaveAs("watermarked-invoice.pdf")
該模式對於受監管行業特別有用,其中每份分發的檔必須攜帶分類標記或草案指示,直到最終批准。 結合數位簽名,水印提供了完整的審核追縱系統的持有鏈記錄。
如何在JPG轉換後保護PDF文件?
對於包含敏感圖像的文件,安全性是不可妥協的——醫學掃描、財務記錄和法律展品都需要存取控制。 在將JPG圖像轉換為PDF後,IronPDF允許您在同一工作流程中應用密碼保護和權限限制。
using IronPdf;
// Convert the image
PdfDocument pdf = ImageToPdfConverter.ImageToPdf("medical-scan.jpg");
// Set an owner password (admin) and a user password (read-only access)
pdf.SecuritySettings.OwnerPassword = "admin-secret";
pdf.SecuritySettings.UserPassword = "readonly-access";
// Restrict editing and copying, but allow printing
pdf.SecuritySettings.AllowUserPrinting = true;
pdf.SecuritySettings.AllowUserEditing = false;
pdf.SecuritySettings.AllowUserCopyPasteContent = false;
pdf.SecuritySettings.AllowUserAnnotations = false;
// Encrypt with AES-256
pdf.SecuritySettings.EncryptionLevel = PdfEncryptionLevel.AES_256;
pdf.SaveAs("secured-medical-scan.pdf");
using IronPdf;
// Convert the image
PdfDocument pdf = ImageToPdfConverter.ImageToPdf("medical-scan.jpg");
// Set an owner password (admin) and a user password (read-only access)
pdf.SecuritySettings.OwnerPassword = "admin-secret";
pdf.SecuritySettings.UserPassword = "readonly-access";
// Restrict editing and copying, but allow printing
pdf.SecuritySettings.AllowUserPrinting = true;
pdf.SecuritySettings.AllowUserEditing = false;
pdf.SecuritySettings.AllowUserCopyPasteContent = false;
pdf.SecuritySettings.AllowUserAnnotations = false;
// Encrypt with AES-256
pdf.SecuritySettings.EncryptionLevel = PdfEncryptionLevel.AES_256;
pdf.SaveAs("secured-medical-scan.pdf");
Imports IronPdf
' Convert the image
Dim pdf As PdfDocument = ImageToPdfConverter.ImageToPdf("medical-scan.jpg")
' Set an owner password (admin) and a user password (read-only access)
pdf.SecuritySettings.OwnerPassword = "admin-secret"
pdf.SecuritySettings.UserPassword = "readonly-access"
' Restrict editing and copying, but allow printing
pdf.SecuritySettings.AllowUserPrinting = True
pdf.SecuritySettings.AllowUserEditing = False
pdf.SecuritySettings.AllowUserCopyPasteContent = False
pdf.SecuritySettings.AllowUserAnnotations = False
' Encrypt with AES-256
pdf.SecuritySettings.EncryptionLevel = PdfEncryptionLevel.AES_256
pdf.SaveAs("secured-medical-scan.pdf")
對於針對PDF/A-3的長期存檔部署,IronPDF可以在一次運行中轉換並驗證ISO 19005標準。 這對於醫療和法律垂直行業尤為重要,這些行業的文件保留政策要求存檔安全格式。
IronPDF支持Windows、Mac和Linux部署,具有相同的安全API介面,因此安全策略在不同環境之間是可移植的。 在IronPDF Linux指南中了解有關平台特定設置的更多資訊。
下一步如何?
IronPDF將JPG到PDF .NET開發從多步任務轉變為具有企業級安全性和合規功能的可靠單一方法操作。 該庫以一致的高質量結果處理單個圖像、多個JPG文件和一系列圖像格式——而不依賴會妥協資料主權的外部在線服務。
與PDF轉換器拖放網站不同,IronPDF為自動化文件工作流程、大批量處理和企業整合提供程式化控制,擁有完整的API文件。 轉換器在保持質量和審核追踪的同時高效處理圖像,使其適用於從醫療文件管理到金融合規系統的應用。
關鍵的企業優勢包括:
- 現場部署以實現完整的資料控制
- 支持PDF/A存檔和PDF/UA可存取性
- 細緻的安全設置和AES-256加密
- 跨平台支持:Windows、macOS、Linux、Docker和AWS
- 支持多種圖像格式:JPG、PNG、TIFF、BMP和GIF
開始您的免費試用以體驗IronPDF如何簡化您.NET專案中的圖像到PDF轉換,並具有企業級安全性,或探索完整的許可選項以進行生產部署。
常見問題
如何在C#中將單個JPG文件轉換為PDF?
從IronPDF調用ImageToPdfConverter.ImageToPdf("photo.jpg")。這將返回一個PdfDocument物件,您可以用.SaveAs("output.pdf")保存。基本轉換不需要額外的配置。
IronPDF能否將多個JPG影像合併為一個PDF文件?
是的。將文件路徑的字串陣列傳遞給ImageToPdfConverter.ImageToPdf(new string[] { "page1.jpg", "page2.jpg" })。每個影像在合併的PDF中變成一個單獨的頁面,按照提供的順序排列。
IronPDF的轉換器支持什麼影像格式?
IronPDF支持JPEG、PNG、TIFF(包括多頁)、BMP和GIF文件,通過相同的ImageToPdfConverter API來處理。該程式庫會自動檢測格式。
如何在將JPG轉換為PDF時保留影像品質?
IronPDF預設會保留原始解析度。對於歸檔輸出,使用pdf.SaveAsLinearized()。要控制文件大小,使用pdf.CompressImages(quality),其中quality值在1到100之間。
如何自訂輸出PDF的頁面尺寸?
使用ChromePdfRenderer配合RenderingOptions.PaperSize和RenderingOptions.PaperOrientation設置任意標準或自訂頁面尺寸。將影像包裹在HTML字串中並使用RenderHtmlAsPdf()渲染以獲得完整的佈局控制。
如何為從JPG轉換的PDF新增浮水印?
轉換之後,調用pdf.ApplyWatermark(htmlFragment, rotation, opacity)在每頁新增文字或影像浮水印。HTML浮水印支持自訂字體、顏色和不透明度。
如何在從JPG轉換後密碼保護PDF?
設置pdf.SecuritySettings.OwnerPassword和pdf.SecuritySettings.UserPassword,然後配置AllowUserPrinting、AllowUserEditing和AllowUserCopyPasteContent。將pdf.SecuritySettings.EncryptionLevel設為PdfEncryptionLevel.AES_256以獲得最強加密。
IronPDF是否支持轉換影像的PDF/A歸檔格式?
是的。IronPDF可以將影像轉換為符合PDF/A的文件,滿足ISO 19005要求,這些要求在醫療、法律及政府文件保留政策中使用。
IronPDF在哪些平臺上運行以進行JPG到PDF轉換?
IronPDF支持Windows、macOS和Linux,包括Docker容器和AWS Lambda。相同的API表面在所有平台上均可運行,無需額外的依賴。
為什麼使用IronPDF而不是線上JPG到PDF轉換器?
線上轉換器需要將文件上傳到第三方伺服器,這會帶來資料暴露風險並限制自動化。IronPDF完全在您的應用中運行,讓您擁有程式化的控制、安全政策、審計跟蹤,且不依賴外部服務。

