cmlPrintStandard 1.0.1

dotnet add package cmlPrintStandard --version 1.0.1
                    
NuGet\Install-Package cmlPrintStandard -Version 1.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="cmlPrintStandard" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="cmlPrintStandard" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="cmlPrintStandard" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add cmlPrintStandard --version 1.0.1
                    
#r "nuget: cmlPrintStandard, 1.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package cmlPrintStandard@1.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=cmlPrintStandard&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=cmlPrintStandard&version=1.0.1
                    
Install as a Cake Tool

cmlPrintStandard

A flexible and powerful .NET Standard 2.0 library for creating and managing print layouts with table-based structures. This library simplifies the process of creating complex print layouts with tables, text, and images.

Features

  • Table-Based Layout System: Create sophisticated print layouts using a table structure system
  • Flexible Cell Types:
    • Text cells with customizable fonts, alignments, and rotations
    • Image cells for incorporating graphics
    • Container cells for hierarchical layouts
  • Watermark Support: Add watermarks to your print documents
  • Multi-Page Support: Handle content that spans multiple pages automatically
  • Text Rotation: Rotate text horizontally or vertically
  • Cell Styling: Control borders, background colors, and alignment
  • Export to Bitmap: Generate bitmap images of print layouts
  • Preview Support: Integrate with PrintPreviewControl or PrintPreviewDialog
  • Paper Type Settings: Support for continuous paper and single sheet printing

Requirements

  • .NET Standard 2.0 compatible framework
  • System.Drawing.Common dependencies

Installation

Add a reference to the cmlPrintStandard library in your project:

dotnet add reference path/to/cmlPrintStandard.csproj

Or include the compiled DLL in your project references.

Quick Start

Basic Usage

using cmlPrint.Print;
using cmlPrint.TableStructures;
using System.Drawing.Printing;

// Create a print document
PrintDocument doc = new PrintDocument();

// Create a container for your print content
PrintTableContainerCell container = new PrintTableContainerCell();

// Create a table with 3 columns
PrintTable table = new PrintTable(3);

// Add a row with text
PrintTableRow row = new PrintTableRow();
PrintTableTextCell cell1 = new PrintTableTextCell { Text = "Hello" };
PrintTableTextCell cell2 = new PrintTableTextCell { Text = "World" };
PrintTableTextCell cell3 = new PrintTableTextCell { Text = "Example" };
row.Add(cell1);
row.Add(cell2);
row.Add(cell3);

// Add the row to the table
table.Rows.Add(row);

// Set the container content
container.SetContent(table);

// Create the print document with the container
new cmlPrintDocument(doc, container);

// Print or preview the document
doc.Print();
// or
PrintPreviewDialog previewDialog = new PrintPreviewDialog();
previewDialog.Document = doc;
previewDialog.ShowDialog();

Creating a Text Cell with Rotation

PrintTableTextCell rotatedCell = new PrintTableTextCell
{
    Text = "Rotated Text",
    Font = new Font("Arial", 12),
    Rotation = Rotations.Vertical,
    ContentHorizontalAlign = HorizontalAlign.Center,
    ContentVerticalAlign = VerticalAlign.Center
};

Adding a Watermark

// Create a watermark cell
PrintTableTextCell watermark = new PrintTableTextCell
{
    Text = "CONFIDENTIAL",
    Font = new Font("Arial", 36),
    ForeColor = Color.FromArgb(50, Color.Red),
    ContentHorizontalAlign = HorizontalAlign.Center,
    ContentVerticalAlign = VerticalAlign.Center
};

// Create print document with watermark
new cmlPrintDocument(doc, container, watermark);

Table Structure

The library uses a hierarchical structure of print elements:

  • PrintTableCell - Base class for all print elements
    • PrintTableTextCell - Cell containing text content
    • PrintTableImageCell - Cell containing image content
    • PrintTableContainerCell - Cell that can contain another print element
    • PrintTable - Table structure containing rows
      • PrintTableRow - Row containing cells

Customizing Appearance

Cell Alignment

textCell.ContentHorizontalAlign = HorizontalAlign.Center; // Left, Center, Right
textCell.ContentVerticalAlign = VerticalAlign.Bottom; // Top, Center, Bottom

Cell Styling

cell.BorderStyle = BorderStyle.All; // None, Left, Right, Top, Bottom, All
cell.BorderWidth = 1.0f;
cell.BorderColor = Color.Black;
cell.BackColor = Color.LightGray;

Advanced Usage

Exporting to Bitmap

// Create a PrintPageEventArgs to define the export area
PrintPageEventArgs e = /* initialize with appropriate values */;

// Export to bitmap
Bitmap bitmap = printDocument.ExportToBitmap(e);

Working with Multi-Page Documents

The library automatically handles content that spans multiple pages. Use the AllowRowSplitting property on tables to control how rows are split between pages.

PrintTable table = new PrintTable(3);
table.AllowRowSplitting = true; // Allow rows to split across pages

License

This library is provided for use under [your license terms].

Contributing

Contributions are welcome. Please feel free to submit a Pull Request.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.1 142 7/12/2025
1.0.0 124 7/12/2025