Skip to content

Commit 811126d

Browse files
jphan32claude
andcommitted
Initial commit: Ncode SDK for Linux
Public Go SDK for generating Ncode-overlaid PDFs that the NeoLAB Neo smartpen can read on Linux, macOS, and Windows. Community complement to the official NeoSmartpen/Ncode-SDK2.0 with two contributions over upstream: 1. Linux/macOS support via a Mono-friendly C# wrapper that patches around NeoLABNcodeSDK.dll's hardcoded-backslash GetImage() bug. 2. 3-pixel triangle and 4-pixel custom dilation kernels (Tri3Up/Down, Tri4Up/Down, Diamond4) for the dot ink footprint, with footprint locality and centroid-invariance properties pinned by tests. Also includes: - Idiomatic Go API for the K-removal + two-layer ImageMask PDF pipeline (ncode, pattern, pattern/neolab, pattern/kernels, pdf). - Deterministic stub Generator (pattern/stub) for offline testing. - Two production examples (publish, discover-tickets) and unit + integration tests that run without NeoLAB credentials. - OSS hygiene: Apache-2.0 + AGPL-3.0 transitive disclosure (go-fitz/ MuPDF), CONTRIBUTING/SECURITY/CODE_OF_CONDUCT/MAINTAINERS, GitHub Actions CI, PR/issue templates. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 parents  commit 811126d

41 files changed

Lines changed: 5658 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
name: Bug report
3+
about: Something the SDK does is wrong or surprises you
4+
title: "[bug] "
5+
labels: bug
6+
assignees: ''
7+
---
8+
9+
<!--
10+
Before opening:
11+
- Search existing issues to avoid duplicates.
12+
- Confirm the bug reproduces against the latest tagged release (or main).
13+
- Do NOT report security issues here — see SECURITY.md.
14+
-->
15+
16+
## What happened
17+
18+
<!-- One or two sentences. -->
19+
20+
## Expected behaviour
21+
22+
<!-- What the SDK should have done instead. -->
23+
24+
## Reproduction
25+
26+
```go
27+
// Smallest Go snippet that exhibits the bug. Prefer something that
28+
// runs against pattern/stub so a reviewer can reproduce without
29+
// NeoLAB credentials.
30+
```
31+
32+
If the bug needs a real input PDF or NeoLAB-side state to reproduce,
33+
describe how a reviewer can synthesise an equivalent input.
34+
35+
## Environment
36+
37+
- SDK version / commit:
38+
- Go version (`go version`):
39+
- OS / arch:
40+
- For pen-recognition or print-quality bugs (in addition to the above):
41+
- Printer model:
42+
- Driver / RIP:
43+
- DPI used:
44+
- Kernel used (`Tri3` alternating, `Tri4`, `Diamond4`, `isBold`, custom):
45+
- NeoLABNcodeSDK.dll version (if relevant):
46+
47+
## Logs / output
48+
49+
<!-- Stack traces, stderr from ncode-cli, slog output, etc. Wrap in
50+
triple backticks. Trim irrelevant lines. -->
51+
52+
```
53+
```
54+
55+
## Anything else
56+
57+
<!-- Workarounds you tried, related issues, hypotheses about cause. -->

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: Security vulnerability
4+
url: https://github.com/Post-Math/Ncode-SDK-for-Linux/security/advisories/new
5+
about: Report a security issue privately. Do NOT open a public issue.
6+
- name: NeoLAB SDK / Anoto licensing
7+
url: https://www.neosmartpen.com/
8+
about: Questions about NeoLAB-issued credentials, NeoLABNcodeSDK.dll, or the Anoto pattern algorithm itself belong with NeoLAB Convergence directly — they are not in scope for this repository.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
name: Feature request
3+
about: Suggest a new capability or a change to an existing one
4+
title: "[feature] "
5+
labels: enhancement
6+
assignees: ''
7+
---
8+
9+
<!--
10+
Before opening:
11+
- Skim CONTRIBUTING.md "Scope" — features that fall outside scope
12+
will be closed without action. Linux/Mono support and dilation
13+
kernels / PDF-pipeline polish are in; reimplementing NeoLAB's
14+
proprietary algorithm or building application-level features
15+
is out.
16+
- Describe the use case BEFORE the proposed API. We want to
17+
understand the problem before agreeing on the shape of the fix.
18+
-->
19+
20+
## Use case
21+
22+
<!-- What you are trying to do with the SDK that isn't currently
23+
possible (or is awkward). Concrete example preferred. -->
24+
25+
## Why the current API doesn't work
26+
27+
<!-- Which existing types / functions you tried, and where they fall
28+
short. -->
29+
30+
## Proposed change
31+
32+
<!-- Sketch the API or behavioural change. A small Go snippet of
33+
"what calling code would look like" is more useful than prose. -->
34+
35+
```go
36+
// Hypothetical calling-code shape after the change.
37+
```
38+
39+
## Alternatives considered
40+
41+
<!-- Workarounds you've used, similar features in other SDKs, etc. -->
42+
43+
## Compatibility impact
44+
45+
- [ ] No public API change
46+
- [ ] Adds new exported names (non-breaking)
47+
- [ ] Renames or removes existing exported names (breaking)
48+
- [ ] Adds a new dependency (please justify)
49+
50+
## Anything else
51+
52+
<!-- Printer/kernel context if pen-recognition is involved. -->

.github/pull_request_template.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<!--
2+
Thanks for opening a pull request.
3+
4+
Before you submit, confirm:
5+
- You read CONTRIBUTING.md and your change fits within the SDK's scope.
6+
- You opened this PR from a topic branch on YOUR fork
7+
(not directly on `main`).
8+
- The change is single-purpose. Split unrelated edits into separate PRs.
9+
10+
If you have not opened an issue yet for non-trivial changes, please
11+
do so first — a 5-minute design conversation up front saves a 5-day
12+
implementation that gets rejected.
13+
-->
14+
15+
## Summary
16+
17+
<!-- One or two sentences: what changed and why. -->
18+
19+
## Type of change
20+
21+
- [ ] Bug fix (non-breaking)
22+
- [ ] New feature (non-breaking)
23+
- [ ] Breaking change (renames, removed/changed exported names, behaviour change visible to SDK consumers)
24+
- [ ] Documentation only
25+
- [ ] CI / repository hygiene
26+
27+
## Related issues
28+
29+
<!-- e.g. "fixes #123", "refs #456". Use "fixes" only when this PR fully resolves the issue. -->
30+
31+
## What I tested
32+
33+
<!-- Local commands run, manual checks performed, hardware/printer combinations
34+
covered if pen-recognition behaviour is affected. -->
35+
36+
```
37+
go build ./... && go vet ./... && go test ./... && gofmt -l .
38+
```
39+
40+
- [ ] Output of the above is clean on my machine
41+
- [ ] New code paths have unit tests, or the PR description explains why a test isn't reasonable
42+
43+
## Cross-platform parity
44+
45+
- [ ] No `runtime.GOOS` branches added outside `pattern/neolab` (or, if added, justified in the PR description)
46+
- [ ] Builds on linux/amd64, linux/arm64, darwin/arm64, windows/amd64 (CI cross-build job will catch this; tick after CI passes)
47+
48+
## Public API impact
49+
50+
<!-- Required if any exported name in ncode/, pattern/, pattern/kernels/,
51+
pattern/neolab/, pattern/stub/, or pdf/ was added, removed, or
52+
changed. Otherwise leave blank. -->
53+
54+
- Added:
55+
- Removed:
56+
- Signature-changed:
57+
58+
## Licence acknowledgement
59+
60+
- [ ] I understand that my contribution is released under Apache-2.0 (see [`LICENSE`](../LICENSE))
61+
- [ ] I am aware that binaries built from this SDK incur an AGPL-3.0 transitive obligation via `go-fitz`/MuPDF, and my change does not silently introduce additional licence-incompatible dependencies
62+
63+
## Notes for the reviewer
64+
65+
<!-- Anything else worth knowing: known limitations, follow-up work, open
66+
questions, screenshots if UI/diagnostic output changed, etc. -->

.github/workflows/ci.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
8+
jobs:
9+
build-and-test:
10+
name: ${{ matrix.os }} / Go ${{ matrix.go }}
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
# go-fitz uses cgo + MuPDF; ubuntu-latest ships gcc & mesa headers.
16+
# macOS / windows runners are not validated as part of the CI
17+
# baseline because the production code path also requires Mono +
18+
# NeoLABNcodeSDK.dll, which CI cannot provision. Cross-build is
19+
# exercised in a separate job below.
20+
os: [ubuntu-latest]
21+
go: ["1.25"]
22+
steps:
23+
- uses: actions/checkout@v4
24+
- uses: actions/setup-go@v5
25+
with:
26+
go-version: ${{ matrix.go }}
27+
cache: true
28+
29+
- name: gofmt
30+
run: |
31+
out=$(gofmt -l .)
32+
if [ -n "$out" ]; then
33+
echo "::error::gofmt found unformatted files:"
34+
echo "$out"
35+
exit 1
36+
fi
37+
38+
- name: go vet
39+
run: go vet ./...
40+
41+
- name: go test
42+
run: go test ./... -timeout 5m
43+
44+
cross-build:
45+
name: cross-build / ${{ matrix.target }}
46+
runs-on: ubuntu-latest
47+
strategy:
48+
fail-fast: false
49+
matrix:
50+
# Compile-only cross-targets. Cgo is disabled here since the
51+
# baseline runner doesn't have cross toolchains for MuPDF; this
52+
# exercises the non-pdf packages on every supported GOOS/GOARCH.
53+
target:
54+
- linux/amd64
55+
- linux/arm64
56+
- darwin/arm64
57+
- windows/amd64
58+
steps:
59+
- uses: actions/checkout@v4
60+
- uses: actions/setup-go@v5
61+
with:
62+
go-version: "1.25"
63+
cache: true
64+
- name: build (no-cgo subset)
65+
env:
66+
TARGET: ${{ matrix.target }}
67+
CGO_ENABLED: "0"
68+
run: |
69+
os=${TARGET%/*}
70+
arch=${TARGET#*/}
71+
GOOS=$os GOARCH=$arch go build ./ncode/... ./pattern/... ./examples/discover-tickets/...

.gitignore

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Build artifacts
2+
*.exe
3+
*.dll
4+
bin/
5+
obj/
6+
7+
# Local secrets / configuration
8+
.env
9+
*.local
10+
config.local.json
11+
12+
# Generated PDFs / temp output
13+
generated/
14+
out/
15+
*.tmp.pdf
16+
17+
# Editor / OS
18+
.idea/
19+
.vscode/
20+
.DS_Store
21+
22+
# C# build output
23+
tools/ncode-cli/bin/
24+
tools/ncode-cli/obj/
25+
26+
# Go test caches
27+
*.test
28+
*.out
29+
coverage.txt
30+
31+
# go-fitz / cgo build temp
32+
*.dwarf

0 commit comments

Comments
 (0)