• Pdfium.Net SDK 9.71.39 NEW-Pdfium.Net SDK


    Pdfium.Net SDK 9.71.39
    The C# PDF Library
    Create PDFs from scratch, or from a bunch of scanned images
    Edit, merge, split and manipulate PDFs, extract text and images
    Embed standalone Winforms or WPF PDF Viewer
    Supports: .Net 2.0+, .Net 6, Standard, Core, Mono, Azure
    And it also works on Windows XP and Mac OS
    Download Pdfium.Net SDK Install with NuGet
    Advanced PDF Library for total control over your PDF creation workflow
    Pdfium.Net SDK is the leading .Net library for generating, manipulating and viewing files in the portable document format. We are offering a high level c# / VB.Net API for dynamic pdf creation on a WEB server or any other server system, and to implement «Save as PDF» feature in existing desktop or WEB applications.

    How to Create a PDF Dynamically With C#

    1. /// <summary>
    2. /// Create PDF Document on The Fly in C# using Pdfium.Net SDK Library
    3. /// </summary>
    4. public void CreatePdf()
    5. {
    6. // The PDF coordinate system origin is at the bottom left corner of the page.
    7. // The X-axis is pointing to the right. The Y-axis is pointing in upward direction.
    8. // The sizes and coordinates in this method are given in the inches.
    9. // Step 1: Initialize PDF library and create empty document
    10. // Return value: PdfDocument main class
    11. PdfCommon.Initialize();
    12. var doc = PdfDocument.CreateNew(); // Create a PDF document
    13. // Step 2: Add new page
    14. // Arguments: page width: 8.27", page height: 11.69", Unit of measure: inches
    15. // The PDF unit of measure is point. There are 72 points in one inch.
    16. var page = doc.Pages.InsertPageAt(doc.Pages.Count, 8.27f * 72, 11.69f * 72);
    17. // Step 3: Add graphics and text contents to the page
    18. // Insert image from file using standart System.Drawing.Bitmap class
    19. using (PdfBitmap logo = PdfBitmap.FromFile(@"e:\63\logo_square.png"))
    20. {
    21. PdfImageObject imageObject = PdfImageObject.Create(doc, logo, 0, 0);
    22. //image resolution is 300 DPI and location is 1.69 x 10.0 inches.
    23. imageObject.Matrix = new FS_MATRIX(logo.Width * 72 / 300, 0, 0, logo.Height * 72 / 300, 1.69 * 72, 10.0 * 72);
    24. page.PageObjects.Add(imageObject);
    25. }
    26. // Create fonts used for text objects
    27. PdfFont calibryBold = PdfFont.CreateFont(doc, "CalibriBold");
    28. // Insert text objects at 7.69"; 11.02" and font size is 25
    29. PdfTextObject textObject = PdfTextObject.Create("Sample text", 1.69f * 72, 11.02f * 72, calibryBold, 25);
    30. textObject.FillColor = FS_COLOR.Black;
    31. page.PageObjects.Add(textObject);
    32. // Step 5: Generate page content and save pdf file
    33. // argument: PDF file name
    34. page.GenerateContent();
    35. doc.Save(@"e:\63\sample_document.pdf", SaveFlags.NoIncremental);
    36. }
  • 相关阅读:
    CLR的GC工作模式介绍(Workstation和Server)
    互联网行业,常见含金量高的证书,看看你有几个?
    Python 简单并发的代码记录
    java Web的基本介绍
    高性能Spark_transformation性能
    谷粒商城P85发布商品时规格参数不显示问题
    Linux查看文件大小的几种方法
    MR混合现实情景实训教学系统在商务外语课堂的应用
    概率dp专题
    【力扣 - 和为K的子数组】
  • 原文地址:https://blog.csdn.net/john_dwh/article/details/128005611