Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Created July 24, 2024 14:03
Show Gist options
  • Save bjoerntx/c4373752a29586a497ff18a17cc303cb to your computer and use it in GitHub Desktop.
Save bjoerntx/c4373752a29586a497ff18a17cc303cb to your computer and use it in GitHub Desktop.
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestConversion()
{
string html = "<html><body><h1>Hello, World!</h1></body></html>";
byte[] pdf = MyTextControlClassLibrary.DocumentProcessing.GeneratePDF(html);
Assert.IsNotNull(pdf);
// use TX Text Control to load the PDF and check for the text
using (TXTextControl.ServerTextControl tx = new TXTextControl.ServerTextControl())
{
tx.Create();
tx.Load(pdf, TXTextControl.BinaryStreamType.AdobePDF);
if (tx.Text.Contains("Hello, World!"))
{
Assert.IsTrue(true);
}
else
{
Assert.Fail();
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment