Skip to content

Instantly share code, notes, and snippets.

View bjoerntx's full-sized avatar
👨‍💻
Building web apps

Bjoern Meyer bjoerntx

👨‍💻
Building web apps
View GitHub Profile
<rdf:Description xmlns:pdfaExtension="http://www.aiim.org/pdfa/ns/extension/"
xmlns:pdfaField="http://www.aiim.org/pdfa/ns/field#"
xmlns:pdfaProperty="http://www.aiim.org/pdfa/ns/property#"
xmlns:pdfaSchema="http://www.aiim.org/pdfa/ns/schema#"
xmlns:pdfaType="http://www.aiim.org/pdfa/ns/type#"
rdf:about=""
>
<pdfaExtension:schemas>
<rdf:Bag>
<rdf:li rdf:parseType="Resource">
using TXTextControl;
SaveSettings saveSettings = new SaveSettings();
var metaData = File.ReadAllText("metadata.xml");
// byte array from the ZUGFeRD XML file
var zugferdXML = File.ReadAllBytes("yourzugferd.xml");
// create a new embedded file
using TXTextControl;
SaveSettings saveSettings = new SaveSettings();
var metaData = File.ReadAllText("metadata.xml");
// byte array from the ZUGFeRD XML file
var zugferdXML = File.ReadAllBytes("rechnung_206_4267_zugferdaddon.xml");
// create a new embedded file
[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);
[TestMethod]
public void TestConversion()
{
string html = "<html><body><h1>Hello, World!</h1></body></html>";
byte[] pdf = MyTextControlClassLibrary.DocumentProcessing.GeneratePDF(html);
Assert.IsNotNull(pdf);
}
namespace MyTextControlClassLibrary
{
public static class DocumentProcessing
{
static DocumentProcessing() {
TXTextControl.ServerTextControl.EntryAssembly =
typeof(DocumentProcessing).Assembly;
}
public static byte[] GeneratePDF(string html)
TXTextControl.ServerTextControl.EntryAssembly = typeof(DocumentProcessing).Assembly;
namespace MyTextControlClassLibrary
{
public static class DocumentProcessing
{
static DocumentProcessing() {
TXTextControl.ServerTextControl.EntryAssembly =
typeof(DocumentProcessing).Assembly;
}
public static byte[] GeneratePDF(string html)
namespace MyTextControlClassLibrary
{
public static class DocumentProcessing
{
public static byte[] GeneratePDF(string html)
{
using (TXTextControl.ServerTextControl tx = new TXTextControl.ServerTextControl())
{
byte[] data;
using TXTextControl.DocumentServer.OfficeOpenXML;
// store the custom XML parts in a list
var docxFileContentNew = File.ReadAllBytes("modified.docx");
var customXmlParts = CustomXMLHandler.Extract(docxFileContentNew);
using (TXTextControl.ServerTextControl tx = new TXTextControl.ServerTextControl())
{
tx.Create();