Class Formats
- All Implemented Interfaces:
AutoCloseable
A collection of data-format operations, starting with barcode and QR code generation.
Chilkat.Formats is not string, number or date display formatting. It groups operations
on
well-defined data formats behind a small number of JSON-driven methods, so the class can grow by
adding a
method per format family without adding a public class for each feature. Introduced in v11.7.0 with
the
barcode feature methods Barcode and QrCode.
QR Code generation
Versions 1–40, error-correction levels L/M/Q/H, automatic or explicit version and mask, numeric/alphanumeric/byte modes, ECI, structured append.
Precise rendering
Integer-pixel modules, px/mm/in/pt units with DPI, quiet zone, padding, rotation, colors with opacity, caption text, size limits with shrink-to-fit.
PNG or SVG output
Returned inline as base64 or SVG text, or written to files (numbered file sets for structured append). Optional module bit-matrix and reusable definition.
Measure and validate
measure reports exact geometry without rendering; validate checks a
request; capabilities describes what the build supports.
One calling convention: every operation is method(op, jsonIn,
jsonOut). Requests are
checked strictly (unknown options are rejected, not ignored) and every failure has a stable error
code with the
JSON Pointer of the offending member.
See the Barcode / QR Code Generation Overview for the complete documentation with examples and sample images.
</section>
Instances hold a native Chilkat object: close them with ChilkatObject.close() (try-with-resources) when
done; an unclosed instance is freed when it becomes unreachable.
- See Also:
- Online reference
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbarcode(String op, JsonObject jsonIn, JsonObject jsonOut)Runs one barcode operation and returns the result as JSON.voidqrCode(String op, JsonObject jsonIn, JsonObject jsonOut)The same asBarcodewith thesymbologydefaulting to"qr", so the smallest request is{ "payload": { "text": "..." } }.Methods inherited from class com.chilkatsoft.chilkat2.ChilkatObject
close, getDebugLogFilePath, getLastErrorHtml, getLastErrorText, getLastErrorXml, getLastMethodSuccess, getVerboseLogging, getVersion, isClosed, setDebugLogFilePath, setLastMethodSuccess, setVerboseLogging, toString
-
Constructor Details
-
Formats
public Formats()Creates a newFormatsobject.
-
-
Method Details
-
barcode
Runs one barcode operation and returns the result as JSON.opis the operation: "generate" (encode the payload, lay out the symbol and render a PNG or SVG), "measure" (encode and lay out only, reporting the exact geometry and whether the symbol fits), "validate" (examine a request's definition, capacity or layout) or "capabilities" (describe the symbologies, operations, formats and limits this build implements).jsonInis the request: it names thesymbology(currently"qr"), thepayload(text or base64 binary) and optionalencoding,render,outputandlimitsgroups.jsonOutis replaced with the response. Every response carrieserrors[]andwarnings[]; a successful "generate" also returnssymbols[](the encoding actually selected),measurements[](pixel geometry) andoutputs[](the image as base64 or SVG text, or the path of the file written).Returns
truewhen the operation completed successfully. Returnsfalsewhen the request was rejected or execution failed;errors[0]then holds a stablecode, the JSON Pointerpathof the offending request member and amessage.The request and response vocabulary (payload types, QR version, error correction, mask, ECI, structured append, module size and physical units, quiet zone, rotation, colors, captions, PNG/SVG output, file writing, limits and error codes) is documented in full, with examples and sample images, at the links below.
- Parameters:
op- theopargument (notnull)jsonIn- thejsonInargument (notnull)jsonOut- thejsonOutargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
qrCode
The same asBarcodewith thesymbologydefaulting to"qr", so the smallest request is{ "payload": { "text": "..." } }.opis the operation ("generate", "measure", "validate" or "capabilities"),jsonInthe request andjsonOutthe response. Identical requests toQrCodeandBarcodeproduce identical results; a request naming a symbology outside the QR family is rejected.Generates QR Code (Model 2) symbols in versions 1-40 with error-correction levels L, M, Q and H, automatic or explicit version and mask selection, numeric, alphanumeric and byte modes, optional ECI, and structured append of up to 16 symbols. Output is PNG or SVG, returned inline (base64 or SVG text) and/or written to files.
Returns
truewhen the operation completed successfully, otherwisefalsewith the reason inerrors[0]ofjsonOut(code, JSON Pointer path and message). See the links below for the complete documentation of every option, with examples and sample images.- Parameters:
op- theopargument (notnull)jsonIn- thejsonInargument (notnull)jsonOut- thejsonOutargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-