.NET Document Editor API to Edit PDF, Word & More

Add document editing capabilities to your .NET solutions by integrating with any HTML editor. Load documents, edit them easily, and convert them back to their original format.

Download Free TrialView All APIs

Effortless Document Editing with Reliable .NET API

GroupDocs.Editor for .NET offers document editing functionality by integrating with various HTML-based editors. It helps developers supercharge their .NET document management solutions with easy-to-use methods to edit PDF, Microsoft Word, Excel, PowerPoint, XPS, ODT, ODP, ODS, HTML, RTF, TXT, and more file formats. Our API provides unmatched flexibility in integration with any WYSIWYG HTML editor. It loads the document and seamlessly converts it to HTML, which is pushed to the HTML editor, where you can make the required changes and save the modified document back to its original format.

The .NET document editor API supports a host of editing features for the supported file types, such as retrieving document metadata, optimizing memory usage for large CSV documents, flow or paged mode editing of MS Word documents, setting input text file character encoding, fixing document structure of XML files, recognizing email addresses and URLs in XML documents, fetching complete HTML documents or only the body contents, fetching HTML file resources, including images and styling sheets, and many more. GroupDocs.Editor for .NET empowers end users to effortlessly modify different documents and optimize their document management workflow on the .NET platform.

Getting Started

Before setting up the .NET document editor API, please visit the System Requirements page to view the recommended OS, framework, development environment, and other settings. Ensuring compliance with the requirements outlined on this page will allow you to enjoy a smooth user experience.

GroupDocs.Editor for .NET Installation

Please proceed to the downloads section to download the MSI installer or the DLLs and install the library. Or, you can use the NuGet package for setting up the .NET document editing library. The command for the Visual Studio package manager console is shared below:

PM > Install-Package GroupDocs.Editor

Develop PDF Editor Apps and Enhance Word Document Editing in .NET

GroupDocs.Editor for .NET helps developers create flexible PDF editors and MS Word document editing applications using their favorite WYSIWYG editors. End users can develop advanced solutions targeting desktop or web interfaces with the .NET document editor API. It provides all the necessary tools and methods that you can utilize to augment your document processing apps. This section will provide code examples to help you build customized document editors for the .NET platform.

Edit PDF Documents in .NET

You can use the .NET document editing library to develop robust PDF editor apps. Please refer to the following steps and C# coding example to learn more.

  • Load the input PDF document using PdfLoadOptions.
  • Edit the document with PdfEditOptions.
  • Push the content to the WYSIWYG editor, add modifications, and send the edited document back to the server side.
  • Create an EditableDocument instance with edited content. Apply save options with PdfSaveOptions and save the document using the Save method.

// Input document and password
const string filename = "NET_Framework-protected.pdf";
const string password = "password";
string inputPath = System.IO.Path.Combine(Common.TestHelper.PdfFolder, filename);

//1. Create a load options class with a password
GroupDocs.Editor.Options.PdfLoadOptions loadOptions = new PdfLoadOptions();
loadOptions.Password = password;

//2. Create edit options and adjust if necessary
GroupDocs.Editor.Options.PdfEditOptions editOptions = new PdfEditOptions();
editOptions.EnablePagination = true; //enable pagination for per-page processing in WYSIWYG-editor
editOptions.Pages = PageRange.FromStartPageTillEnd(3); //Edit pages from the 3rd page till the end

//3. Create an Editor instance and load a document
GroupDocs.Editor.Editor editor = new Editor(inputPath, delegate () { return loadOptions; });

//4. Edit a document and generate an EditableDocument
GroupDocs.Editor.EditableDocument originalDoc = editor.Edit(editOptions);

//5. Generate HTML/CSS, send it to WYSIWYG, edit there, and obtain edited version
string originalContent = originalDoc.GetEmbeddedHtml();
string editedContent = originalContent.Replace(".NET Framework", "I love Java!!!");

//6. Generate EditableDocument from edited content
EditableDocument editedDoc = EditableDocument.FromMarkup(editedContent, null);

//7. Create and adjust save options
GroupDocs.Editor.Options.PdfSaveOptions saveOptions = new PdfSaveOptions();
saveOptions.Compliance = PdfCompliance.Pdf20;

//8. Save to a file or a stream
string outputPath = System.IO.Path.Combine(Common.TestHelper.OutputFolder, filename);
editor.Save(editedDoc, outputPath, saveOptions);

//9. Dispose all resources
originalDoc.Dispose();
editedDoc.Dispose();
editor.Dispose();

Edit Word Documents using C#

Developing Word document editing solutions in .NET helps automate the process and make it more efficient. The following C# code example explains more.


// Edit Word documents in .NET 
using (FileStream fs = File.OpenRead("filepath/document.docx"))
{   // Load the input Word document
    Options.WordProcessingLoadOptions loadOptions = new WordProcessingLoadOptions();
    loadOptions.Password = "password-if-any";
    // Edit the document
    using (Editor editor = new Editor(delegate { return fs; }, delegate { return loadOptions; }))
    {
        Options.WordProcessingEditOptions editOptions = new WordProcessingEditOptions();
        editOptions.FontExtraction = FontExtractionOptions.ExtractEmbeddedWithoutSystem;
        editOptions.EnableLanguageInformation = true;
        editOptions.EnablePagination = true;

        using (EditableDocument beforeEdit = editor.Edit(editOptions))
        {
            string originalContent = beforeEdit.GetContent();
            List allResources = beforeEdit.AllResources;

            string editedContent = originalContent.Replace("document", "edited document");
            // Save the edited Word document
            using (EditableDocument afterEdit = EditableDocument.FromMarkup(editedContent, allResources))
            {
                WordProcessingFormats docxFormat = WordProcessingFormats.Docx;
                Options.WordProcessingSaveOptions saveOptions = new WordProcessingSaveOptions(docxFormat);
                            
                saveOptions.EnablePagination = true;
                saveOptions.Locale = System.Globalization.CultureInfo.GetCultureInfo("en-US");
                saveOptions.OptimizeMemoryUsage = true;
                saveOptions.Password = "password";
                saveOptions.Protection = new WordProcessingProtection(WordProcessingProtectionType.ReadOnly, "write_password");

                using (FileStream outputStream = File.Create("filepath/editedDocument.docx"))
                {
                    editor.Save(afterEdit, outputStream, saveOptions);
                }
            }
        }
    }
}

More coding examples can be found on the GitHub examples page of GroupDocs.Editor for .NET API. We provide Free Online Document Editing Apps that you can use to edit PDF, Word, Excel, PowerPoint, text, eBook, XML, OpenOffice, and more formats from anywhere, using your desktop or mobile devices.

Independently Build Collaborative Document Editor Solutions in .NET

GroupDocs.Editor for .NET allows individual and business users to edit documents on all popular 32-bit and 64-bit operating systems, including Windows, Mac, and Linux. Our API is compatible with various frameworks and development environments so that you can integrate it with your existing software easily. You do not need to install additional software to edit documents with the .NET document editor API. Enjoy unmatched platform independence and build online document editing solutions using our API quickly and easily.

FAQ

1. What is GroupDocs.Editor for .NET API?

GroupDocs.Editor for .NET is a robust document editing API for programmatically editing different types of documents using HTML-based editors. End users can utilize the API features in their solutions to add file editing functionality and enhance their document processing workflows.

2. What document formats are supported by the API?

Many well-known file formats are supported by the API, including Microsoft Word (DOC, DOCX), Excel (XLS, XLSX), PowerPoint (PPT, PPTX), PDF, OpenDocument (ODT, ODP, ODS), XPS, HTML, XML, MHTML, TXT, EPUB & more.

3. Are code examples available to help learn about document editing using the .NET API?

Yes, we provide code examples for developers on the GitHub examples page of the .NET API. These code examples help end users during the initial learning curve, and they can get up to speed and start editing documents with ease.

4. Is the API secure for sensitive documents and data?

Yes, the API is secure and you can rest assured about the safety of your data while using the API. We ensure the security and integrity of your data and take all necessary measures to provide you with a secure user experience.

5. Is GroupDocs.Editor for .NET compatible with different .NET frameworks?

Absolutely! The .NET document editing library is compatible with multiple .NET frameworks and runs smoothly on various operating systems. You do not need to install third-party software for editing documents using the library.

Looking for help?

Checkout our support channels for help with your questions related to GroupDocs product API features and working.

Ready to get started?

Download Free Trial View All APIs