Convert documents on an offline server in C#

DocToolkit does not reach the network unless you ask it to. This guide covers what it skips, how the opt-in is controlled, and how to see a refused fetch, which is otherwise silent.

No socket by default

  • No conversion opens a socket by default.
  • A <link rel="stylesheet"> is not fetched. An <img src> that points at a URL is dropped, not downloaded.
  • This is not a configuration default that could drift. It is the absence of an outbound path except through one guarded loader.
  • 40 air-gap tests prove that no runtime network I/O happens.

Opting in to remote images

  • You can opt in per call or through DocToolkitOptions.
  • The guard is an allow-list, checked before any connection is attempted.
  • An address check follows. It refuses loopback, link-local and every private range.

A refused fetch is silent

  • A refused fetch is silent: the image is skipped and your document still succeeds.
  • Only the opt-in remote-image fetch is instrumented, with one ActivitySource and one Meter, both named Ank.DocToolkit.
  • The counter doctoolkit.remote_image.fetches counts attempts by outcome: ok, scheme_refused, host_not_allowed, blocked_address, http_error, too_large and failed.
  • If images are silently missing from your output, host_not_allowed and blocked_address are the two counters that tell you why.
  • Only the host is recorded, never the URL, because a query string routinely carries a signed token.

What it will not do

  • Remote images are the one opt-in. Offline is the default everywhere.
  • On an air-gapped host, every remote image is skipped this way, so a missing image is expected there.