Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

ncode-cli

Thin C# console that wraps NeoLABNcodeSDK.dll (.NET Framework 4.5, x64 only). The Go side (pattern/neolab) shells out to this binary once per PDF page because the official Ncode dot-pattern algorithm is shipped only as a managed .NET DLL; reimplementing it in Go without the published spec is out of scope of this SDK.

The wrapper exists primarily so the Go side has a clean stdin / stdout / exit- code contract regardless of host OS, and so the Mono path-handling bug documented in MONO_PATH_WORKAROUND.md is fixed in exactly one place.

Prerequisites before building

  1. Copy NeoLABNcodeSDK.dll (obtained through your NeoLAB technical agreement) into this directory, alongside NcodeCli.csproj. The .csproj references it via HintPath.
  2. A NeoLAB-issued appSecretKey is required at runtime. Building works without one; running ncode-cli generate … does not.
  3. Outbound network access to api.neolab.net is also required at runtime — both GetTickets() and GenerateNcode() are REST calls.

Build

Windows

From the Developer Command Prompt for Visual Studio:

msbuild NcodeCli.csproj /p:Configuration=Release /p:Platform=x64

Output: bin\Release\ncode-cli.exe plus NeoLABNcodeSDK.dll copied alongside.

Linux / macOS (via Mono)

mono-csc -r:NeoLABNcodeSDK.dll -target:exe -out:ncode-cli.exe Program.cs

The resulting ncode-cli.exe runs under Mono 6.8+:

mono ./ncode-cli.exe generate --app-key $KEY ...

The SDK is Windows-developed but its IL is platform-neutral; Mono is the only supported non-Windows host. On Linux, libgdiplus 6.1+ is required (System.Drawing.Bitmap inside the SDK depends on it).

CLI surface

ncode-cli generate
  --app-key <secret>        NeoLAB-issued key (required)
  --ticket-idx <n>          Which GetTickets() entry to use (default 0)
  --type <N3C6|G3C6|S1C6|P1C6>
  --section <s> --owner <o> --book <b> --page <p>
  --width-inch <w> --height-inch <h>
  --dpi <600|1200>          (default 600)
  [--bold]                  Thicken dots (SDK isBold)
  [--line-mode]             N3C6/G3C6 only
  --out-png <path>          Where to write the PNG (required)

Other commands: tickets (list provisioned ranges as JSON) and postscript (write a multi-page PS file via GetPostscript, S1C6/P1C6 only).

On success, generate exits 0 and prints a one-line JSON to stdout:

{"pageId":"3.100.1.1","pngPath":"/tmp/page.png","dpi":600,"widthInch":8.27,"heightInch":11.69}

On failure, prints sdk.GetLastError() to stderr and exits non-zero.

Packaging for distribution

Ship ncode-cli.exe + NeoLABNcodeSDK.dll together. Point the Go SDK at the .exe via neolab.Generator{ ExePath: "..." }.