Convert PDF to DOCX added CopyrightText in C# and .NET
Document management is an important part of modern business processes and automation. One common scenario is converting PDFs to editable DOCX format, which is easily processed in text editors and automation systems. In this article, we'll look at how to use the SautinSoft library a component PDF FOCUS .NET to convert PDFs to DOCX and insert copyright text into the resulting document.
The task of inserting author or copyright text into a converted document often arises in automated content processing scenarios.
This is important for:
- Intellectual property protection.
- Document rights notifications.
- Ensuring legal liability.
To achieve this, a template or script is created that, after conversion, supplements the DOCX content by adding the necessary comments or watermarks.
What is this code useful for?
- Provides automatic document conversion for subsequent processing.
- Allows not only format transformations but also the addition of legal or corporate markings.
- Capable of working with large files, which is relevant for corporate tasks.
What is this approach useful for?
- In automated document management systems.
- In situations where PDF reports or forms need to be converted to an editable format for further analysis.
- For preparing presentation or public versions of documents containing author or copyrighted text.
- In electronic archiving and data migration systems.
Complete code
using System;
using System.IO;
namespace Sample
{
class Sample
{
static void Main(string[] args)
{
// Before starting, we recommend to get a free key:
// https://sautinsoft.com/start-for-free/
// Apply the key here:
// SautinSoft.PdfFocus.SetLicense("...");
string pdfFile = Path.GetFullPath(@"..\..\..\text and graphics.pdf");
string wordFile = "Result.docx";
//Convert PDF file to Text file
SautinSoft.PdfFocus f = new SautinSoft.PdfFocus();
f.OpenPdf(pdfFile);
//This property doesn't affect into XML and Excel conversion.
f.CopyrightText = "Created by Simpson Family";
if (f.PageCount > 0)
{
int result = f.ToWord(wordFile);
//Show Text document
if (result == 0)
{
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(wordFile) { UseShellExecute = true });
}
}
}
}
}
Imports System
Imports System.IO
Namespace Sample
Friend Class Sample
Shared Sub Main(ByVal args() As String)
' Before starting, we recommend to get a free key:
' https://sautinsoft.com/start-for-free/
' Apply the key here
' SautinSoft.PdfFocus.SetLicense("...");
Dim pdfFile As String = Path.GetFullPath("..\..\..\text and graphics.pdf")
Dim wordFile As String = "Result.docx"
'Convert PDF file to Text file
Dim f As New SautinSoft.PdfFocus()
f.OpenPdf(pdfFile)
'This property doesn't affect into XML and Excel conversion.
f.CopyrightText = "Created by Simpson Family"
If f.PageCount > 0 Then
Dim result As Integer = f.ToWord(wordFile)
'Show Text document
If result = 0 Then
System.Diagnostics.Process.Start(New System.Diagnostics.ProcessStartInfo(wordFile) With {.UseShellExecute = True})
End If
End If
End Sub
End Class
End NamespaceIf you need a new code example or have a question: email us at support@sautinsoft.com or ask at Online Chat (right-bottom corner of this page) or use the Form below: