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
private void InsertFoldingMark(double top, int width, Color color, HeaderFooter headerFooter, TextControl textControl)
{
textControl.PageUnit = MeasuringUnit.Twips;
// create a new drawing control
TXTextControl.Drawing.TXDrawingControl drawing =
new TXTextControl.Drawing.TXDrawingControl(3000, 1000);
// create a new line shape object
TXTextControl.Drawing.Shape shape =
textControl1.Sections.GetItem().HeadersAndFooters.Add(HeaderFooterType.Header);
HeaderFooter header = textControl1.Sections.GetItem().HeadersAndFooters.GetItem(HeaderFooterType.Header);
// folding mark 1
InsertFoldingMark(87, 500, Color.Black, header, textControl1);
// folding mark 2
InsertFoldingMark(192, 500, Color.Black, header, textControl1);
private void InsertFoldingMark(double top, int width, Color color, HeaderFooter headerFooter, TextControl textControl)
{
textControl.PageUnit = MeasuringUnit.Twips;
// create a new drawing control
TXTextControl.Drawing.TXDrawingControl drawing =
new TXTextControl.Drawing.TXDrawingControl(3000, 1000);
// create a new line shape object
TXTextControl.Drawing.Shape shape =
using (TXTextControl.ServerTextControl tx = new TXTextControl.ServerTextControl())
{
tx.Create();
// Load a document with form fields
tx.Load("form1.tx", StreamType.InternalUnicodeFormat);
// Flatten all form fields
tx.FormFields.Flatten();
textControl1.FormFields.Flatten();
FormField curField = textControl1.FormFields.GetItem(3);
textControl1.FormFields.Flatten(curField);
using TXTextControl;
public static class FormFieldExtender
{
public static void Flatten(this FormFieldCollection formFields, FormField formField)
{
formFields.Remove(formField, true);
}
public static void Flatten(this FormFieldCollection formFields)
{
"Author": "Tim Typer",
"CreatorApplication": "TX Text Control",
"CreationDate": "2024-07-15T17:53:29+02:00",
"DocumentKeywords": [
"TX Text Control",
"PDF",
"Metadata"
],
"DocumentSubject": "PDF Metadata",
using (TXTextControl.ServerTextControl tx = new TXTextControl.ServerTextControl())
{
tx.Create();
TXTextControl.LoadSettings loadSettings = new TXTextControl.LoadSettings();
tx.Load("metadata_sample.pdf", TXTextControl.StreamType.AdobePDF, loadSettings);
PdfMetadata pdfMetadata = new PdfMetadata()
{
using (TXTextControl.ServerTextControl tx = new TXTextControl.ServerTextControl())
{
tx.Create();
TXTextControl.LoadSettings loadSettings = new TXTextControl.LoadSettings();
tx.Load("metadata_sample.pdf", TXTextControl.StreamType.AdobePDF, loadSettings);
PdfMetadata pdfMetadata = new PdfMetadata()
{