Aspose.PDF FOSS for .NET एक MIT-लाइसेंस वाला लाइब्रेरी है जो C# और .NET में PDF दस्तावेज़ बनाने और उनके साथ काम करने के लिए है। केंद्रीय प्रवेश बिंदु Document क्लास है, जो फ़ाइल पथ, बाइट एरे, स्ट्रीम, या पासवर्ड‑सुरक्षित स्रोतों से निर्माण का समर्थन करता है, और Open, Save, Merge, Encrypt, Decrypt, और Convert ऑपरेशन्स को पूरी PDF विशिष्टता के पार उजागर करता है।
लाइब्रेरी 805 क्लासेज़ को उजागर करती है जो दस्तावेज़ संरचना को Document, Page, और PageCollection के माध्यम से कवर करती हैं; AnnotationCollection के माध्यम से समृद्ध एनोटेशन (जिसमें AddTextAnnotation, AddLinkAnnotation, AddHighlightAnnotation, AddWatermarkAnnotation, और AddRedactAnnotation शामिल हैं); Form, ButtonField, CheckboxField, RadioButtonField, और ChoiceField के साथ इंटरैक्टिव फ़ॉर्म; TextFragmentAbsorber और TextFragment के द्वारा टेक्स्ट निष्कर्षण और खोज; AbsorbedTable, AbsorbedRow, और AbsorbedCell के साथ टेबल डिटेक्शन; और Document.Encrypt तथा Document.Decrypt के द्वारा दस्तावेज़ सुरक्षा। फ़ॉर्मेट रूपांतरण HTML, SVG, और Markdown आयात के साथ-साथ PDF निर्यात का समर्थन करता है।
Aspose.PDF FOSS for .NET को NuGet से इंस्टॉल करें: dotnet add package Aspose.Pdf.Foss --version 0.1.0-alpha। लाइब्रेरी पूरी तरह से MIT-लाइसेंस वाली है और इसमें कोई रन‑टाइम शुल्क या उपयोग प्रतिबंध नहीं हैं। एंटरप्राइज़ फीचर्स और समर्थन के लिए देखें Aspose.PDF for .NET — Enterprise Product.
Document() or open existing files via Document.Open(path), Document.Open(data), or Document.Open(stream).PageCollection. Each Page exposes Width, Height, MediaBox, rotation, and Annotations.Document.Merge(documents) or Document.MergeDocuments(files). Import specific pages with Document.ImportPage and Document.ImportPages.DocumentInfo and Document.GetOrCreateMetadata().Document.Save(filename), Document.Save(stream, format), or Document.ToArray().Document instance and populating pages with content.Document.ImportPage and the Page API.Document.MergeDocuments.AnnotationCollection exposes methods for text, link, highlight, underline, strikeout, square, circle, line, ink, stamp, caret, redact, watermark, polygon, and polyline annotations.AddLinkAnnotation(rect, uri) or internal page-jump links with AddLinkAnnotation(rect, destinationPage, destRect).Document.Form to enumerate or create ButtonField, CheckboxField, RadioButtonField, and ChoiceField instances.AnnotationSelector with per-type Visit overloads.AnnotationFlags.AddRedactAnnotation.AddWatermarkAnnotation and AddStampAnnotation.TextFragmentAbsorber to locate all text fragments on a page or across a document, with optional phrase matching.TextFragment exposes Text, Position, TextState (font, size, colour), and bounding rectangle.TextFragmentState provides access to Font, FontSize, ForegroundColor, BackgroundColor, and rendering mode.AbsorbedTable, AbsorbedRow, and AbsorbedCell, each providing Rect and TextFragments.AbsorbedTable to parse tabular row-and-column data from financial PDFs.Document.Encrypt(userPassword, ownerPassword, permissions, algorithm) using Algorithm.AESx128, AESx256, or RC4x128.DocumentPrivilege.Document.ChangePasswords.Document.Decrypt().Signature and Algorithm types.DocumentPrivilege to prevent copying.Open an existing PDF, attach a URI link annotation to page 1, and persist the result.
using Aspose.Pdf;
var data = System.IO.File.ReadAllBytes("input.pdf");
using var doc = Document.Open(data);
var page = doc.Pages[1];
var action = PdfAction.CreateUri("https://aspose.com");
page.Annotations.AddLinkAnnotation(
new Rectangle(50, 700, 200, 720), action);
using var ms = new System.IO.MemoryStream();
doc.Save(ms);
System.IO.File.WriteAllBytes("output.pdf", ms.ToArray());
Stamp a watermark onto page 1 of an existing document and round-trip through serialization.
using Aspose.Pdf;
var input = System.IO.File.ReadAllBytes("report.pdf");
using var doc = Document.Open(input);
doc.Pages[1].Annotations.AddWatermarkAnnotation(
new Rectangle(0, 0, 612, 792), "CONFIDENTIAL");
var saved = doc.ToArray();
System.IO.File.WriteAllBytes("watermarked.pdf", saved);
Use TextFragmentAbsorber to enumerate all text fragments on the first page.
using Aspose.Pdf;
using Aspose.Pdf.Text;
var data = System.IO.File.ReadAllBytes("document.pdf");
using var doc = Document.Open(data);
var absorber = new TextFragmentAbsorber();
absorber.Visit(doc.Pages[1]);
foreach (var fragment in absorber.TextFragments)
{
Console.WriteLine(fragment.Text);
}
Aspose.PDF FOSS for .NET is released under the MIT License, allowing free use in commercial products with no runtime fees. The source code is publicly available on GitHub.
Install from NuGet using dotnet add package Aspose.Pdf.Foss --version 0.1.0-alpha. The library targets .NET 8 and later with no native dependencies.
The library reads and writes PDF and supports import of HTML, SVG, and Markdown. Raster export is also available — PDF pages can be rendered to BMP, JPEG, PNG, and TIFF.
Use Document.Create() to produce an empty document, then add pages and save with Document.Save(stream) or Document.ToArray().
No license key or activation step is required. The library runs fully unlicensed at no cost under the MIT License.