IRONSOFTWAREHOME
PDF工具

IronPDF vs XFINIUM.PDF:.NET HTML 到 PDF 程式庫比較

Curtis Chau
Curtis Chau
Updated: 2026年6月20日

Your Company Name

123 Business St

City, State 12345

contact@company.com


Bill To:

Client Company

456 Client Ave

City, State 67890

Description Quantity Price Total
Web Development Services 40 $150.00 $6,000.00
UI/UX Design 20 $125.00 $2,500.00
Subtotal: $8,500.00
Tax (10%): $850.00
Total Due: $9,350.00
Payment is due within 30 days. Thank you for your business!
"; var invoicePdf = renderer.RenderHtmlAsPdf(bootstrapInvoice); invoicePdf.SaveAs("bootstrap-invoice.pdf"); ``` **輸出:**專業會議的時間表,包含Bootstrap的卡片網格、flexbox對齊、徽章元件及響應式佈局——所有這些均準確渲染在PDF中。 ### XFINIUM.PDF:有限的HTML和框架支援 XFINIUM.PDF專注於PDF生成和操作,而不是HTML到PDF的轉換。 該程式庫在對Bootstrap和現代CSS框架的支援方面存在重大限制: - **無原生HTML渲染:**XFINIUM.PDF不含內建的HTML到PDF轉換引擎 - **僅支援基本HTML:**限制於簡單的HTML結構且不含高階CSS - **無Bootstrap支援:**現代的Bootstrap框架(4及5)及其flexbox和CSS Grid無法被支援 - **需要工坊:**開發者必須使用低階PDF API手動重建佈局 - **需要外部工具:**可能需要整合第三方HTML渲染引擎 **開發影響:**使用Bootstrap或現代CSS框架的應用無法直接使用XFINIUM.PDF將其UI轉換為PDF。 開發者必須: 1. 使用XFINIUM.PDF的低階繪圖API重建佈局(開發時間很多) 2. 整合外部HTML渲染工具(增加複雜性和依賴性) 3. 與網頁UI平行維護單獨的PDF佈局程式碼(維護開銷) 需HTML到PDF轉換的專案並使用現代框架,XFINIUM.PDF的限制需額外的開發工作。 對於需完整Bootstrap及現代CSS框架支援的專案,請參閱Bootstrap & Flexbox CSS指南。 ## 定價和授權選項是什麼? ### XFINIUM.PDF定價與授權 每個套件都有兩個版本:Generator版適用於PDF生產/編輯,Viewer版包含所有Generator功能,以及PDF渲染和檢視。 - 每位開發者需要授權。 - 免版稅分發到無限的桌面/伺服器。 - 協助訂購包括一年更新支持。 定價範圍從每年$290.00到$872.00不等。 ### IronPDF定價和授權 IronPDF在開發環境中免費,可隨時用於商業用途。選擇包括單專案授權、單一開發者、代理商、多國組織及SaaS/OEM再發行。 所有授權都包含30天退款保證、一年支援/升級、開發/預演/生產有效性及永久授權(一次性購買)。 Lite包起價為`$liteLicense`,沒有反復費用。 ## 我應選擇哪個PDF程式庫? IronPDF程式庫簡化了不含專有API的PDF建立功能。"HTML到PDF"可以將HTML、JS、CSS、JPG、PNG、GIF和SVG等開放標準文档轉化為像素級完美的PDF。 它基於現有的開發者技能。 您可以下載文件、發送電子郵件或保存至雲端,用於建立發票、報價單、報告、合同及其他文件。 它適配於ASP.NET、ASP.NET Core、web forms、MVC、.NET Framework及.NET Core Web APIs。 XFINIUM.PDF為初學者及高階PDF開發者提供功能。 無論您是需要建立報告、填寫PDF表單、構建資料集、刪除資訊或將PDF轉換為多頁TIFF,它都提供必要的工具。 它基本的物件模型遵循PDF規範。 程式碼可以在所有平台上編譯而無需修改。 XFINIUM.PDF授權的起價為$290(Generator版)和$387(Viewer版)。 IronPDF起價為`$liteLicense`。 IronPDF提供單使用者和多使用者的授權,而XFINIUM.PDF要求每位開發者都有授權。 IronPDF的專業版授權(`$liteLicense`)支持不限使用者數。 IronPDF所需的PDF操作程式碼行數比XFINIUM.PDF少,從而降低了程式設計師的工作負擔。 Iron Software提供完整的套件,只需兩下點擊即可安裝。 花上兩個程式庫的價格,您現在可以獲得所有五個程式庫,持續支援。 [[i:(XFINIUM.PDF是一個屬於其各自擁有者的註冊商標。 本網站與XFINIUM.PDF無關,未經XFINIUM.PDF的授權或贊助。 所有產品名稱、標誌和品牌均為其各自所有者的財產。 比較僅供參考,反映撰寫時公開可用的資訊。)]] " data-astro-cid-7mqrzwov>
Copy for LLMs
Copy page as Markdown for LLMs

  • Open in ChatGPT
    Ask ChatGPT about this page
  • Open in Gemini
    Ask Gemini about this page
  • Open in Grok
    Ask Grok about this page
  • Open in Perplexity
    Ask Perplexity about this page
  • IronPDF在支援完整CSS和JavaScript的HTML到PDF轉換中表現出色,使用Chromium引擎。相比之下,XFINIUM.PDF專注於低層次的PDF操作,不含原生的HTML渲染能力,使IronPDF成為.NET應用程式中現代網頁PDF生成更合適的選擇。

    現代科技為開發者提供更聰明的解決方案,自動化促進了軟體開發過程。 處理C# PDF檔案長期以來都是開發者的一個挑戰。 當建立PDF檔案內容時,必須考慮多個因素,當將不同格式轉換為PDF時更是如此。 這些挑戰現在通過設計用於協助閱讀、寫入、建立和轉換PDF的程式庫得到解決。

    本文比較了兩個流行的適用於.NET.NET Core開發者的PDF程式庫:

    IronPDF和XFINIUM.PDF都提供用於建立操作列印PDF的方法,適用於.NET和.NET Core。 您可以通過查看以下對兩個程式庫的比較及其各自的PDF轉換和操作功能來做出明智的決定。

    首先,我們來探討這兩個程式庫提供了什麼功能,然後進行比較。

    XFINIUM.PDF程式庫的功能是什麼?

    XFINIUM.PDF程式庫是一個跨平台的PDF開發工具,適合初學者和高階PDF開發者。 它允許您建立報告填寫PDF表單,構建PDF檔案集,從PDF報告中刪除敏感資料,或將PDF報告轉換為多頁TIFF圖像

    XFINIUM.PDF有兩個版本:Generator版本包括PDF製作和編輯,Viewer版本增添了PDF渲染PDF查看

    XFINIUM.PDF完全用C#編寫,是完全受控程式碼。 它以每位開發者為單位授權,可免版稅分發,允許您以無需額外成本分發您的程式。

    Generator版和Viewer版的區別是什麼?

    Generator版是Viewer版的子集。 它提供建立和編輯PDF的功能,而Viewer版則增加了PDF渲染能力。 Viewer版可以將PDF頁面轉換為RAW、BMP、GIF、JPG、PNG和TIFF圖像

    XFINIUM.PDF規格

    主要功能包括:

    安全性

    數位簽名

    條碼

    欲了解更高階的條碼功能,可參閱IronBarcode文件,該文件提供完整的條碼生成和閱讀功能。

    內容提取

    低層次COS API

    PDF渲染(僅限Viewer版)

    IronPDF的主要功能是什麼?

    IronPDF .NET PDF程式庫簡化了C#程式設計師的PDF開發。 使用此工具,您可以輕鬆構建.NET的核心PDF程式庫。

    IronPDF使用.NET Chromium引擎將HTML頁面轉換為PDF文件。 使用HTML到PDF,您不需要使用複雜的API來定位或設計PDF。 支援標準的網頁文件,包括HTML、ASPX、JS、CSS和圖像

    您可以使用HTML5、CSS、JavaScript和圖像來開發.NET PDF程式庫。 可以用頁首和頁尾編輯、蓋章和改進PDF。 該程式庫有效掌控了PDF文字的閱讀圖形提取

    免費下載IronPDF,立即在您的.NET專案中開始使用它。

    IronPDF C#程式庫的亮點功能

    主要功能包括:

    生成PDF(HTML到PDF)

    編輯現有的PDF文件

    操作PDF文件

    轉換多種文件格式

    列印和儲存

    IronPDF支援所有主要的操作系統和架構:

    我該如何安裝IronPDF C#程式庫?

    您可以通過四種方式下載和安裝IronPDF:

    1. 使用Visual Studio
    2. 開發者命令提示符
    3. 直接下載NuGet包
    4. 下載IronPDF .DLL程式庫

    使用Visual Studio

    Visual Studio提供NuGet包管理器來在您的項目中安裝包。 通過項目選單或在解決方案總管中右擊您的項目來存取它。

    Visual Studio Project menu showing various options including 'Manage NuGet Packages' highlighted for package management.

    圖1。在Visual Studio中使用項目選單存取NuGet包管理器

    Visual Studio Solution Explorer context menu showing the Manage NuGet Packages option highlighted in yellow

    圖2。在Visual Studio中使用上下文選單存取NuGet包管理器

    選擇後,瀏覽IronPDF包並安裝它。

    Visual Studio interface showing NuGet Package Manager with IronPDF library search results and installation options

    圖3。使用Visual Studio中的NuGET包管理器安裝IronPDF程式庫

    使用開發者命令提示符

    透過開發者命令提示符安裝IronPDF NuGet包

    直接下載NuGet包

    直接從NuGet下載並安裝IronPDF:

    下載程式庫安裝IronPDF

    IronPDF下載中直接下載IronPDF .DLL文件。

    IronPDF website homepage showing the C# PDF Library with download options for DLL and NuGet installation

    圖4。從IronPDF網站下載IronPDF Library DLL

    在您的項目中引用此程式庫:

    IronPDF現在已準備好使用。 接下來讓我們安裝XFINIUM.PDF。

    如何安裝XFINIUM.PDF?

    在.NET Core中,安裝Xfinium PDF作為cake插件或工具:

    # Install Xfinium.Pdf.NetCore as a Cake Addin
    #addin nuget:?package=Xfinium.Pdf.NetCore&version=10.2.0
    SHELL
    # Install Xfinium.Pdf.NetCore as a Cake Tool
    #tool nuget:?package=Xfinium.Pdf.NetCore&version=10.2.0
    SHELL

    現在讓我們比較IronPDF和XFINIUM.PDF。

    如何在.NET Core中建立簡單的PDF文件?

    軟體開發者必須知道如何使用C#動態建立PDF文件。 您可能需要PDF建立來生成使用者輸入的報告,將使用者文字保存為PDF,提取HTML資訊並轉換為PDF,以及更多。

    兩個程式庫都可以將HTML網頁轉換為PDF。 讓我們檢查每個程式庫的方法。

    使用IronPDF

    IronPDF提供多種方法來建立PDF文件。

    現有URL轉為PDF

    IronPDF使HTML轉為PDF文件從現有URL的過程變得簡單。 JavaScript圖像、表單和CSS都獲得了完整支援。

    該實現自動處理URL渲染:

    // Create an instance of the ChromePdfRenderer
    IronPdf.ChromePdfRenderer Renderer = new IronPdf.ChromePdfRenderer();
    
    // Configure rendering options for better performance
    Renderer.RenderingOptions.WaitFor.RenderDelay = 500; // Wait for JavaScript to load
    Renderer.RenderingOptions.CssMediaType = IronPdf.Rendering.PdfCssMediaType.Print;
    
    // Render a URL to PDF
    using var Pdf = Renderer.RenderUrlAsPdf("___PROTECTED_URL_134___");
    
    // Save the PDF with metadata
    Pdf.MetaData.Author = "IronPDF";
    Pdf.MetaData.Title = "Website to PDF Conversion";
    Pdf.SaveAs("url.pdf");

    HTML輸入字串轉為PDF

    考慮以下從HTML字串渲染PDF頁面的程式碼範例。 您可以僅使用HTML,也可以將其與CSS、圖像和JavaScript結合使用:

    // Create an instance of the ChromePdfRenderer
    var Renderer = new IronPdf.ChromePdfRenderer();
    
    // Configure rendering options
    Renderer.RenderingOptions.MarginTop = 50; // millimeters
    Renderer.RenderingOptions.MarginBottom = 50;
    Renderer.RenderingOptions.CssMediaType = IronPdf.Rendering.PdfCssMediaType.Print;
    
    // Render a simple HTML string to PDF
    using var PDF = Renderer.RenderHtmlAsPdf("<h1>Html with CSS and Images</h1>");
    
    // Add document properties
    PDF.MetaData.Author = "Development Team";
    PDF.MetaData.Keywords = "HTML, PDF, C#";
    PDF.MetaData.ModifiedDate = DateTime.Now;
    
    // Save the PDF
    PDF.SaveAs("pixel-perfect.pdf");
    
    // Load external HTML assets: images, CSS, and javascript
    // An optional BasePath 'C:\site\assets\' is set as the file location to load assets from 
    using var AdvancedPDF = Renderer.RenderHtmlAsPdf("<img src='icons/iron.png'>", @"C:\site\assets\");
    
    // Apply security settings
    AdvancedPDF.Password = "pass123";
    AdvancedPDF.SecuritySettings.AllowUserPrinting = IronPdf.Security.PdfPrintSecurity.FullPrintRights;
    
    // Save the advanced PDF with external assets
    AdvancedPDF.SaveAs("html-with-assets.pdf");

    有關高階的HTML到PDF轉換技術,請參閱HTML到PDF教學

    使用XFINIUM.PDF

    使用XFINIUM.PDF建立空白PDF文件需要三行:建立文件、建立頁面和保存:

    // Create a new PDF document
    PdfFixedDocument document = new PdfFixedDocument();
    
    // Add a page to the document
    PdfPage page = document.Pages.Add();
    
    // Save the document as a PDF file
    document.Save("empty.pdf");

    新增文字內容需要額外三行:建立字體、建立顏色的畫筆和繪製文字:

    // Create a new PDF document
    PdfFixedDocument document = new PdfFixedDocument();
    PdfPage page = document.Pages.Add();
    
    // Create a standard font with Helvetica face and 24 point size
    PdfStandardFont helvetica = new PdfStandardFont(PdfStandardFontFace.Helvetica, 24);
    
    // Create a solid RGB red brush.
    PdfBrush brush = new PdfBrush(PdfRgbColor.Red);
    
    // Draw the text on the page.
    page.Graphics.DrawString("Hello World", helvetica, brush, 100, 100);
    
    // Save the document as a PDF file
    document.Save("helloworld.pdf");

    該物件模型非常接近PDF標準。 這種方法可為構建流程文件等複雜抽象提供明確的好處。## 如何建立可填寫的PDF文件

    使用XFINIUM.PDF

    XFINIUM.PDF允許您建立新的PDF表單填寫現有的PDF表單

    每個PDF表單字段型別都有相應的類別:

    建立表單字段時,指定字段名稱和頁面位置。 在建立字段物件後,將其加入頁面並設置其屬性:

    // Create a text box field named "firstname"
    PdfTextBoxField firstNameTextBox = new PdfTextBoxField("firstname");
    
    // Add the field to a PDF page
    pdfpage.Fields.Add(firstNameTextBox);
    
    // Set the position of the field on the PDF page
    firstNameTextBox.Widgets[0].VisualRectangle = new PdfVisualRectangle(150, 45, 200, 20);

    為了填寫現有的PDF表單,將其裝入PdfFixedDocument物件中。 文件的字段集合自動填充。 您可以通過索引或名稱找到字段,並通過設置值屬性來填寫它們:

    // Load an existing PDF document with forms
    PdfFixedDocument document = new PdfFixedDocument("form.pdf");
    
    // Fill form fields with values
    (document.Form.Fields["firstname"] as PdfTextBoxField).Text = "John";
    (document.Form.Fields["lastname"] as PdfTextBoxField).Value = "Doe";
    (document.Form.Fields["sex"].Widgets[0] as PdfRadioButtonWidget).Checked = true;
    (document.Form.Fields["firstcar"] as PdfComboBoxField).SelectedIndex = 0;
    (document.Form.Fields["secondcar"] as PdfListBoxField).SelectedIndex = 1;
    (document.Form.Fields["agree"] as PdfCheckBoxField).Checked = true;
    
    // Save the filled form as a new PDF file
    document.Save("form_filled.pdf");

    使用IronPDF

    以下是如何使用IronPDF建立可填寫的PDFs的方法:

    // PM> Install-Package IronPdf
    using IronPdf;
    using IronPdf.Rendering;
    
    // Step 1. Creating a PDF with editable forms from HTML using form and input tags
    var FormHtml = @"
    <html>
        <head>
            <style>
                body { font-family: Arial, sans-serif; margin: 40px; }
                h2 { color: #333; }
                form { background: #f4f4f4; padding: 20px; border-radius: 8px; }
                input[type='text'] { 
                    width: 100%; 
                    padding: 8px; 
                    margin: 10px 0;
                    border: 1px solid #ddd;
                    border-radius: 4px;
                }
                input[type='checkbox'] { margin-right: 10px; }
                select { width: 100%; padding: 8px; margin: 10px 0; }
            </style>
        </head>
        <body>
            <h2>Editable PDF Form</h2>
            <form>
              First name:<br> <input type='text' name='firstname' value=''> <br>
              Last name:<br> <input type='text' name='lastname' value=''>
              <br><br>
              Email:<br> <input type='text' name='email' value=''>
              <br><br>
              Subscribe to newsletter: <input type='checkbox' name='newsletter' value='yes'>
              <br><br>
              Country: 
              <select name='country'>
                  <option value='usa'>United States</option>
                  <option value='uk'>United Kingdom</option>
                  <option value='canada'>Canada</option>
              </select>
            </form>
        </body>
    </html>";
    
    // Create a PDF renderer with form creation enabled
    IronPdf.ChromePdfRenderer Renderer = new IronPdf.ChromePdfRenderer();
    Renderer.RenderingOptions.CreatePdfFormsFromHtml = true;
    Renderer.RenderingOptions.CssMediaType = PdfCssMediaType.Print;
    Renderer.RenderingOptions.MarginTop = 20;
    Renderer.RenderingOptions.MarginBottom = 20;
    
    // Render the HTML as a PDF and save it
    var pdfDocument = Renderer.RenderHtmlAsPdf(FormHtml);
    pdfDocument.SaveAs("BasicForm.pdf");
    
    // Step 2. Reading and Writing PDF form values.
    var FormDocument = PdfDocument.FromFile("BasicForm.pdf");
    
    // Get form field collection
    var form = FormDocument.Form;
    
    // Set and Read the value of the "firstname" field
    var FirstNameField = form.FindFormField("firstname");
    FirstNameField.Value = "Minnie";
    Console.WriteLine("FirstNameField value: {0}", FirstNameField.Value);
    
    // Set and Read the value of the "lastname" field
    var LastNameField = form.FindFormField("lastname");
    LastNameField.Value = "Mouse";
    Console.WriteLine("LastNameField value: {0}", LastNameField.Value);
    
    // Set email field
    var EmailField = form.FindFormField("email");
    EmailField.Value = "minnie.mouse@example.com";
    
    // Set checkbox
    var NewsletterField = form.FindFormField("newsletter");
    NewsletterField.Value = "yes";
    
    // Set dropdown selection
    var CountryField = form.FindFormField("country");
    CountryField.Value = "usa";
    
    // Save the form with filled values
    FormDocument.SaveAs("FilledForm.pdf");
    
    // Step 3. Flattening the form (making it non-editable)
    FormDocument.Form.Flatten();
    FormDocument.SaveAs("FlattenedForm.pdf");

    首先建立一個帶有HTML格式標籤的表單。 程式庫在保存為PDF時處理了復雜性。 讀取和寫入表單值是通過FindFormField函式完成的。 您的應用程式可以立即使用該功能以程式方式填寫表單。

    要了解有關進階表單處理的更多資訊,包括數位簽名,請參閱Create PDF Forms教學

    如何數位簽署PDF文件

    遠端工作需要有效的文件處理。 填寫和簽署表單、傳送文件和處理文件是日常的業務活動。 簽署PDF文件、檔案集和表單可替代紙質文件。 數位簽名使公司能夠在線簽署協議並分享PDF表單。

    使用XFINIUM.PDF

    簽名字段在PDF文件中應用數位簽名(PdfSignatureField類別)。 儘管簽名字段顯示在一頁上,但數位簽名可簽署整個文件。

    簽名過程使用PdfDigitalSignature物件來設定簽名屬性。 根據PDF文件的二進制佈局,於保存文件時形成簽名。

    所有XFINIUM簽名均建基於PdfDigitalSignature

    使用IronPDF

    開發者經常詢問如何使用IronPDF和C#程式地為PDF新增簽名。 這可能意味著:

    第一種方法涉及在現有PDF頁面上蓋印簽名PNG。 對於簽名或公司印章使用:

    // Open an existing PDF document or create a new one
    var Pdf = PdfDocument.FromFile(@"C:\Path\To\ASPX to PDF.pdf");
    
    // Define an HTML stamp with a signature image
    var SignatureStamp = new HtmlStamp()
    {
        Html = "<img src='signature.png' />",
        Width = 150,
        Height = 50,
        Bottom = 300,
        Left = 85,
        ZIndex = HtmlStamp.StampLayer.OnTopOfExistingPDFContent
    };
    
    // Advanced stamp with styling
    var StyledSignatureStamp = new HtmlStamp()
    {
        Html = @"<div style='border: 2px solid #000; padding: 10px; background: rgba(255,255,255,0.9);'>
                    <img src='signature.png' style='width: 120px;' />
                    <p style='margin: 5px 0 0 0; font-size: 10px;'>Digitally Signed</p>
                    <p style='margin: 0; font-size: 8px;'>{date}</p>
                 </div>",
        Width = 150,
        Height = 100,
        Bottom = 50,
        Right = 50,
        ZIndex = HtmlStamp.StampLayer.OnTopOfExistingPDFContent
    };
    
    // Stamp the signature on the first page of the PDF
    Pdf.StampHTML(SignatureStamp, 1);
    
    // Or apply to all pages
    Pdf.StampHTML(StyledSignatureStamp);
    
    // Save the stamped PDF
    Pdf.SaveAs(@"C:\Path\To\Stamped_PDF.pdf");

    利用一行程式碼使用.pfx和.p12 X509Certificate2數位證書密碼簽名PDF

    // 123456 below represents the signature password
    new IronPdf.PdfSignature("CertificateFile.p12", "123456").SignPdfFile("ASPX to PDF.pdf");
    
    // Or with more control
    var signature = new IronPdf.PdfSignature("CertificateFile.p12", "123456")
    {
        SigningContact = "john@example.com",
        SigningLocation = "New York, USA",
        SigningReason = "Contract Agreement"
    };
    
    // Load the PDF
    var pdf = PdfDocument.FromFile("contract.pdf");
    
    // Sign and save
    pdf.SignPdfWithDigitalSignature(signature);
    pdf.SaveAs("signed-contract.pdf");

    此進階範例結合了.pfx / .p12 X509Certificate2數位ID簽名與手寫簽名:

    // Create a digital signature using a certificate file
    var Signature = new IronPdf.PdfSignature("Iron.pfx", "123456");
    
    // Render a PDF document to be signed
    var Renderer = new ChromePdfRenderer();
    Renderer.RenderingOptions.MarginBottom = 0;
    Renderer.RenderingOptions.MarginTop = 0;
    Renderer.RenderingOptions.EnableJavaScript = true;
    Renderer.RenderingOptions.CssMediaType = IronPdf.Rendering.PdfCssMediaType.Print;
    
    // Create PDF with security features
    string html = @"<h1>Contract Agreement</h1>
                    <p>This document is digitally signed and encrypted.</p>
                    <p>Agreement Date: " + DateTime.Now.ToString("yyyy-MM-dd") + @"</p>";
    
    PdfDocument doc = Renderer.RenderHtmlAsPdf(html);
    
    // Configure optional signing options and a handwritten signature graphic
    Signature.SigningContact = "support@ironsoftware.com";
    Signature.SigningLocation = "Chicago, USA";
    Signature.SigningReason = "To show how to sign a PDF";
    
    // Load a handwritten signature image
    Signature.LoadSignatureImageFromFile("handwriting.png");
    
    // Advanced security: Set permissions
    doc.SecuritySettings.AllowUserPrinting = IronPdf.Security.PdfPrintSecurity.NoPrint;
    doc.SecuritySettings.AllowUserEdits = IronPdf.Security.PdfEditSecurity.NoEdit;
    doc.SecuritySettings.AllowUserCopyPasteContent = false;
    
    // Sign the PDF document with the digital signature
    doc.SignPdfWithDigitalSignature(Signature);
    
    // Add password protection
    doc.Password = "userpassword";
    doc.OwnerPassword = "ownerpassword";
    
    // Save the signed PDF document
    doc.SaveAs("Signed_ASPX_to_PDF.pdf");

    要了解完整的安全實施,請探索IronsecureDoc文件中用於高階文件保護的功能。## 各程式庫如何處理現代CSS框架和Bootstrap?

    現代網頁應用程式經常依賴CSS框架,如Bootstrap,用於快速的UI開發和響應式設計。 PDF生成工具必須完全保留這些框架佈局,以確保專業文件的質量。

    IronPDF:完整的Bootstrap框架支持

    IronPDF的Chromium渲染引擎完全支援現代CSS框架:

    現實世界的驗證:Bootstrap首頁及模板可以準確地轉換,達成與瀏覽器一致的效果。

    程式碼範例:帶有Bootstrap卡片的事件時間表

    using IronPdf;
    
    var renderer = new ChromePdfRenderer();
    
    // Configure rendering for optimal Bootstrap output
    renderer.RenderingOptions.CssMediaType = IronPdf.Rendering.PdfCssMediaType.Print;
    renderer.RenderingOptions.EnableJavaScript = true;
    renderer.RenderingOptions.RenderDelay = 500; // Allow JS to fully load
    renderer.RenderingOptions.ViewPortWidth = 1280; // Desktop viewport
    renderer.RenderingOptions.MarginTop = 10;
    renderer.RenderingOptions.MarginBottom = 10;
    renderer.RenderingOptions.MarginLeft = 10;
    renderer.RenderingOptions.MarginRight = 10;
    
    string bootstrapSchedule = @"
    <!DOCTYPE html>
    <html>
    <head>
        <link href='___PROTECTED_URL_135___ rel='stylesheet'>
        <style>
            @media print {
                .pagebreak { page-break-after: always; }
            }
        </style>
    </head>
    <body>
        <div class='container my-5'>
            <h1 class='text-center mb-5'>Tech Conference 2025 - Schedule</h1>
    
            <div class='row g-4'>
                <div class='col-md-6'>
                    <div class='card border-primary'>
                        <div class='card-header bg-primary text-white d-flex justify-content-between align-items-center'>
                            <h5 class='mb-0'>Keynote Session</h5>
                            <span class='badge bg-light text-primary'>9:00 AM</span>
                        </div>
                        <div class='card-body'>
                            <h6 class='card-subtitle mb-2 text-muted'>Main Auditorium</h6>
                            <p class='card-text'><strong>The Future of AI in Software Development</strong></p>
                            <p class='card-text'>Join us for an exploration of how artificial intelligence is transforming the software development environment.</p>
                            <div class='d-flex align-items-center'>
                                <img src='___PROTECTED_URL_136___ class='rounded-circle me-2' alt='Speaker'>
                                <div>
                                    <div class='fw-bold'>Dr. Sarah Chen</div>
                                    <small class='text-muted'>AI Research Lead</small>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
    
                <div class='col-md-6'>
                    <div class='card border-success'>
                        <div class='card-header bg-success text-white d-flex justify-content-between align-items-center'>
                            <h5 class='mb-0'>Workshop</h5>
                            <span class='badge bg-light text-success'>10:30 AM</span>
                        </div>
                        <div class='card-body'>
                            <h6 class='card-subtitle mb-2 text-muted'>Workshop Room A</h6>
                            <p class='card-text'><strong>Hands-On: Cloud-Native Architecture</strong></p>
                            <p class='card-text'>Learn practical techniques for building flexible, cloud-native applications with modern frameworks.</p>
                            <div class='d-flex align-items-center'>
                                <img src='___PROTECTED_URL_137___ class='rounded-circle me-2' alt='Speaker'>
                                <div>
                                    <div class='fw-bold'>Michael Rodriguez</div>
                                    <small class='text-muted'>Cloud Architect</small>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
    
                <div class='col-md-6'>
                    <div class='card border-warning'>
                        <div class='card-header bg-warning text-dark d-flex justify-content-between align-items-center'>
                            <h5 class='mb-0'>Panel Discussion</h5>
                            <span class='badge bg-dark'>2:00 PM</span>
                        </div>
                        <div class='card-body'>
                            <h6 class='card-subtitle mb-2 text-muted'>Main Auditorium</h6>
                            <p class='card-text'><strong>Security in Modern Web Applications</strong></p>
                            <p class='card-text'>Industry experts discuss current security challenges and best practices for protecting user data.</p>
                            <small class='text-muted'>Featuring 4 industry experts</small>
                        </div>
                    </div>
                </div>
    
                <div class='col-md-6'>
                    <div class='card border-info'>
                        <div class='card-header bg-info text-white d-flex justify-content-between align-items-center'>
                            <h5 class='mb-0'>Technical Talk</h5>
                            <span class='badge bg-light text-info'>3:30 PM</span>
                        </div>
                        <div class='card-body'>
                            <h6 class='card-subtitle mb-2 text-muted'>Room B</h6>
                            <p class='card-text'><strong>Performance Optimization Strategies</strong></p>
                            <p class='card-text'>Deep dive into advanced techniques for improve application performance and reducing latency.</p>
                            <div class='d-flex align-items-center'>
                                <img src='___PROTECTED_URL_138___ class='rounded-circle me-2' alt='Speaker'>
                                <div>
                                    <div class='fw-bold'>Alex Kim</div>
                                    <small class='text-muted'>Performance Engineer</small>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            
            <div class='pagebreak'></div>
            
            <h2 class='mt-5'>Additional Sessions</h2>
            <div class='table-responsive'>
                <table class='table table-striped'>
                    <thead>
                        <tr>
                            <th>Time</th>
                            <th>Session</th>
                            <th>Speaker</th>
                            <th>Location</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td>11:45 AM</td>
                            <td>Lightning Talks</td>
                            <td>Various</td>
                            <td>Room C</td>
                        </tr>
                        <tr>
                            <td>1:00 PM</td>
                            <td>Networking Lunch</td>
                            <td>-</td>
                            <td>Cafeteria</td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </body>
    </html>";
    
    // Generate the PDF
    var pdf = renderer.RenderHtmlAsPdf(bootstrapSchedule);
    
    // Add metadata
    pdf.MetaData.Author = "Tech Conference Team";
    pdf.MetaData.Title = "Conference Schedule 2025";
    pdf.MetaData.Subject = "Event Schedule";
    
    // Save the PDF
    pdf.SaveAs("conference-schedule.pdf");
    
    // Example: Generate responsive invoice with Bootstrap
    string bootstrapInvoice = @"
    <!DOCTYPE html>
    <html>
    <head>
        <link href='___PROTECTED_URL_139___ rel='stylesheet'>
        <link href='___PROTECTED_URL_140___ rel='stylesheet'>
    </head>
    <body>
        <div class='container mt-5'>
            <div class='row'>
                <div class='col-12'>
                    <div class='card'>
                        <div class='card-body'>
                            <div class='row mb-4'>
                                <div class='col-sm-6'>
                                    <h2 class='text-primary'><i class='fas fa-file-invoice'></i> INVOICE</h2>
                                    <p class='mb-1'><strong>Invoice #:</strong> INV-2025-001</p>
                                    <p class='mb-1'><strong>Date:</strong> " + DateTime.Now.ToString("MMMM dd, yyyy") + @"</p>
                                </div>
                                <div class='col-sm-6 text-sm-end'>
                                    <h4>Your Company Name</h4>
                                    <p class='mb-1'>123 Business St</p>
                                    <p class='mb-1'>City, State 12345</p>
                                    <p>contact@company.com</p>
                                </div>
                            </div>
                            
                            <hr>
                            
                            <div class='row mb-4'>
                                <div class='col-sm-6'>
                                    <h5>Bill To:</h5>
                                    <p class='mb-1'><strong>Client Company</strong></p>
                                    <p class='mb-1'>456 Client Ave</p>
                                    <p>City, State 67890</p>
                                </div>
                            </div>
                            
                            <div class='table-responsive'>
                                <table class='table table-bordered'>
                                    <thead class='table-primary'>
                                        <tr>
                                            <th>Description</th>
                                            <th class='text-center'>Quantity</th>
                                            <th class='text-end'>Price</th>
                                            <th class='text-end'>Total</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr>
                                            <td>Web Development Services</td>
                                            <td class='text-center'>40</td>
                                            <td class='text-end'>$150.00</td>
                                            <td class='text-end'>$6,000.00</td>
                                        </tr>
                                        <tr>
                                            <td>UI/UX Design</td>
                                            <td class='text-center'>20</td>
                                            <td class='text-end'>$125.00</td>
                                            <td class='text-end'>$2,500.00</td>
                                        </tr>
                                    </tbody>
                                    <tfoot>
                                        <tr>
                                            <td colspan='3' class='text-end'><strong>Subtotal:</strong></td>
                                            <td class='text-end'><strong>$8,500.00</strong></td>
                                        </tr>
                                        <tr>
                                            <td colspan='3' class='text-end'>Tax (10%):</td>
                                            <td class='text-end'>$850.00</td>
                                        </tr>
                                        <tr class='table-primary'>
                                            <td colspan='3' class='text-end'><strong>Total Due:</strong></td>
                                            <td class='text-end'><strong>$9,350.00</strong></td>
                                        </tr>
                                    </tfoot>
                                </table>
                            </div>
                            
                            <div class='alert alert-info mt-4'>
                                <i class='fas fa-info-circle'></i> Payment is due within 30 days. Thank you for your business!
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </body>
    </html>";
    
    var invoicePdf = renderer.RenderHtmlAsPdf(bootstrapInvoice);
    invoicePdf.SaveAs("bootstrap-invoice.pdf");

    **輸出:**專業會議的時間表,包含Bootstrap的卡片網格、flexbox對齊、徽章元件及響應式佈局——所有這些均準確渲染在PDF中。

    XFINIUM.PDF:有限的HTML和框架支援

    XFINIUM.PDF專注於PDF生成和操作,而不是HTML到PDF的轉換。 該程式庫在對Bootstrap和現代CSS框架的支援方面存在重大限制:

    **開發影響:**使用Bootstrap或現代CSS框架的應用無法直接使用XFINIUM.PDF將其UI轉換為PDF。 開發者必須:

    1. 使用XFINIUM.PDF的低階繪圖API重建佈局(開發時間很多)
    2. 整合外部HTML渲染工具(增加複雜性和依賴性)
    3. 與網頁UI平行維護單獨的PDF佈局程式碼(維護開銷)

    需HTML到PDF轉換的專案並使用現代框架,XFINIUM.PDF的限制需額外的開發工作。

    對於需完整Bootstrap及現代CSS框架支援的專案,請參閱Bootstrap & Flexbox CSS指南。

    定價和授權選項是什麼?

    XFINIUM.PDF定價與授權

    每個套件都有兩個版本:Generator版適用於PDF生產/編輯,Viewer版包含所有Generator功能,以及PDF渲染和檢視。

    定價範圍從每年$290.00到$872.00不等。

    IronPDF定價和授權

    IronPDF在開發環境中免費,可隨時用於商業用途。選擇包括單專案授權、單一開發者、代理商、多國組織及SaaS/OEM再發行。 所有授權都包含30天退款保證、一年支援/升級、開發/預演/生產有效性及永久授權(一次性購買)。 Lite包起價為$999,沒有反復費用。

    我應選擇哪個PDF程式庫?

    IronPDF程式庫簡化了不含專有API的PDF建立功能。"HTML到PDF"可以將HTML、JS、CSS、JPG、PNG、GIF和SVG等開放標準文档轉化為像素級完美的PDF。 它基於現有的開發者技能。 您可以下載文件、發送電子郵件或保存至雲端,用於建立發票、報價單、報告、合同及其他文件。 它適配於ASP.NET、ASP.NET Core、web forms、MVC、.NET Framework及.NET Core Web APIs。

    XFINIUM.PDF為初學者及高階PDF開發者提供功能。 無論您是需要建立報告、填寫PDF表單、構建資料集、刪除資訊或將PDF轉換為多頁TIFF,它都提供必要的工具。 它基本的物件模型遵循PDF規範。 程式碼可以在所有平台上編譯而無需修改。

    XFINIUM.PDF授權的起價為$290(Generator版)和$387(Viewer版)。 IronPDF起價為$999。 IronPDF提供單使用者和多使用者的授權,而XFINIUM.PDF要求每位開發者都有授權。 IronPDF的專業版授權($999)支持不限使用者數。

    IronPDF所需的PDF操作程式碼行數比XFINIUM.PDF少,從而降低了程式設計師的工作負擔。

    Iron Software提供完整的套件,只需兩下點擊即可安裝。 花上兩個程式庫的價格,您現在可以獲得所有五個程式庫,持續支援。

    請注意: XFINIUM.PDF是一個屬於其各自擁有者的註冊商標。 本網站與XFINIUM.PDF無關,未經XFINIUM.PDF的授權或贊助。 所有產品名稱、標誌和品牌均為其各自所有者的財產。 比較僅供參考,反映撰寫時公開可用的資訊。
    Curtis Chau
    技術作家

    Curtis Chau擁有Carleton大學的電腦科學學士學位,專精於前端開發,擁有Node.js、TypeScript、JavaScript和React的專業知識。Curtis熱衷於建立直觀且美觀的使用者介面,喜愛使用現代框架並建立結構良好、視覺吸引力的手冊。

    ...
    閱讀更多

    相關文章

    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 IronPDF
    預訂您的免費現場演示
    Booking Badge

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

    Iron Software的客戶標誌
    獲取您的無義務諮詢
    填寫以下表格或電子郵件sales@ironsoftware.com
    您的詳細資訊將始終保密
    受到全球數百萬工程師的信任
    Iron Software的客戶標誌
    立即獲取您的30天試用金鑰
    無需信用卡或帳戶建立