cmlPrintStandard 1.0.1
dotnet add package cmlPrintStandard --version 1.0.1
NuGet\Install-Package cmlPrintStandard -Version 1.0.1
<PackageReference Include="cmlPrintStandard" Version="1.0.1" />
<PackageVersion Include="cmlPrintStandard" Version="1.0.1" />
<PackageReference Include="cmlPrintStandard" />
paket add cmlPrintStandard --version 1.0.1
#r "nuget: cmlPrintStandard, 1.0.1"
#:package cmlPrintStandard@1.0.1
#addin nuget:?package=cmlPrintStandard&version=1.0.1
#tool nuget:?package=cmlPrintStandard&version=1.0.1
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 elementsPrintTableTextCell- Cell containing text contentPrintTableImageCell- Cell containing image contentPrintTableContainerCell- Cell that can contain another print elementPrintTable- Table structure containing rowsPrintTableRow- 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 | Versions 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. |
-
.NETStandard 2.0
- System.Drawing.Common (>= 5.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.