Skip to content

Instantly share code, notes, and snippets.

@aspose-com-gists
Last active December 5, 2022 12:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aspose-com-gists/1f41bb7049a8a431626db03415f8437e to your computer and use it in GitHub Desktop.
Save aspose-com-gists/1f41bb7049a8a431626db03415f8437e to your computer and use it in GitHub Desktop.
C# Watermark CAD Documents | Aspose.CAD for .NET

Add a Watermark to CAD Files using .NET CAD API

C# codes listed below demonstrating how to added a watermark to file. Developers can easily use and modify these as of their OMR application requirement.

More details of viewer code using .NET CAD Library at https://products.aspose.com/cad/net/watermark/

For code integration there few prerequisite listed in installation section below.

Installation

Install from command line as nuget install Aspose.CAD or via Package Manager Console of Visual Studio with Install-Package Aspose.CAD.

Alternatively, get the offline MSI installer or DLLs in a ZIP file from downloads.

More About C# CAD API

Home | Product Page | Docs | Demos | API Reference | Examples | Blog | Search | Free Support | Temporary License

var image = Image.Load(@"img.dxf");
// create an instance of CadRasterizationOptions and set page height & width
var rasterizationOptions = new CadRasterizationOptions()
{
PageWidth = 1600,
PageHeight = 1600
};
// create an instance of PdfOptions
var options = new PdfOptions()
{
UserWatermarkText = "ASPOSE", //set watermark text
UserWatermarkColor = Color.Black //set watermark color
};
// set the VectorRasterizationOptions property as CadRasterizationOptions
options.VectorRasterizationOptions = rasterizationOptions;
image.Save("img.pdf", options);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment