A C# application for converting documents between various formats, such as DOCX, PDF, HTML, and Excel. Built using .NET and libraries like iTextSharp, Open XML SDK, and NPOI.
-
Clone the Repository:
git clone https://github.com/TyroneMartin/DocumentConverterApplication cd document-converter-application
-
Install .NET SDK:
- Download and install the .NET SDK from .NET Downloads.
- Verify installation by running:
dotnet --version
-
Install Required NuGet Packages:
- Install the necessary NuGet packages for the project:
dotnet add package iTextSharp dotnet add package DocumentFormat.OpenXml dotnet add package NPOI dotnet add package HtmlAgilityPack dotnet add package itext7.bouncy-castle-adapter
- Install the necessary NuGet packages for the project:
-
Build the Project:
-
Build the project to ensure all dependencies are implemented correctly 🙂.
dotnet build
-
-
Run the Application:
- Run the application with the appropriate arguments for conversion:
dotnet run <converter> <inputPath> <outputPath>
- Example:
dotnet run docx2pdf document.docx output.pdf
- Run the application with the appropriate arguments for conversion:
The application currently supports the following conversions:
-
DOCX Converters:
docx2pdf
: Convert DOCX to PDF.docx2html
: Convert DOCX to HTML.docx2txt
: Convert DOCX to plain text.docx2excel
: Convert DOCX to Excel.
-
PDF Converters:
pdf2docx
: Convert PDF to DOCX.pdf2txt
: Convert PDF to plain text.
-
HTML Converters:
html2docx
: Convert HTML to DOCX.
The following converters are planned for future implementation:
- HTML to PDF
- Excel to DOCX
- Excel to PDF
If you encounter errors related to missing packages, ensure that all required NuGet packages are installed:
dotnet add package iTextSharp
dotnet add package DocumentFormat.OpenXml
dotnet add package NPOI
dotnet add package HtmlAgilityPack
dotnet add package itext7.bouncy-castle-adapter
If the build fails, clean and rebuild the project:
dotnet clean
dotnet build
Ensure that the input and output file paths are correct and accessible. Use absolute paths if necessary.
- .NET SDK: For building and running the application.
- Visual Studio Code: A lightweight code editor with C# support.
- Git: Version control system for managing the codebase.
- NuGet: Package manager for .NET.
- C#: Primary programming language.
- .NET: Framework for building the application.
- iTextSharp: Library for PDF manipulation.
- DocumentFormat.OpenXml: Microsoft's library for working with Office documents.
- NPOI: Library for Excel manipulation.
- HtmlAgilityPack: Library for HTML parsing and manipulation.
- File input and output: Improve the user experience by specifying input and output file paths.
- Command-line interface: Create a easy-to-use interface for running conversions.
- Multi-Format Support: Convert between DOCX, PDF, HTML, and Excel formats.
- Flexible Conversion: Supports both single and batch conversions.
- Error Handling: Robust error handling for invalid inputs or unsupported formats,etc.
- Extensible Architecture: Easily add new converters by extending the
DocumentConverter
base class.
- .NET SDK 6.0 or higher: Required for building and running the application.
- NuGet: For managing dependencies.
- Supported Formats:
Please note:
Input files must be in a supported format (DOCX, PDF, HTML, Excel).
- .NET Documentation: https://docs.microsoft.com/en-us/dotnet/
- iTextSharp Documentation: https://itextpdf.com/
- Open XML SDK Documentation: https://learn.microsoft.com/en-us/office/open-xml/open-xml-sdk
- NPOI Documentation: https://github.com/nissl-lab/npoi
- HtmlAgilityPack Documentation: https://html-agility-pack.net/
- Development: 25-30 hours
- Testing and Debugging: 5-10 hours
- Documentation: 2-3 hours