• 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. }
  • 相关阅读:
    计算机毕设(附源码)JAVA-SSM蓟县农家乐网站
    Nginx源码分析
    C#将一个文件复制到成千上百个文件夹中
    Python数据分析与机器学习29-支持向量机(SVM)
    初识C++ (一)
    vue私有过滤器和全局过滤器
    常用设计模式-详解
    AI:86-基于深度学习的街景图像地理位置识别
    vue3.2-setup语法糖、组合式API、状态库Pinia归纳总结
    异步FIFO实验小结
  • 原文地址:https://blog.csdn.net/john_dwh/article/details/128005611