Aspose.PDF.Drawing
24.12.0
dotnet add package Aspose.PDF.Drawing --version 24.12.0
NuGet\Install-Package Aspose.PDF.Drawing -Version 24.12.0
<PackageReference Include="Aspose.PDF.Drawing" Version="24.12.0" />
paket add Aspose.PDF.Drawing --version 24.12.0
#r "nuget: Aspose.PDF.Drawing, 24.12.0"
// Install Aspose.PDF.Drawing as a Cake Addin #addin nuget:?package=Aspose.PDF.Drawing&version=24.12.0 // Install Aspose.PDF.Drawing as a Cake Tool #tool nuget:?package=Aspose.PDF.Drawing&version=24.12.0
.NET API to Process & Manipulate PDF Files
Aspose.PDF for .NET (Drawing), i.e.,
Aspose.PDF.Drawing
is a component which is exactly the same as Aspose.PDF for .NET (Aspose.PDF) except it provides a newAspose.Drawing
graphic backend instead ofSystem.Drawing
.
Aspose.PDF for .NET is a comprehensive library empowering developers to seamlessly integrate robust PDF manipulation capabilities into their .NET applications. From basic operations like adding images and annotations to advanced features like form creation, PDF conversion, and security implementation, Aspose.PDF streamlines PDF workflows across various platforms, including Windows, macOS, Linux, and even web environments like ASP.NET. With support for a wide array of file formats and compatibility across major .NET frameworks, Aspose.PDF is the go-to solution for .NET developers seeking to elevate their PDF handling capabilities without relying on external software.
Basic Operations
Add Images to PDF
Insert images into existing PDF documents, supporting formats like JPEG, PNG, and GIF to enhance visual content.
Add Annotations
Place interactive annotations such as comments, highlights, and text notes for better document collaboration and user interaction.
Text and Image Stamps
Embed custom text or image stamps like watermarks, page numbers, or classification tags to enhance document branding or security.
JavaScript Actions
Integrate JavaScript within PDFs to automate actions, such as form validation, field auto-fill, or user interaction prompts.
Watermark PDFs
Add single or multi-line watermarks with adjustable transparency and positioning to protect or label PDFs.
Add Page Elements
Draw shapes (lines, rectangles) or insert digital signatures onto PDF pages to enhance document layout or add verification.
Page Numbering
Dynamically add page numbers in headers, footers, or any part of the PDF to organize and format multi-page documents.
Concatenate and Split PDFs
Merge multiple PDFs into a single document or split large PDFs into smaller ones based on specific page ranges for easier management.
Working with Forms
AcroForms
Create, fill, and manipulate AcroForms in PDF documents. This includes adding new form fields, filling form data, and extracting or removing fields programmatically.
Decorate Form Fields
Customize form fields by setting appearances like borders, background color, and font settings to enhance the user experience.
Autofill Forms
Automatically populate form fields based on predefined values or data sources, saving time and reducing manual errors.
Copy Form Fields
Programmatically duplicate inner and outer form fields to maintain consistent form layouts and content across documents.
XFA Forms
Fill out XML-based XFA forms, convert XFA forms into standard AcroForms, and retrieve or manipulate XFA field properties for improved compatibility.
PDF Document Operations
Create and Manipulate PDF Documents
Generate new PDF documents, retrieve and set document properties, and embed fonts for accurate rendering across platforms.
Bookmarks and Links
Add, update, and navigate using bookmarks and internal/external links for better document navigation.
Change Page Size and Rotation
Modify the dimensions of existing PDF pages and rotate pages programmatically to ensure proper orientation.
Crop Pages
Adjust the visible area of a PDF page by cropping, which helps focus on specific content in a document.
Working with Tables
Add and format tables within PDFs, including row and column management, for structured data presentation.
Working with Lists
Programmatically create ordered and unordered lists, allowing for clear and organized content in PDF documents.
Optimize PDF
Compress images, remove unused objects, and reduce file size for better performance and storage efficiency.
Convert PDF to Other Formats
Convert PDF to Word
Transform PDF documents into editable Word formats (DOC/DOCX), retaining the layout and content structure.
Convert PDF to Excel
Extract tables and data from PDFs into Excel (XLSX) format for further data manipulation and analysis.
Convert PDF to PowerPoint
Convert PDF files into PowerPoint presentations (PPTX) while preserving formatting and content alignment.
Convert PDF to HTML
Convert PDF files to HTML, maintaining the original design and layout for web integration.
Convert PDF to Images
Export each page of a PDF as an image in formats like PNG, JPEG, or TIFF for easy viewing or processing.
Convert PDF to PDF/A
Convert standard PDF documents into the PDF/A format for long-term archiving.
Convert PDF to EPUB, LaTeX, Text, XPS
Convert PDF files to various other formats like EPUB for eBooks, LaTeX for scientific documentation, plain text, and XPS for sharing and printing.
Security and Encryption
Encrypt PDF Files
Secure your PDF documents by applying encryption using passwords or certificates.
Decrypt PDF Files
Remove encryption or access encrypted PDF files by providing the correct password or decryption key.
Change Password
Programmatically update or reset the password protection on PDF files.
Verify Digital Signatures
Verify the authenticity and integrity of PDF documents by checking the digital signatures applied to them.
Advanced PDF Features
Working with JavaScript in PDF
Integrate and manipulate JavaScript within PDF documents to enable dynamic user interactions or automated processes.
Attach Files and Annotations
Programmatically add file attachments and annotations to PDF documents for enhanced document interaction and collaboration.
Tagged PDFs
Work with tagged PDF files to improve accessibility and structure, enabling easier navigation and compliance with accessibility standards.
Manipulate Metadata, XMP, and Document Properties
Modify and manage document metadata, XMP properties, and other attributes for enhanced document control.
Facades and Utilities
Facade Classes for PDF Manipulation
Simplify common PDF operations using facade classes such as
PdfFileEditor
,PdfFileMend
,PdfContentEditor
, andPdfAnnotationEditor
.
Working with Attachments, Bookmarks, and Annotations
Manage PDF bookmarks, attachments, and annotations using facade classes like
PdfBookmarkEditor
andPdfAnnotationEditor
.
PDF Printing
Utilize the
PdfViewer
class to manage PDF printing tasks programmatically, controlling settings such as page range and printer selection.
Platform-Specific Implementations
ASP.NET without Visual Studio
Implement Aspose.PDF for .NET in ASP.NET applications without using Visual Studio, offering flexibility in deployment.
ColdFusion Integration
Use Aspose.PDF for .NET in ColdFusion-based environments, enabling PDF manipulation in web applications.
Integration with Umbraco, DNN, and Sitefinity
Seamlessly integrate PDF functionalities in popular CMS platforms like Umbraco, DotNetNuke (DNN), and Sitefinity.
COM Interoperability
Utilize Aspose.PDF for .NET via COM Interop, supporting ASP, VBScript, JScript, and C++ to enable PDF features in various programming environments.
Supported File Formats
Format | Description | Load | Save |
---|---|---|---|
Portable Document Format | ✔️ | ✔️ | |
CGM | Computer Graphics Metafile for 2D vector graphics | ✔️ | |
EPUB | Ebook file format | ✔️ | ✔️ |
HTML | HTML Format | ✔️ | ✔️ |
TeX | LaTex typesetting file format | ✔️ | ✔️ |
MHT | MHTML Document | ✔️ | |
PCL | Printer Control Language Files | ✔️ | |
PS | Postscript Files | ✔️ | |
SVG | Scalable Vector Graphics (An XML-based vector image format) | ✔️ | ✔️ |
XML | XML Format | ✔️ | ✔️ |
XPS | XPS Documents | ✔️ | ✔️ |
XSLFO | XSL-FO is part of XSL file which is used for XML transformation | ✔️ | |
MD | Markdown Format | ✔️ | |
XLS | Saves the document in the Microsoft Excel SpreadSheet | ✔️ | |
XLSX | Saves the document in the Microsoft Excel 2007 format | ✔️ | |
PPTX | Saves the document in the Microsoft PowerPoint format | ✔️ | |
DOC | Saves the document in the Microsoft Word format | ✔️ | |
DOCX | Saves the document in the Microsoft Word format | ✔️ | |
MobiXML | Saves the document in eBook MobiXML format | ✔️ | |
JPEG | Saves the document in JPEG Format | ✔️ | ✔️ |
EMF | Enhanced metafile format (EMF) | ✔️ | ✔️ |
PNG | Saves the document in PNG Format | ✔️ | ✔️ |
BMP | Saves the document in BMP Format | ✔️ | ✔️ |
GIF | Graphic Interchange Format | ✔️ | |
TIFF | Saves the document as Single or Multi-Page TIFF Image | ✔️ | ✔️ |
Text | Save the document in Text Format | ✔️ | ✔️ |
System Requirements
Category | Details |
---|---|
Overview | The API can be used on any OS that supports .NET Standard 2.0+ or .NET Framework 4.0. No need for Adobe Acrobat to produce/manipulate PDFs, but Adobe Acrobat Reader is needed to view them. |
Supported OS | Windows **Windows Server (2003, 2008, 2012, 2016, 2019, 2020, 2022), Vista, XP, 7, 8, 10, 11, Azure |
macOS Mac OS X x64 (10.12+) | |
Linux Linux x64 (6, 7, 27, 9, 8.7+, 18.04, 16.04, 14.04, 18, 17, 42.3+, 12 SP2+) | |
Android Android (8.0, 10, 11, 12, 13, 14, 15) | |
Development Environments | Microsoft Visual Studio (2010, 2011, 2012, 2013, 2015, 2017, 2019, 2022) |
Supported Frameworks | .NET Framework 4.0, .NET Framework 4.8.1, .NET Standard 2.0 (.NET Core 3.1+), .NET 6.0, .NET 7.0, .NET 8.0 |
How to Install Aspose.PDF for .NET
Aspose.PDF is a .NET component that allows developers to programmatically create and manipulate PDF documents. It supports inserting tables, graphs, images, hyperlinks, and custom fonts. The API works without needing Adobe Acrobat installed and provides features for PDF security and compression.
Evaluate Aspose.PDF for .NET
You can download and evaluate the full-featured Aspose.PDF for .NET with an evaluation watermark and a 4-page limit. To fully test without restrictions, request a 30-day Temporary License.
Installing Aspose.PDF for .NET via NuGet
Install Package using the Package Manager Console:
- Open Visual Studio.
- Go to Tools > NuGet Package Manager > Package Manager Console.
- Type
Install-Package Aspose.PDF
to install the latest version. - Press Enter.
Update Package:
- Open Package Manager Console.
- Type
Update-Package Aspose.PDF
to update to the latest version.
Install Package using the Package Manager GUI:
- Open Visual Studio.
- Go to Project > Manage NuGet Packages.
- Search for Aspose.PDF and click Install or Update.
Working with .NET Core DLLs on Non-Windows Environment
To use Aspose.PDF in .NET Core applications on Linux-based OS:
- Install
libgdiplus
. - Install Microsoft compatible fonts using:
sudo apt-get install ttf-mscorefonts-installer
. - Specify the font directory using:
Aspose.Pdf.Text.FontRepository.Sources.Add(new FolderFontSource("<path_to_fonts>"));
Aspose.PDF for .NET Code Samples
Extract Text from Specific Page Areas in Your .NET App with Aspose.PDF
Seamlessly target and retrieve text from defined regions within PDF pages using Aspose.PDF's powerful TextAbsorber
and Rectangle
features. Perfect for .NET developers seeking precise text extraction capabilities for their applications.
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_AsposePdf_Text();
// Open the PDF document
Document pdfDocument = new Document(dataDir + "ExtractTextAll.pdf");
// Create a TextAbsorber object to handle text extraction
TextAbsorber absorber = new TextAbsorber();
// Configure TextSearchOptions for precise extraction
absorber.TextSearchOptions.LimitToPageBounds = true; // Ensure extraction stays within page boundaries
absorber.TextSearchOptions.Rectangle = new Aspose.Pdf.Rectangle(100, 200, 250, 350); // Define the target region (x, y, width, height)
// Apply the absorber to the first page of the document
pdfDocument.Pages[1].Accept(absorber);
// Retrieve the extracted text from the specified region
string extractedText = absorber.Text;
// Create a TextWriter to save the extracted text to a file
TextWriter tw = new StreamWriter(dataDir + "extracted-text.txt");
// Write the extracted text to the file
tw.WriteLine(extractedText);
// Close the TextWriter to ensure proper file handling
tw.Close();
Precisely Replace Text in Specific PDF Regions with Aspose.PDF for .NET
Learn how to surgically search and replace text within defined areas of your PDF documents using Aspose.PDF for .NET. Enhance your document manipulation capabilities with this powerful feature.
// Load the PDF document
Aspose.PDF.Document pdf = new Aspose.PDF.Document("c:/pdftest/programaticallyproducedpdf.pdf");
// Create a TextFragmentAbsorber to identify and modify text fragments
Aspose.PDF.Text.TextFragmentAbsorber TextFragmentAbsorberAddress = new Aspose.PDF.Text.TextFragmentAbsorber();
// Configure TextSearchOptions for targeted replacement
TextFragmentAbsorberAddress.TextSearchOptions.LimitToPageBounds = true; // Restrict search within page boundaries
TextFragmentAbsorberAddress.TextSearchOptions.Rectangle = new Aspose.PDF.Rectangle(100, 100, 200, 200); // Define the target region (x, y, width, height)
// Apply the TextFragmentAbsorber to the first page
pdf.Pages[1].Accept(TextFragmentAbsorberAddress);
// Iterate through the identified TextFragments within the specified region
foreach (Aspose.PDF.Text.TextFragment tf in TextFragmentAbsorberAddress.TextFragments)
{
// Replace the text within each TextFragment with an empty string (effectively deleting it)
tf.Text = "";
}
// Save the updated PDF with the replaced text
pdf.Save("c:/pdftest/TextUpdated.pdf");
Develop ASP.NET Applications with Aspose.PDF – No Visual Studio Required
Unlock the power of Aspose.PDF for seamless PDF creation in your ASP.NET projects, even without Visual Studio. Learn how to harness "Instant ASP.NET" and embed C# code directly into your .aspx pages for efficient PDF generation.
<%@ Page Language="C#" %>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="Aspose.PDF" %>
<html>
<head>
<title>Using Aspose.PDF for .NET with Inline ASP.NET</title>
</head>
<body>
<h3>Creation of a simple PDF document using Aspose.PDF for .NET with Inline ASP.NET</h3>
<%
// Set the Aspose.PDF license (replace with your actual license path)
Aspose.PDF.License lic = new Aspose.PDF.License();
lic.SetLicense("D:\\ASPOSE\\Licences\\Aspose.Total licenses\\Aspose.Total.lic");
// Initialize a new PDF document
Document document = new Document();
// Add a page to the document
Page page = document.Pages.Add();
// Add "Hello World!" text to the new page
page.Paragraphs.Add(new Aspose.Pdf.Text.TextFragment("Hello World!"));
// Define the output file path (replace _dataDir with your desired directory)
var outputFileName = Path.Combine(_dataDir, "HelloWorld_out.pdf");
// Save the generated PDF to the specified location
document.Save(outputFileName);
%>
</body>
</html>
.NET API
| PDF Manipulation
| PDF Conversion
| Document Processing
| PDF Security
| PDF Encryption
| AcroForms
| XFA Forms
| Text Extraction
| Text Replacement
| Markdown to PDF
| Table Manipulation
| Image Insertion
| Bookmark Creation
| ASP.NET Integration
| COM Interop
| Document Metadata
| PDF Compression
| Multi-Platform Support
| ColdFusion Integration
| Document Signing
| Windows
| macOS
| Linux
| Android
| Document Layout
| PDF to Word
| PDF to Excel
| PDF to PowerPoint
| PDF to HTML
| PDF to Images
| PDF to PDF/A
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Microsoft.Extensions.DependencyModel (>= 5.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 7.0.0)
- Newtonsoft.Json (>= 13.0.3)
- System.Diagnostics.DiagnosticSource (>= 7.0.0)
- System.Diagnostics.PerformanceCounter (>= 4.5.0)
- System.Drawing.Common (>= 4.7.3)
- System.Net.Http.Json (>= 8.0.0)
- System.Reflection.Emit (>= 4.7.0)
- System.Security.Cryptography.Pkcs (>= 4.7.0)
- System.Security.Permissions (>= 4.5.0)
- System.Text.Encoding.CodePages (>= 7.0.0)
- System.Text.Json (>= 8.0.3)
-
net7.0
- Microsoft.Extensions.DependencyModel (>= 7.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 7.0.0)
- System.Diagnostics.DiagnosticSource (>= 7.0.0)
- System.Diagnostics.PerformanceCounter (>= 4.5.0)
- System.Drawing.Common (>= 7.0.0)
- System.Security.Cryptography.Pkcs (>= 7.0.0)
- System.Security.Permissions (>= 4.5.0)
- System.Text.Encoding.CodePages (>= 7.0.0)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Aspose.PDF.Drawing:
Package | Downloads |
---|---|
SenseNet.Preview.Aspose.PreviewImageGenerators
Aspose Preview image generator classes for the sensenet platform. |
|
Edocs.PrepareDocForPrinting
Package Description |
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on Aspose.PDF.Drawing:
Repository | Stars |
---|---|
aspose-pdf/Aspose.PDF-for-.NET
Aspose.PDF for .NET examples, plugins and showcase projects
|
Version | Downloads | Last updated |
---|---|---|
24.12.0 | 1,325 | 12/18/2024 |
24.11.0 | 12,220 | 11/29/2024 |
24.10.0 | 45,909 | 10/22/2024 |
24.9.0 | 32,432 | 9/23/2024 |
24.8.0 | 60,412 | 8/29/2024 |
24.7.0 | 64,382 | 7/31/2024 |
24.6.0 | 132,826 | 6/18/2024 |
24.5.0 | 38,857 | 5/20/2024 |
24.4.0 | 68,022 | 4/18/2024 |
24.3.0 | 34,140 | 3/26/2024 |
24.2.0 | 66,675 | 2/20/2024 |
24.1.0 | 112,212 | 1/24/2024 |
23.12.0 | 81,456 | 12/19/2023 |
23.11.0 | 65,974 | 11/21/2023 |
23.10.1 | 99,279 | 11/2/2023 |
23.10.0 | 30,569 | 10/24/2023 |
23.9.0 | 141,394 | 9/27/2023 |
23.8.0 | 101,113 | 8/15/2023 |
23.7.0 | 37,066 | 7/18/2023 |
23.6.0 | 75,984 | 6/19/2023 |
23.5.0 | 44,391 | 5/16/2023 |
23.4.0 | 93,565 | 4/13/2023 |
23.3.1 | 28,945 | 3/31/2023 |
23.3.0 | 16,346 | 3/15/2023 |
23.2.0 | 20,806 | 2/20/2023 |
23.1.1 | 4,754 | 2/7/2023 |
23.1.0 | 82,418 | 1/21/2023 |
22.12.0 | 25,149 | 12/20/2022 |