Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30804.86
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Create-fillable-PDF-from-Word", "Create-fillable-PDF-from-Word/Create-fillable-PDF-from-Word.csproj", "{E30CA867-4ADD-43D7-9BB6-BE0369E6FA71}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E30CA867-4ADD-43D7-9BB6-BE0369E6FA71}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E30CA867-4ADD-43D7-9BB6-BE0369E6FA71}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E30CA867-4ADD-43D7-9BB6-BE0369E6FA71}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E30CA867-4ADD-43D7-9BB6-BE0369E6FA71}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {54A592B9-E6C5-4762-A50F-590624BD75BA}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>Create_fillable_PDF_from_Word</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.DocIORenderer.Net.Core" Version="*" />
</ItemGroup>

<ItemGroup>
<None Update="Data\Template.docx">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Output\.gitkeep">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using System.IO;
using Syncfusion.DocIO.DLS;
using Syncfusion.DocIORenderer;
using Syncfusion.Pdf;

namespace Create_fillable_PDF_from_Word
{
class Program
{
static void Main(string[] args)
{
//Open the file as Stream.
using (FileStream fileStream = new FileStream(Path.GetFullPath(@"Data/Template.docx"), FileMode.Open))
{
//Load an existing Word document.
using (WordDocument wordDocument = new WordDocument(fileStream, Syncfusion.DocIO.FormatType.Automatic))
{
//Creates an instance of DocIORenderer.
using (DocIORenderer renderer = new DocIORenderer())
{
//Sets true to preserve the Word document form field as editable PDF form field in PDF document.
renderer.Settings.PreserveFormFields = true;
//Converts Word document into PDF document.
using (PdfDocument pdfDocument = renderer.ConvertToPDF(wordDocument))
{
//Save the PDF document to a file stream.
using (FileStream outputStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite))
{
pdfDocument.Save(outputStream);
}
}
}
}
}
}
}
}
Binary file added Images/Fillable-PDF.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
56 changes: 54 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,54 @@
# Create-fillable-PDF-from-Word-c-sharp
This repository contains the examples to create an fillable PDF from Word document in C# using Syncfusion .NET Word library
# Convert Word document with form fields into fillable PDF in C#

This repository contains examples that illustrates how to convert Word document with form fields into fillable PDF programmatically in C#. The Syncfusion&reg; [.NET Word library](https://www.syncfusion.com/document-processing/word-framework/net/word-library?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples) (DocIO) create a fillable PDF from a Word Document with just few lines of code and also it does not require Microsoft Word application to be installed in the machine.

## Key Features

[Create fillable PDF from Word document](https://github.com/SyncfusionExamples/Create-fillable-PDF-from-Word-c-sharp/tree/master/Create-fillable-PDF) - Convert Word documents with form fields into fillable PDFs while preserving the form fields as editable

<p align="center">
<img src="Images/Fillable-PDF.png" alt="Fillable PDF in C#"/>
</p>

## Syncfusion&reg; .NET Word Library
The Syncfusion&reg; DocIO is a [.NET Word library](https://www.syncfusion.com/document-processing/word-framework/net/word-library?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples) allows you to add advanced Word document processing functionalities to any .NET application and does not require Microsoft Word application to be installed in the machine. It is a non-UI component that provides a full-fledged document instance model similar to the Microsoft Office COM libraries to iterate with the document elements explicitly and perform necessary manipulation.

Take a moment to peruse the [documentation](https://help.syncfusion.com/document-processing/word/word-library/net/overview?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples), where you can find basic Word document processing options along with the features like [mail merge](https://help.syncfusion.com/document-processing/word/word-library/net/working-with-mail-merge?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples), [merge](https://help.syncfusion.com/document-processing/word/word-library/net/word-document/merging-word-documents?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples), [split](https://help.syncfusion.com/document-processing/word/word-library/net/word-document/split-word-documents?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples) and [compare documents](https://help.syncfusion.com/document-processing/word/word-library/net/word-document/compare-word-documents?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples), [find and replace](https://help.syncfusion.com/document-processing/word/word-library/net/working-with-find-and-replace?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples) text in the Word document, [protect](https://help.syncfusion.com/document-processing/word/word-library/net/working-with-security?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples) the Word documents, and most importantly, the [PDF](https://help.syncfusion.com/document-processing/word/conversions/word-to-pdf/overview?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples) and [Image](https://help.syncfusion.com/document-processing/word/conversions/word-to-image/overview?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples) conversions with code examples.

Compatible Microsoft Word Versions
----------------------------------

* Microsoft Word 97-2003
* Microsoft Word 2007
* Microsoft Word 2010
* Microsoft Word 2013
* Microsoft Word 2016
* Microsoft Word 2019
* Microsoft 365

Supported File Formats
----------------------

* Creates, reads, and edits popular text file formats like [DOC](https://help.syncfusion.com/document-processing/word/word-library/net/word-file-formats#doc-to-docx-and-docx-to-doc?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples), DOT, [DOCM](https://help.syncfusion.com/document-processing/word/word-library/net/word-file-formats#macros?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples), DOTM, [DOCX](https://help.syncfusion.com/document-processing/word/word-library/net/word-file-formats#doc-to-docx-and-docx-to-doc?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples), [DOTX](https://help.syncfusion.com/document-processing/word/word-library/net/word-file-formats#templates?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples), [HTML](https://help.syncfusion.com/document-processing/word/word-library/net/html?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples), [RTF](https://help.syncfusion.com/document-processing/word/word-library/net/rtf?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples), [TXT](https://help.syncfusion.com/document-processing/word/word-library/net/text?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples), and [XML (WordML)](https://help.syncfusion.com/document-processing/word/word-library/net/word-file-formats#word-processing-xml-xml?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples).
* Converts Word documents also to [PDF](https://help.syncfusion.com/document-processing/word/conversions/word-to-pdf/overview?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples), [Image](https://help.syncfusion.com/document-processing/word/conversions/word-to-image/overview?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples), and [ODT](https://help.syncfusion.com/document-processing/word/word-library/net/word-to-odt?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples) files.

## How to run the examples
- Download this project to a location in your disk.
- Open the solution file using Visual Studio.
- Rebuild the solution to install the required NuGet packages.
- Run the application.

## Resources

- **Product page:** [Syncfusion&reg; Word Framework](https://www.syncfusion.com/document-processing/word-framework/net?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples)
- **Documentation:** [Protect and unprotect Word document using Syncfusion&reg; Word library](https://help.syncfusion.com/document-processing/word/word-library/net/working-with-security)
- **GitHub Examples:** [Syncfusion&reg; Word library examples](https://github.com/SyncfusionExamples/DocIO-Examples?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples)
- **Online demo:** [Syncfusion&reg; Word library - Online demos](https://ej2aspnetcore.azurewebsites.net/aspnetcore/word/wordtopdf#/material3)

## Support and feedback
For any other queries, reach our [Syncfusion&reg; support team](https://support.syncfusion.com/?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples) or post the queries through the [community forums](https://www.syncfusion.com/forums?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples).

Request new feature through [Syncfusion&reg; feedback portal](https://www.syncfusion.com/feedback?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples).

## License
This is a commercial product and requires a paid license for possession or use. Syncfusion's licensed software, including this component, is subject to the terms and conditions of [Syncfusion's EULA](https://www.syncfusion.com/license/studio/22.2.5/syncfusion_essential_studio_eula.pdf?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples). You can purchase a licnense [here](https://www.syncfusion.com/sales/products?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples) or start a free 30-day trial [here](https://www.syncfusion.com/account/manage-trials/start-trials?utm_source=github&utm_medium=listing&utm_campaign=github-docio-examples).