I want to use a C# NuGet library in a C++ project. I'm assuming I'd need to write some sort of wrapper in C# to be able to use the DLL in my C++ project, but I have no idea how this works and how to include this DLL in my C++ project.
I've created a C# library project so far and written this code, which uses the Spire.PDF library so far. The reason why I'm doing it in C# is because it is free for C#.
using Spire.Pdf.Texts;
using Spire.Pdf;
namespace SpirePDFLib
{
public class SpirePDFLib
{
public static void ReplaceInPDF()
{
// Create an object of the PdfDocument class
PdfDocument doc = new PdfDocument();
// Load a PDF file
doc.LoadFromFile("xyz.pdf");
// Iterate through the pages in the document
for (int i = 0; i < doc.Pages.Count; i++)
{
// Get the current page
PdfPageBase page = doc.Pages[i];
// Create an object of the PdfTextReplace class and pass the page to the constructor of the class as a parameter
PdfTextReplacer replacer = new PdfTextReplacer(page);
// Replace all instances of a specific text with new text
replacer.ReplaceAllText("STATEMENT", "Statement of: user");
// Replace all instances of a specific text with new text and set text color
//replacer.ReplaceAllText("Adobe Acrobat", "PDF Editor", Color.Yellow);
}
// Save the resulting file
doc.SaveToFile("ReplaceAllFoundText1.pdf");
doc.Close();
}
}
}
I think I need to use the DLL generated by building this code and include it in C++, but I don't know how. Any help would be really appreciated. Thank you!