API reference
Every class, method and function of the NexPDF .NET MAUI SDK, grouped by feature. Generated from NexPDF 1.1.0.
Generated from NexPDF 1.1.0
This page is generated from the sources of Nexdevit.NexPdf.Maui. It lists 227 members. Options and results that are JSON strings use the same JSON in every NexPDF SDK. Module is the license module a call needs; calls marked "always available" work without a license key.
Setup and lifecycle
ActivateLicense
public static int ActivateLicense(string keyOrXml, string platform, string appId)Activates a license key or license.xml once per process. Returns 2 (licensed) or 1 (trial) and throws NexPdfException with the negative NexPdfException.Code otherwise. Without a license the SDK is view-only and rendered pages carry a watermark.
On NexPdfSdk (static) · always available · C nexpdf_license_activate
IsLicensed
public static bool IsLicensed(string module)Whether the active license unlocks module (annotations, forms, editor, security, redaction, signatures, conversion, ocr, standards).
On NexPdfSdk (static)
Platforms
public static readonly string[] PlatformsPlatforms a license can be bound to.
On NexPdfSdk (static) · always available · C nexpdf_version
Version
public static string VersionThe engine version.
On NexPdfSdk (static) · always available · C nexpdf_version
LastError
public static string? LastErrorThe last error on this thread, or null.
On NexPdfSdk (static)
OpenBytes
public static NexPdfDocument OpenBytes(byte[] data, string? password = null)Opens a PDF (or a JPEG/PNG/TIFF picture) from bytes; Word, Excel and PowerPoint files, EPUB / FictionBook / XPS books and CBZ comics are converted. password opens encrypted files.
On NexPdfDocument · always available · C nexpdf_open_bytes
Open
public static NexPdfDocument Open(string path, string? password = null)Opens a file; see OpenBytes.
On NexPdfDocument
FromHtml
public static NexPdfDocument FromHtml(string html)HTML to a new PDF (module: conversion).
On NexPdfDocument
OpenOffice
public static NexPdfDocument OpenOffice(byte[] data)Word / Excel / PowerPoint to a new PDF (module: conversion).
On NexPdfDocument
OpenEbook
public static NexPdfDocument OpenEbook(byte[] data)EPUB, FictionBook, XPS/OpenXPS or CBZ to a new PDF (module: conversion).
On NexPdfDocument · always available · C nexpdf_page_count
OpenImage
public static NexPdfDocument OpenImage(byte[] data)JPEG / PNG / TIFF to a new PDF, one page per picture.
On NexPdfDocument · always available · C nexpdf_page_count
OpenBytesWithPassword
public static NexPdfDocument OpenBytesWithPassword(byte[] data, string password)Number of pages.
On NexPdfDocument · always available · C nexpdf_page_count
Save
public void Save(string path, bool linearized = false)Writes the document; linearized writes a "Fast Web View" file.
On NexPdfDocument
Copy
public NexPdfDocument Copy()An independent copy (for undo snapshots or work on another thread).
On NexPdfDocument
PageView
public NexPdfPageView PageView(int page)How page is displayed and the transform between PDF and display coordinates.
On NexPdfDocument
AskDocumentJson
public string AskDocumentJson(string question, int k = 5, int maxChars = 0)Document assistant retrieval (offline): the k most relevant passages and a page-tagged context for a language model, as JSON {"passages":[…],"context":"…","context_pages":[…]}.
On NexPdfDocument · always available · C nexpdf_free
ToMarkdown
public string ToMarkdown()The document as Markdown.
On NexPdfDocument · always available · C nexpdf_free
Dispose
public void Dispose()Frees a document.
On NexPdfDocument · always available · C nexpdf_free
Plain
public static NexPdfPageView Plain(double width, double height)An unrotated page of width x height points with its origin at 0,0.
On NexPdfPageView
FromJson
public static NexPdfPageView FromJson(string json)On NexPdfPageView
ToView
public (double X, double Y) ToView(double x, double y, double scale = 1)PDF point to display pixels.
On NexPdfPageView
ToPdf
public (double X, double Y) ToPdf(double vx, double vy, double scale = 1)Display pixels (e.g. a tap) to a PDF point.
On NexPdfPageView
DeltaToPdf
public (double X, double Y) DeltaToPdf(double dx, double dy, double scale = 1)A displacement on screen (pixels) as a displacement in PDF space.
On NexPdfPageView
RectToView
public (double Left, double Top, double Right, double Bottom) RectToView(double llx, double lly, double urx, double ury, double scale = 1)PDF rect to the display rect (left, top, right, bottom) in pixels.
On NexPdfPageView
RectToPdf
public (double Llx, double Lly, double Urx, double Ury) RectToPdf(double x1, double y1, double x2, double y2, double scale = 1)Display rect (any two corners, pixels) to a PDF rect.
On NexPdfPageView
PageCount
public int PageCountNumber of pages.
On NexPdfDocument · always available · C nexpdf_page_count
IsDisposed
public bool IsDisposedOn NexPdfDocument
MAUI view and engine
MinZoom
public const double MinZoomOn PdfView
MaxZoom
public const double MaxZoomOn PdfView
DocumentBytes
public byte[]? DocumentBytesPDF bytes to show; setting it opens the document (with Password).
On PdfView
Password
public string? PasswordUser or owner password for encrypted PDFs (RC4, AES-128, AES-256); null for none. Set it before DocumentBytes, or after a PasswordRequired to retry.
On PdfView
PasswordRequired
public event EventHandler<PasswordRequiredEventArgs>? PasswordRequiredRaised when the document is encrypted and the password is missing (PasswordRequiredEventArgs.WrongPassword false) or wrong (true). LoadFailed is raised too.
On PdfView
PageChanged
public event EventHandler<int>? PageChangedRaised with the 0-based page index when the page at the top of the view changes.
On PdfView
LoadFailed
public event EventHandler<Exception>? LoadFailedRaised when a document fails to open.
On PdfView
PageCount
public int PageCountOn PdfView
CurrentPage
public int CurrentPageOn PdfView
Zoom
public double ZoomOn PdfView
Document
public NexPdfDocument? DocumentThe open document, for edits; call ReloadAsync after changing it.
On PdfView
LoadAsync
public Task LoadAsync(byte[] bytes)Opens a document from bytes (PDF, or pictures, Office files, EPUB / FictionBook / XPS books and CBZ comics the engine converts), with Password when it is encrypted.
On PdfView
IsPasswordError
public static bool IsPasswordError(Exception e)True when an open failed because the password was missing or wrong.
On PdfView
GoToPageAsync
public Task GoToPageAsync(int page, bool animated = true)Scrolls to a 0-based page.
On PdfView
SetZoom
public void SetZoom(double zoom)Sets the zoom (1 = page fits the view width).
On PdfView
Dispose
public void Dispose()On PdfView
WrongPassword
public bool WrongPasswordTrue when a password was given and it is wrong; false when none was given.
On PdfView
Platform
public static string PlatformThe platform id a license must be issued for on this device.
On NexPdfEngine (static) · always available · C nexpdf_license_activate
Activate
public static bool Activate(string license, string appId)Activates a license (key or XML). appId is the bundle id / package name. True for a commercial license (engine status 2) or a trial (1).
On NexPdfEngine (static) · always available · C nexpdf_license_activate
LastError
public static string? LastErrorThe error message of the last failed call, if any.
On NexPdfEngine (static) · always available · C nexpdf_last_error
Library and licensing
LicenseStatusJson
public static string LicenseStatusJson()The active license as JSON: state (unlicensed, trial or licensed), licensee, id, tier, modules, expires_at, days_left and watermark.
On NexPdfSdk (static) · always available · C nexpdf_license_status_json
Invoke
public static string Invoke(string? requestJson = null)The whole API behind one JSON call, for bridges that only pass strings: {"fn":"to_xlsx","args":[handle]} returns {"ok":true,"result":...} or {"ok":false,"error":"..."}. Documents are handle numbers and byte buffers base64.
On NexPdfSdk (static) · always available · C nexpdf_invoke
RegisterStandardFont
public static int RegisterStandardFont(byte[] data)Registers a Helvetica, Times or Courier compatible TrueType font (for example Liberation) used for non-embedded standard fonts and PDF/A. Needed only by builds without bundled fonts. 1 on success, 0 if the font is not such a font.
On NexPdfSdk (static) · always available · C nexpdf_register_standard_font
HasBundledFonts
public static int HasBundledFonts()1 when the Liberation fonts are compiled in, 0 in the lighter builds.
On NexPdfSdk (static) · always available · C nexpdf_has_bundled_fonts
Opening and saving
OpenBytesWithPassword
public static NexPdfDocument OpenBytesWithPassword(byte[] data, string? password = null)Opens an encrypted PDF with its user or owner password (RC4, AES-128, AES-256). Fails with "password required" or "incorrect password" when the password is the problem.
On NexPdfSdk (static) · always available · C nexpdf_open_bytes_with_password
FromHtml
public static NexPdfDocument FromHtml(string? html = null)Lays out HTML as a new PDF document.
On NexPdfSdk (static) · module conversion · C nexpdf_from_html
OpenOffice
public static NexPdfDocument OpenOffice(byte[] data)Converts Word, Excel or PowerPoint bytes (format detected) to a new PDF document.
On NexPdfSdk (static) · module conversion · C nexpdf_open_office
OpenEbook
public static NexPdfDocument OpenEbook(byte[] data)Converts EPUB, FictionBook (.fb2, .fb2.zip), XPS/OpenXPS or a CBZ comic archive to a new PDF document.
On NexPdfSdk (static) · module conversion · C nexpdf_open_ebook
OpenImage
public static NexPdfDocument OpenImage(byte[] data)Converts JPEG, PNG or TIFF bytes to a new PDF, one page per picture.
On NexPdfSdk (static) · always available · C nexpdf_open_image
SaveBytes
public byte[] SaveBytes()The document, with every change, as PDF bytes (full rewrite).
On NexPdfDocument · always available · C nexpdf_save_bytes
SaveLinearized
public byte[] SaveLinearized()A linearized ("Fast Web View") PDF: the first page shows before the download ends.
On NexPdfDocument · always available · C nexpdf_save_linearized
Pages and rendering
PageWidth
public double PageWidth(int pageIndex)Displayed page width in points (crop box, rotation and /UserUnit applied).
On NexPdfDocument · always available · C nexpdf_page_width
PageHeight
public double PageHeight(int pageIndex)Displayed page height in points (crop box, rotation and /UserUnit applied).
On NexPdfDocument · always available · C nexpdf_page_height
PageViewJson
public string PageViewJson(int pageIndex)How the page is displayed: width, height, rotation, user_unit, crop and the PDF-to-display matrix to_display.
On NexPdfDocument · always available · C nexpdf_page_view_json
RenderPagePng
public byte[] RenderPagePng(int pageIndex, double dpi)Renders a page to PNG at the given resolution (dots per inch). Unlicensed and trial renders carry a watermark.
On NexPdfDocument · always available · C nexpdf_render_page_png
RenderThumbPng
public byte[] RenderThumbPng(int pageIndex, uint maxDim)Renders a thumbnail PNG whose longer side is at most max_dim pixels.
On NexPdfDocument · always available · C nexpdf_render_thumb_png
SetOverprint
public int SetOverprint(int mode)Overprint simulation for later renders: 0 = PDF/X documents only (default), 1 = always, 2 = never.
On NexPdfDocument · always available · C nexpdf_set_overprint
Text, search and assistant
ExtractPageText
public string ExtractPageText(int pageIndex)The text of a page in reading order.
On NexPdfDocument · always available · C nexpdf_extract_page_text
ExtractMarkdown
public string ExtractMarkdown()The whole document as Markdown (headings, lists, tables).
On NexPdfDocument · always available · C nexpdf_extract_markdown
SearchJson
public string SearchJson(string? query = null)Finds a text in every page (case-insensitive). Returns a JSON array of hits: page, context and the rectangle llx, lly, urx, ury in PDF points.
On NexPdfDocument · always available · C nexpdf_search_json
PageBlocksJson
public string PageBlocksJson(int pageIndex)The text blocks of a page as JSON: text, font size and the rectangle llx, lly, urx, ury.
On NexPdfDocument · always available · C nexpdf_page_blocks_json
AskDocument
public string AskDocument(string? question, uint k, uint maxChars)Document assistant retrieval, offline (BM25): the k passages most relevant to a question and a page-tagged context of at most max_chars characters (0 = 200000) to send to a language model. Returns {"passages":[{"page","text","score"}],"context":"...","context_pages":[...]}.
On NexPdfDocument · always available · C nexpdf_ask_document
PageWordsJson
public string PageWordsJson(int pageIndex, string? optionsJson = null)The words of a page with exact boxes from the glyph widths and the text state: text, bbox, quad (follows rotated text), font, size, angle, line. {"glyphs":true} adds the glyph boxes.
On NexPdfDocument · always available · C nexpdf_page_words_json
Conversion
ToHtml
public string ToHtml()The document as HTML.
On NexPdfDocument · module conversion · C nexpdf_to_html
ToJson
public string ToJson()The document content as JSON.
On NexPdfDocument · module conversion · C nexpdf_to_json
ToXml
public string ToXml()The document content as XML.
On NexPdfDocument · module conversion · C nexpdf_to_xml
ToCsv
public string ToCsv()Tables of the document as CSV.
On NexPdfDocument · module conversion · C nexpdf_to_csv
ToRtf
public string ToRtf()The document as RTF.
On NexPdfDocument · module conversion · C nexpdf_to_rtf
ToDocx
public byte[] ToDocx()The document as a Word (.docx) file.
On NexPdfDocument · module conversion · C nexpdf_to_docx
ToXlsx
public byte[] ToXlsx()The document as an Excel workbook, one sheet per page.
On NexPdfDocument · module conversion · C nexpdf_to_xlsx
ToPptx
public byte[] ToPptx()The document as a PowerPoint presentation, one slide per page.
On NexPdfDocument · module conversion · C nexpdf_to_pptx
ToReflowHtml
public string ToReflowHtml(string? optionsJson = null)The text as responsive HTML for small screens. Options (may be omitted): {"pages":[0],"images":true,"full_page":true,"title":"..."}.
On NexPdfDocument · module conversion · C nexpdf_to_reflow_html
OpenXlsxWithClock
public static NexPdfDocument OpenXlsxWithClock(byte[] data, double clockUnixSeconds)Converts an Excel workbook with a fixed clock: NOW() and TODAY() in formulas without a cached value return the given Unix time (seconds, no time zone applied).
On NexPdfSdk (static) · module conversion · C nexpdf_open_xlsx_with_clock
OpenDocxWithOptionsJson
public static NexPdfDocument OpenDocxWithOptionsJson(byte[] data, string? optionsJson = null)Converts a Word document with options {"show_comments":false,"show_revisions":false}: comments in balloons in a markup area, and tracked changes drawn as markup instead of the final document.
On NexPdfSdk (static) · module conversion · C nexpdf_open_docx_with_options_json
Templates
TemplateDocxToPdf
public static NexPdfDocument TemplateDocxToPdf(byte[] templateBytes, string? dataJson = null, string? optionsJson = null)Fills a Word template with JSON data and converts it to a new PDF document. Options: {"strict":false,"locale":"en"}; with strict a missing field fails the call.
On NexPdfSdk (static) · module conversion · C nexpdf_template_docx_to_pdf
TemplateDocxFill
public static byte[] TemplateDocxFill(byte[] templateBytes, string? dataJson = null)Fills a Word template with JSON data and returns the new .docx bytes.
On NexPdfSdk (static) · module conversion · C nexpdf_template_docx_fill
TemplateHtmlToPdf
public static NexPdfDocument TemplateHtmlToPdf(string? htmlUtf8 = null, string? dataJson = null, string? optionsJson = null)Fills an HTML template with JSON data (values HTML-escaped, {{{raw}}} not) and lays it out as a new PDF document.
On NexPdfSdk (static) · module conversion · C nexpdf_template_html_to_pdf
TemplateFillPdf
public int TemplateFillPdf(string? dataJson = null, string? optionsJson = null)Fills a PDF template in place: AcroForm fields by name and placeholders in the page text. Options {"flatten","fields","text","strict","locale"}. Returns the number of fields and text lines filled.
On NexPdfDocument · module conversion · C nexpdf_template_fill_pdf
TemplateDocxFillWith
public static byte[] TemplateDocxFillWith(byte[] templateBytes, string? dataJson = null, string? optionsJson = null)Fills a Word template with JSON data and options {"strict","locale"}, and returns the new .docx bytes.
On NexPdfSdk (static) · module conversion · C nexpdf_template_docx_fill_with
Office editing
XlsxEdit
public static byte[] XlsxEdit(byte[] data, string? editsJson = null)Sets cells of an Excel workbook (numbers, text, booleans, formulas, or null to clear), recalculates every formula and the charts, and returns the new .xlsx bytes. JSON {"sheet","edits":[{"cell","value"}],"ranges":[{"start","rows"}],"recalculate"}.
On NexPdfSdk (static) · module conversion · C nexpdf_xlsx_edit
XlsxCellsJson
public static string XlsxCellsJson(byte[] data, string? optionsJson = null)The cells of an Excel workbook as JSON: per sheet, each cell with its type, value and formula. Options {"sheet","range","recalculate"}.
On NexPdfSdk (static) · module conversion · C nexpdf_xlsx_cells_json
DocxEdit
public static byte[] DocxEdit(byte[] data, string? opsJson = null)Applies operations to a Word document and returns the new .docx bytes: replace (across runs, headers and footers), set_text, insert and delete paragraphs.
On NexPdfSdk (static) · module conversion · C nexpdf_docx_edit
DocxParagraphsJson
public static string DocxParagraphsJson(byte[] data)The paragraphs of a Word document as JSON: index, style, text and whether each is in a table.
On NexPdfSdk (static) · module conversion · C nexpdf_docx_paragraphs_json
Structured extraction and barcodes
ExtractTablesJson
public string ExtractTablesJson(int pageIndex, string? optionsJson = null)Ruled and unruled tables of a page (every page when the index is negative) with cells, spans, CSV and Markdown. Options {"ruled","unruled","min_unruled_lines"}.
On NexPdfDocument · module conversion · C nexpdf_extract_tables_json
ExtractKeyValuesJson
public string ExtractKeyValuesJson(string? optionsJson = null)Label/value pairs from the layout and typed entities (dates, amounts, IBANs, e-mails, phones, VAT numbers) with normalised values. Options {"pages","date_order"}.
On NexPdfDocument · module conversion · C nexpdf_extract_key_values_json
ExtractionPromptJson
public string ExtractionPromptJson(string? schemaJson = null, string? optionsJson = null)A prompt (system, prompt, response_schema) for extracting a JSON schema with the language model of your choice. The engine makes no network calls.
On NexPdfDocument · module conversion · C nexpdf_extraction_prompt_json
ExtractionValidateJson
public string ExtractionValidateJson(string? schemaJson = null, string? answerJson = null)Validates and coerces a model answer against the schema and grounds each value on the pages: valid, value, errors, warnings, fields.
On NexPdfDocument · module conversion · C nexpdf_extraction_validate_json
ClassifyDocumentJson
public string ClassifyDocumentJson(string? labelsJson = null)Classifies the document into one of the given labels by keywords, with scores and a prompt for LLM classification.
On NexPdfDocument · module conversion · C nexpdf_classify_document_json
ReadBarcodesJson
public string ReadBarcodesJson(int pageIndex, string? optionsJson = null)Reads the barcodes of a page (every page when the index is negative): QR, Data Matrix, Aztec, PDF417, Code 128/39/93, EAN/UPC, ITF, Codabar and more, with positions in PDF points.
On NexPdfDocument · module conversion · C nexpdf_read_barcodes_json
ReadBarcodesImageJson
public static string ReadBarcodesImageJson(byte[] data, string? optionsJson = null)Reads the barcodes of a PNG or JPEG image, with positions in pixels.
On NexPdfSdk (static) · module conversion · C nexpdf_read_barcodes_image_json
AddBarcode
public int AddBarcode(int pageIndex, double llx, double lly, double urx, double ury, string? format = null, string? text = null)Draws text as a vector barcode (white background, quiet zone) into a rectangle of a page, in PDF points.
On NexPdfDocument · module editor · C nexpdf_add_barcode
AddBarcodeEx
public int AddBarcodeEx(int pageIndex, double llx, double lly, double urx, double ury, string? format = null, string? text = null, string? optionsJson = null)Draws a vector barcode with options {"human_readable":"auto"|"always"|"never","quiet_zone","background","color"}; auto prints the digits under EAN and UPC codes.
On NexPdfDocument · module editor · C nexpdf_add_barcode_ex
Annotations
AddAnnotation
public int AddAnnotation(int pageIndex, string? kind, string? colorHex, double opacity, string? contents, double llx, double lly, double urx, double ury)Adds an annotation. kind is a PDF annotation subtype such as Highlight, Underline, StrikeOut, Squiggly, Square, Circle, FreeText or Text; text markup is fitted to the lines under the rectangle. Colour is #RRGGBB, the rectangle is in PDF points.
On NexPdfDocument · module annotations · C nexpdf_add_annotation
AddInk
public int AddInk(int pageIndex, string? colorHex, double strokeWidth, double opacity, string? coords = null)Adds a freehand ink annotation. coords is "x,y;x,y;..." in PDF points.
On NexPdfDocument · module annotations · C nexpdf_add_ink
AddLine
public int AddLine(int pageIndex, string? kind, string? colorHex, double opacity, double strokeWidth, double x1, double y1, double x2, double y2)Adds a line or arrow (kind is Line or Arrow) from (x1, y1) to (x2, y2) in PDF points.
On NexPdfDocument · module annotations · C nexpdf_add_line
AnnotationsJson
public string AnnotationsJson(int pageIndex)The annotations of a page as JSON: num, gen, kind, color, contents and the rectangle.
On NexPdfDocument · always available · C nexpdf_annotations_json
RemoveAnnotation
public int RemoveAnnotation(int pageIndex, uint num, ushort generation)Removes the annotation with object number num and generation gen from a page.
On NexPdfDocument · module annotations · C nexpdf_remove_annotation
MoveAnnotation
public int MoveAnnotation(uint num, ushort generation, double dx, double dy)Moves an annotation by (dx, dy) PDF points.
On NexPdfDocument · module annotations · C nexpdf_move_annotation
SetAnnotationContents
public int SetAnnotationContents(uint num, ushort generation, string? contents = null)Replaces the text contents of an annotation.
On NexPdfDocument · module annotations · C nexpdf_set_annotation_contents
ExportXfdf
public string ExportXfdf()Exports every annotation as an XFDF document.
On NexPdfDocument · module annotations · C nexpdf_export_xfdf
ImportXfdf
public int ImportXfdf(string? xfdf = null)Imports annotations from an XFDF document.
On NexPdfDocument · module annotations · C nexpdf_import_xfdf
FlattenAnnotations
public int FlattenAnnotations(int pageIndex)Burns annotations into the page content. A negative page index flattens every page.
On NexPdfDocument · module annotations · C nexpdf_flatten_annotations
AddImageStamp
public int AddImageStamp(int page, double llx, double lly, double urx, double ury, byte[] rgba, uint width, uint height, double opacity)Adds a picture stamp annotation from RGBA pixels (transparency kept). 1 on success.
On NexPdfDocument · module annotations · C nexpdf_add_image_stamp
AddMeasurement
public string AddMeasurement(int page, string? json = null)Stores a measurement: {"kind":"distance|perimeter|area","points":[[x,y],...],"unit":"mm","per_point":0.3528,"label":"1:100","color":"#2f54d6"}. Returns {"num","gen","value","text"}.
On NexPdfDocument · module annotations · C nexpdf_add_measurement
MeasurementsJson
public string MeasurementsJson()The stored measurements as JSON.
On NexPdfDocument · always available · C nexpdf_measurements_json
AddFileAttachmentAnnot
public int AddFileAttachmentAnnot(int pageIndex, double x, double y, string? name, byte[] data, string? mime = null, string? description = null)Adds a paperclip annotation carrying a file; (x, y) is the top-left corner of the icon in PDF points.
On NexPdfDocument · module annotations · C nexpdf_add_file_attachment_annot
AddInkSignature
public int AddInkSignature(int pageIndex, string? colorHex, double strokeWidth, string? strokes = null)Adds a handwritten signature: an ink annotation with several strokes ("x,y;x,y|x,y;x,y", PDF points) and subject "Signature". Visual only; use a PAdES signature for a cryptographic one.
On NexPdfDocument · module annotations · C nexpdf_add_ink_signature
ReplyToAnnotation
public int ReplyToAnnotation(int pageIndex, uint num, ushort generation, string? author = null, string? text = null)Adds a reply by author to an annotation (or to another reply). Returns the reply object number (generation 0).
On NexPdfDocument · module annotations · C nexpdf_reply_to_annotation
AnnotationRepliesJson
public string AnnotationRepliesJson(int pageIndex, uint num, ushort generation)The thread under an annotation, oldest first: num, gen, in_reply_to, author, date, text, state, state_model.
On NexPdfDocument · module annotations · C nexpdf_annotation_replies_json
SetAnnotationState
public int SetAnnotationState(int pageIndex, uint num, ushort generation, string? author = null, string? state = null)Sets a review state (Accepted, Rejected, Cancelled, Completed, None) or marked state (Marked, Unmarked) as a hidden state reply. Returns its object number.
On NexPdfDocument · module annotations · C nexpdf_set_annotation_state
Forms
FormFieldsJson
public string FormFieldsJson()The form fields as JSON: name, kind, value, page, rectangle, read_only and required.
On NexPdfDocument · module forms · C nexpdf_form_fields_json
FillFormField
public int FillFormField(string? name = null, string? value = null)Sets a field value as a viewer would: the keystroke and validate scripts check the value, then every calculated field is recomputed. Check boxes take "true" or "false", list fields the option text.
On NexPdfDocument · module forms · C nexpdf_fill_form_field
SetSignatureAppearance
public int SetSignatureAppearance(string? name, byte[] rgba, uint width, uint height)Shows a drawn, typed or scanned signature (RGBA pixels) in a signature field without signing digitally; scaled to fit each widget and centred. A later digital signature replaces it.
On NexPdfDocument · module forms · C nexpdf_set_signature_appearance
AddFormField
public int AddFormField(int pageIndex, string? kind, string? name, double llx, double lly, double urx, double ury)Adds a form field named name in a rectangle of a page. kind: text (default), checkbox, radio, combobox, listbox, button, signature or barcode.
On NexPdfDocument · module forms · C nexpdf_add_form_field
FlattenForms
public int FlattenForms()Burns the form fields into the page content.
On NexPdfDocument · module forms · C nexpdf_flatten_forms
RecalculateForms
public int RecalculateForms()Runs every calculate script; returns how many fields changed.
On NexPdfDocument · module forms · C nexpdf_recalculate_forms
ExportFormJson
public string ExportFormJson()The field values as a JSON object.
On NexPdfDocument · module forms · C nexpdf_export_form_json
ImportFormJson
public int ImportFormJson(string? json = null)Fills fields from a JSON object of names and values.
On NexPdfDocument · module forms · C nexpdf_import_form_json
ExportFormFdf
public byte[] ExportFormFdf(string? pdfName = null)The field values as an FDF file; pdf_name is the file name recorded in it.
On NexPdfDocument · module forms · C nexpdf_export_form_fdf
ImportFormFdf
public int ImportFormFdf(byte[] data)Fills fields from an FDF file.
On NexPdfDocument · module forms · C nexpdf_import_form_fdf
ExportFormXfdf
public string ExportFormXfdf(string? pdfName = null)The field values as XFDF.
On NexPdfDocument · module forms · C nexpdf_export_form_xfdf
ImportFormXfdf
public int ImportFormXfdf(string? xfdf = null)Fills fields from XFDF.
On NexPdfDocument · module forms · C nexpdf_import_form_xfdf
XFA forms
XfaInfoJson
public string XfaInfoJson()Whether the document has XFA, whether it is dynamic, field and data counts and the XDP packets.
On NexPdfDocument · module forms · C nexpdf_xfa_info_json
XfaExportData
public string XfaExportData(string? format = null)The XFA data as xml (default) or flat json ({"path":"value"}). Fails when the document has no XFA.
On NexPdfDocument · module forms · C nexpdf_xfa_export_data
XfaImportData
public int XfaImportData(string? data = null, string? format = null)Imports XFA data: XML replaces the data, JSON sets the given values. Static forms get their AcroForm fields updated. Returns the number of values imported.
On NexPdfDocument · module forms · C nexpdf_xfa_import_data
XfaToAcroform
public int XfaToAcroform()Converts to a plain AcroForm PDF and removes XFA; dynamic forms are laid out into new pages and scripts run first. Text fields keep their formatted display value as /V. Returns the number of AcroForm fields.
On NexPdfDocument · module forms · C nexpdf_xfa_to_acroform
XfaFlatten
public int XfaFlatten()Converts and flattens the XFA form: a plain PDF with the values drawn. Returns the number of flattened widgets.
On NexPdfDocument · module forms · C nexpdf_xfa_flatten
XfaRemove
public int XfaRemove()Removes XFA and keeps the AcroForm fields and pages: 1 removed, 0 no XFA.
On NexPdfDocument · module forms · C nexpdf_xfa_remove
XfaToAcroformJson
public string XfaToAcroformJson(string? optionsJson = null)Converts to AcroForm with options {"scripts":true,"flatten":false} and returns a report: flattened, fields, pages, warnings and validation_errors (som, test, severity, message).
On NexPdfDocument · module forms · C nexpdf_xfa_to_acroform_json
XfaRunScriptsJson
public string XfaRunScriptsJson()Runs the initialize, calculate and validate scripts (FormCalc and JavaScript) and stores calculated values in the data: data_changed, warnings, validation_errors.
On NexPdfDocument · module forms · C nexpdf_xfa_run_scripts_json
RegisterFallbackFont
public static int RegisterFallbackFont(byte[] data)Registers a TrueType/OpenType font (or .ttc) for text the bundled fonts cannot show (CJK, Arabic and more) when XFA forms are laid out; the data is copied. 1, or -1.
On NexPdfSdk (static) · module forms · C nexpdf_register_fallback_font
Real-time collaboration
SyncExportJson
public string SyncExportJson(ulong sinceVersion)NexPDF Sync: every change (from any client) with a Lamport clock above since_version, as a nexpdf-sync/1 change set.
On NexPdfDocument · module annotations · C nexpdf_sync_export_json
SyncExportLocalJson
public string SyncExportLocalJson(ulong sinceVersion)NexPDF Sync: only this copy's own changes above since_version (what a client pushes); keep the returned clock for the next call.
On NexPdfDocument · module annotations · C nexpdf_sync_export_local_json
SyncApplyJson
public string SyncApplyJson(string? changesJson = null)NexPDF Sync: applies remote changes, last writer wins per record. Returns ok, clock, applied, ignored, conflicts and errors.
On NexPdfDocument · module annotations · C nexpdf_sync_apply_json
SyncSnapshotJson
public string SyncSnapshotJson()NexPDF Sync: every record with its version, base records and tombstones included.
On NexPdfDocument · module annotations · C nexpdf_sync_snapshot_json
SyncSetClientId
public int SyncSetClientId(string? clientId = null)NexPDF Sync: the client id this copy versions its changes under (1 to 64 characters of [A-Za-z0-9-_.:@]).
On NexPdfDocument · module annotations · C nexpdf_sync_set_client_id
Page editing
RotatePage
public int RotatePage(int pageIndex, int degrees)Rotates a page by a multiple of 90 degrees.
On NexPdfDocument · module editor · C nexpdf_rotate_page
DeletePage
public int DeletePage(int pageIndex)Deletes a page.
On NexPdfDocument · module editor · C nexpdf_delete_page
DuplicatePage
public int DuplicatePage(int pageIndex)Inserts a copy of a page after it.
On NexPdfDocument · module editor · C nexpdf_duplicate_page
AddBlankPage
public int AddBlankPage()Appends a blank page.
On NexPdfDocument · module editor · C nexpdf_add_blank_page
ReversePages
public int ReversePages()Reverses the page order.
On NexPdfDocument · module editor · C nexpdf_reverse_pages
MovePage
public int MovePage(int from, int to)Moves the page at from to index to.
On NexPdfDocument · module editor · C nexpdf_move_page
CropPage
public int CropPage(int pageIndex, double llx, double lly, double urx, double ury)Sets the crop box of a page (PDF points).
On NexPdfDocument · module editor · C nexpdf_crop_page
ExtractPages
public NexPdfDocument ExtractPages(uint[] indices)A new document made of the given pages (split).
On NexPdfDocument · module editor · C nexpdf_extract_pages
AppendDocument
public int AppendDocument(NexPdfDocument other)Appends the pages of another document (merge).
On NexPdfDocument · module editor · C nexpdf_append_document
InsertImagePages
public int InsertImagePages(int index, byte[] data)Inserts the pictures of a JPEG, PNG or TIFF file as pages before index (clamped; the page count appends). Returns the number of pages added.
On NexPdfDocument · always available · C nexpdf_insert_image_pages
SetPageBackground
public int SetPageBackground(string? optionsJson, byte[] rgb, uint width, uint height)Sets a page background: a colour and/or an RGB picture. Options: {"color":"#fbf4e2","fit":"cover|stretch|center","scale":1,"opacity":1,"pages":[]}. Returns the pages changed.
On NexPdfDocument · module editor · C nexpdf_set_page_background
RemovePageBackground
public int RemovePageBackground(string? pagesJson = null)Removes NexPDF backgrounds from the pages in pages_json ("[0,2]"), or from every page.
On NexPdfDocument · module editor · C nexpdf_remove_page_background
Content editing
PageContentJson
public string PageContentJson(int page)The text lines and images of a page as JSON: id, kind (text or image), text, rect, size, color, font, family, bold, italic. Ids stay valid until the next edit of that page.
On NexPdfDocument · module editor · C nexpdf_page_content_json
EditText
public int EditText(int page, string? id = null, string? changeJson = null)Edits a text line: {text?, size?, color?, dx?, dy?, family?, bold?, italic?}. Empty text deletes it.
On NexPdfDocument · module editor · C nexpdf_edit_text
AddPageText
public int AddPageText(int page, string? json = null)Adds editable page text: {text, x, y (baseline), size, color, family, bold, italic}.
On NexPdfDocument · module editor · C nexpdf_add_page_text
DeleteContent
public int DeleteContent(int page, string? id = null)Deletes a text line or an image of the page content.
On NexPdfDocument · module editor · C nexpdf_delete_content
TransformImage
public int TransformImage(int page, string? id, double llx, double lly, double urx, double ury)Moves or resizes an image to a rectangle (PDF points).
On NexPdfDocument · module editor · C nexpdf_transform_image
ReplaceImage
public int ReplaceImage(int page, string? id, byte[] rgb, uint width, uint height)Replaces an image with RGB pixels (width x height x 3 bytes).
On NexPdfDocument · module editor · C nexpdf_replace_image
EditTextBlock
public int EditTextBlock(int pageIndex, string? text, string? colorHex, double fontSize, int bold, int italic, int replaceExisting, double llx, double lly, double urx, double ury)Writes a text block into a rectangle with colour, size and style, optionally replacing the text already there.
On NexPdfDocument · module editor · C nexpdf_edit_text_block
Metadata, bookmarks, layers and attachments
MetadataJson
public string MetadataJson()The document information (title, author, subject, keywords, ...) as JSON.
On NexPdfDocument · always available · C nexpdf_metadata_json
SetMetadata
public int SetMetadata(string? title = null, string? author = null, string? subject = null, string? keywords = null)Sets the title, author, subject and keywords. Omitted (null) values keep the current one.
On NexPdfDocument · module editor · C nexpdf_set_metadata
OutlinesJson
public string OutlinesJson()The bookmarks as JSON: [{"title","page","children":[...]}].
On NexPdfDocument · always available · C nexpdf_outlines_json
SetOutlinesJson
public int SetOutlinesJson(string? json = null)Replaces the bookmarks with a JSON tree in the same shape.
On NexPdfDocument · module editor · C nexpdf_set_outlines_json
PageLabelsJson
public string PageLabelsJson()Page labels: {"labels":["i","ii","1"],"ranges":[{"start":0,"style":"roman","prefix":"","first":1}]}.
On NexPdfDocument · always available · C nexpdf_page_labels_json
SetPageLabelsJson
public int SetPageLabelsJson(string? json = null)Sets the page label ranges ([] removes the labels). Styles: decimal, roman, ROMAN, letters, LETTERS, none.
On NexPdfDocument · module editor · C nexpdf_set_page_labels_json
LayersJson
public string LayersJson()The optional content groups (layers): [{"num","gen","name","visible","printable"}].
On NexPdfDocument · always available · C nexpdf_layers_json
SetLayerVisible
public int SetLayerVisible(uint num, ushort generation, int visible)Shows or hides a layer.
On NexPdfDocument · always available · C nexpdf_set_layer_visible
AttachmentsJson
public string AttachmentsJson()The embedded files: [{"name","description","mime","size","page"}]; page is null for document-level files.
On NexPdfDocument · always available · C nexpdf_attachments_json
AttachmentData
public byte[] AttachmentData(string? name = null)The bytes of an embedded file.
On NexPdfDocument · always available · C nexpdf_attachment_data
AddAttachment
public int AddAttachment(string? name, byte[] data, string? mime = null, string? description = null)Embeds a file at document level.
On NexPdfDocument · module editor · C nexpdf_add_attachment
RemoveAttachment
public int RemoveAttachment(string? name = null)Removes an embedded file.
On NexPdfDocument · module editor · C nexpdf_remove_attachment
Encryption, watermarks and stamping
EncryptAes256
public int EncryptAes256(string? userPw = null, string? ownerPw = null)Encrypts with AES-256 using a user (open) password and an owner password.
On NexPdfDocument · module security · C nexpdf_encrypt_aes256
EncryptWithPermissions
public int EncryptWithPermissions(string? userPw, string? ownerPw, uint permissions)Encrypts with AES-256 and a permission mask: print 1, modify 2, copy 4, annotate 8, fill forms 16, assemble 32.
On NexPdfDocument · module security · C nexpdf_encrypt_with_permissions
SecurityJson
public string SecurityJson()The encryption state: {"encrypted","revision","owner","print","modify","copy","annotate","fill_forms","assemble"}.
On NexPdfDocument · always available · C nexpdf_security_json
RemovePassword
public int RemovePassword(string? password = null)Removes the protection. Needs owner access: the document was opened with the owner password, or pass it here.
On NexPdfDocument · module security · C nexpdf_remove_password
AddWatermark
public int AddWatermark(string? text = null)Stamps a text watermark on every page.
On NexPdfDocument · module security · C nexpdf_add_watermark
RemoveWatermarks
public int RemoveWatermarks()Removes the watermarks NexPDF added.
On NexPdfDocument · module security · C nexpdf_remove_watermarks
AddHeaderFooter
public int AddHeaderFooter(string? header, string? footer, double fontSize)Adds a header and/or footer to every page. {page} and {total} are replaced; a font size of 0 or less uses the default.
On NexPdfDocument · module security · C nexpdf_add_header_footer
AddBates
public int AddBates(string? prefix, ulong start, uint digits)Adds Bates numbering: prefix, first number and number of digits.
On NexPdfDocument · module security · C nexpdf_add_bates
Redaction
ApplyRedaction
public int ApplyRedaction(int pageIndex, double llx, double lly, double urx, double ury, int fillWhite)Permanently removes the text, images and annotations under a rectangle and paints an opaque box over it, black or white.
On NexPdfDocument · module redaction · C nexpdf_apply_redaction
RedactMatches
public int RedactMatches(string? query, int mode, int fillWhite)Finds and permanently redacts every match. mode: 0 = text, 1 = regular expression, 2 = pattern id (email, phone, credit-card, iban, pt-nif, us-ssn, ipv4, url, date). Returns the number of areas redacted.
On NexPdfDocument · module redaction · C nexpdf_redact_matches
Digital signatures
SignPades
public byte[] SignPades(string? signer = null, string? reason = null, string? location = null)Signs with a new self-signed test certificate (PAdES B-B) and returns the signed file. Write the bytes as they are: saving the document again breaks the signature.
On NexPdfDocument · module signatures · C nexpdf_sign_pades
SignPkcs12
public byte[] SignPkcs12(byte[] p12, string? password = null, string? optionsJson = null)Signs with a PKCS#12 (.p12/.pfx) identity and returns the signed file. Options: {"name","reason","location","contact","field","tsa_url","ltv":true,"appearance":{"page":0,"rect":[llx,lly,urx,ury],"ink":"x,y;x,y|...","text":"..."}}. Without a .p12 a self-signed certificate is created.
On NexPdfDocument · module signatures · C nexpdf_sign_pkcs12
Pkcs12InfoJson
public static string Pkcs12InfoJson(byte[] data, string? password = null)The certificate summary of a PKCS#12 file; fails with "incorrect password" on a wrong password.
On NexPdfSdk (static) · module signatures · C nexpdf_pkcs12_info_json
PrepareExternalSignature
public byte[] PrepareExternalSignature(byte[] cert, string? optionsJson = null)External signing (HSM, smart card, cloud KMS), step 1: a PDF with an empty signature for the signer certificate (PEM or DER, optionally followed by its chain). Options as for PKCS#12 signing.
On NexPdfDocument · module signatures · C nexpdf_prepare_external_signature
ExternalSignatureData
public static byte[] ExternalSignatureData(byte[] prepared, byte[] cert)External signing, step 2: the bytes to sign (DER signed attributes; sign their SHA-256 on devices that take a digest).
On NexPdfSdk (static) · module signatures · C nexpdf_external_signature_data
CompleteExternalSignature
public static byte[] CompleteExternalSignature(byte[] prepared, byte[] cert, byte[] signature, int algorithm, string? optionsJson = null)External signing, step 3: embeds the signature and returns the signed PDF. algorithm: 0 RSA PKCS#1 v1.5 SHA-256, 1 ECDSA SHA-256. Options: {"tsa_url":"...","ltv":true}.
On NexPdfSdk (static) · module signatures · C nexpdf_complete_external_signature
VerifySignaturesJson
public static string VerifySignaturesJson(byte[] data)Verifies every signature of a signed file (its exact bytes). Each entry has field, signer, subject, digest_ok, signature_ok, covers_whole_document, reason, signing_time, timestamp_ok, chain_ok, trusted, revocation, ltv, level and more.
On NexPdfSdk (static) · always available · C nexpdf_verify_signatures_json
VerifySignaturesWithRootsJson
public static string VerifySignaturesWithRootsJson(byte[] data, string? rootsPem = null)Verifies the signatures treating the PEM certificates in roots_pem as trust anchors.
On NexPdfSdk (static) · module signatures · C nexpdf_verify_signatures_with_roots_json
AddLtv
public static byte[] AddLtv(byte[] data)Adds long-term validation data (DSS with OCSP responses and CRLs) to a signed file.
On NexPdfSdk (static) · module signatures · C nexpdf_add_ltv
AddDocumentTimestamp
public byte[] AddDocumentTimestamp(string? optionsJson = null)Adds an RFC 3161 document timestamp from a TSA (PAdES B-LTA). Options: {"tsa_url" (required),"hash","field","reserved","ltv"}; with ltv the validation data of earlier signatures goes into the DSS first. Returns the new file.
On NexPdfDocument · module signatures · C nexpdf_add_document_timestamp
AddDocumentTimestampBytes
public static byte[] AddDocumentTimestampBytes(byte[] data, string? optionsJson = null)Adds a document timestamp to the bytes of a PDF file (for example straight from signing). Same options. Returns the new file.
On NexPdfSdk (static) · module signatures · C nexpdf_add_document_timestamp_bytes
PrepareDocumentTimestamp
public byte[] PrepareDocumentTimestamp(string? optionsJson = null)Document timestamp from your own TSA or HSM, step 1: the PDF with an empty timestamp (options as for adding one, without tsa_url).
On NexPdfDocument · module signatures · C nexpdf_prepare_document_timestamp
DocumentTimestampRequest
public static byte[] DocumentTimestampRequest(byte[] prepared, string? hash = null)Document timestamp, step 2: the DER TimeStampReq to send to the TSA as application/timestamp-query (hash SHA-256 by default).
On NexPdfSdk (static) · module signatures · C nexpdf_document_timestamp_request
CompleteDocumentTimestamp
public static byte[] CompleteDocumentTimestamp(byte[] prepared, byte[] token)Document timestamp, step 3: the timestamped PDF, from the prepared file and the TSA token (TimeStampResp or TimeStampToken).
On NexPdfSdk (static) · module signatures · C nexpdf_complete_document_timestamp
SignatureTimestampRequest
public static byte[] SignatureTimestampRequest(byte[] data, string? hash = null)B-T in steps: the DER TimeStampReq over the value of the last signature (SHA-256 by default), to POST to the TSA as application/timestamp-query.
On NexPdfSdk (static) · module signatures · C nexpdf_signature_timestamp_request
AddSignatureTimestamp
public static byte[] AddSignatureTimestamp(byte[] data, byte[] token)B-T in steps: stores the TSA answer (TimeStampResp or TimeStampToken) in the last signature, signed bytes unchanged, and returns the PDF.
On NexPdfSdk (static) · module signatures · C nexpdf_add_signature_timestamp
LtvRequestsJson
public static string LtvRequestsJson(byte[] data, string? responsesJson = null)B-LT in steps: the HTTP requests (OCSP, CRL, certificates) the validation data still needs, given the answers so far; [] when nothing is missing.
On NexPdfSdk (static) · module signatures · C nexpdf_ltv_requests_json
AddLtvWithResponses
public static byte[] AddLtvWithResponses(byte[] data, string? responsesJson = null)B-LT in steps: adds the /DSS from the fetched answers (missing ones count as failed) as an incremental update and returns the PDF.
On NexPdfSdk (static) · module signatures · C nexpdf_add_ltv_with_responses
ValidateLtaJson
public static string ValidateLtaJson(byte[] data, string? trustRootsPem = null)Full PAdES B-LTA validation: whether the /DSS of each time-stamped revision holds every certificate and verified OCSP or CRL entry the earlier signatures and time-stamps need. Returns complete and timestamps with their issues.
On NexPdfSdk (static) · module signatures · C nexpdf_validate_lta_json
PDF/A, PDF/X and PDF/UA
ConvertPdfa
public int ConvertPdfa()Converts the document to PDF/A (ISO 19005) for archiving.
On NexPdfDocument · module standards · C nexpdf_convert_pdfa
ConvertPdfx
public int ConvertPdfx()Converts the document to PDF/X for print exchange.
On NexPdfDocument · module standards · C nexpdf_convert_pdfx
AutoTag
public string AutoTag(string? lang, int force)Tags the document for accessibility (PDF/UA structure tree, language, title, metadata). lang is a BCP 47 tag (default en-US); force re-tags a document that is already tagged. Returns a JSON report.
On NexPdfDocument · module standards · C nexpdf_auto_tag
ValidatePdfaJson
public string ValidatePdfaJson(string? level = null)Rule-based PDF/A validation for 1a to 4f (the declared level, or 2b, when empty): compliant, level and failures with clause, message, page and object.
On NexPdfDocument · module standards · C nexpdf_validate_pdfa_json
ValidatePdfuaJson
public string ValidatePdfuaJson()PDF/UA validation (PDF/UA-1, or PDF/UA-2 when declared), with the same report as PDF/A validation.
On NexPdfDocument · module standards · C nexpdf_validate_pdfua_json
ConvertPdfaLevel
public int ConvertPdfaLevel(string? level = null)Converts to a chosen PDF/A level (2b when empty); level A tags the document first. 1 when the result validates; otherwise the error lists the clauses still failing.
On NexPdfDocument · module standards · C nexpdf_convert_pdfa_level
ConvertPdfaJson
public string ConvertPdfaJson(string? level, double flattenDpi, int substituteFonts)Converts to a PDF/A level (1a to 4f, 2b when empty) and returns the report: level, compliant, fixed, substitutions and remaining. flatten_dpi is the resolution PDF/A-1 transparency is flattened at (300 when 0 or less); substitute_fonts 0 leaves non-embedded fonts alone.
On NexPdfDocument · module standards · C nexpdf_convert_pdfa_json
ConvertPdfuaJson
public string ConvertPdfuaJson(int part, string? lang = null)Converts to PDF/UA-1 or PDF/UA-2 (part 1 or 2): tags an untagged document, embeds fonts and, for part 2, uses the PDF 2.0 namespaces. lang (en-US when empty) applies when the document has none. Returns profile, compliant, fixed, warnings, substitutions, remaining.
On NexPdfDocument · module standards · C nexpdf_convert_pdfua_json
ValidatePdfuaPartJson
public string ValidatePdfuaPartJson(int part)Validates against PDF/UA-1 or PDF/UA-2 (part 1 or 2) whatever the document declares, with the same report as PDF/UA validation.
On NexPdfDocument · module standards · C nexpdf_validate_pdfua_part_json
RegisterSubstituteFont
public static string RegisterSubstituteFont(byte[] data)Registers TrueType font data for PDF/A and PDF/UA font substitution: non-embedded fonts with the same PostScript or family name use it. Returns the PostScript name, or nothing when the data is not a TrueType font with glyf outlines.
On NexPdfSdk (static) · module standards · C nexpdf_register_substitute_font
OCR
Ocr
public string Ocr(string? optionsJson = null)Recognises scanned pages and adds an invisible, searchable text layer. Options (may be omitted): {"engine":"auto|builtin|tesseract|neural","languages":"por+eng","dpi":300,"pages":[0],"force":false}. Returns a JSON report.
On NexPdfDocument · module ocr · C nexpdf_ocr
OcrLoadModel
public static int OcrLoadModel(string? optionsJson, byte[] model, string? dictionary = null)Loads a neural OCR model (ONNX) at run time: {"kind":"detection"|"recognition"|"classification","languages","name","input_height","max_side"}; a recognition model needs its character dictionary, a detection model or a text-direction classifier (0°/180°) takes none.
On NexPdfSdk (static) · module ocr · C nexpdf_ocr_load_model
OcrModelsJson
public static string OcrModelsJson()The loaded OCR models: kind, name, languages, symbols, size.
On NexPdfSdk (static) · module ocr · C nexpdf_ocr_models_json
OcrUnloadModels
public static int OcrUnloadModels(string? languages = null)Unloads the OCR models of the given languages (all when empty). Returns the number removed.
On NexPdfSdk (static) · module ocr · C nexpdf_ocr_unload_models
Compare, optimise and memory
CompareJson
public string CompareJson(NexPdfDocument b, double dpi)Compares two documents (text and visual differences per page) at the given resolution, as JSON.
On NexPdfDocument · always available · C nexpdf_compare_json
CompareOverlayPng
public byte[] CompareOverlayPng(NexPdfDocument b, int pageIndex, double dpi)A PNG overlay of the visual differences of one page of two documents.
On NexPdfDocument · always available · C nexpdf_compare_overlay_png
Optimize
public string Optimize()Optimises the document (removes unused objects, recompresses streams); returns a JSON report.
On NexPdfDocument · module editor · C nexpdf_optimize
SubsetFonts
public string SubsetFonts()Subsets the embedded fonts to the glyphs the document uses; returns a JSON report.
On NexPdfDocument · module editor · C nexpdf_subset_fonts
TrimMemory
public long TrimMemory()Drops cached data of the document; returns the bytes freed.
On NexPdfDocument · always available · C nexpdf_trim_memory
MemoryUsageBytes
public long MemoryUsageBytes()Approximate memory used by the document, in bytes.
On NexPdfDocument · always available · C nexpdf_memory_usage_bytes
CompareTextJson
public string CompareTextJson(NexPdfDocument b, string? optionsJson = null)Word-level text comparison of two documents: inserted, deleted, replaced and moved text with positions, and a summary. Options {"ignore_case","ignore_punctuation","detect_moves","min_move_words","align","page_map"}.
On NexPdfDocument · always available · C nexpdf_compare_text_json
CompareAnnotate
public byte[] CompareAnnotate(NexPdfDocument b, string? optionsJson = null)The word-level comparison as a new PDF with highlight annotations (deleted red, inserted green, moved blue). Options add output, author and the colours.
On NexPdfDocument · always available · C nexpdf_compare_annotate
Other
SetAnnotationFlags
public int SetAnnotationFlags(uint num, ushort generation, string? flagsJson = null)Annotation flags (/F). flags_json: {"readonly":true,"print":false} changes only the flags it names; ["print","locked"] sets exactly these; a number is the bitmask. Names: invisible, hidden, print, nozoom, norotate, noview, readonly, locked, togglenoview, lockedcontents. XFDF import and export keep them (flags="print,readonly"). 1 on success.
On NexPdfDocument
SetAnnotationStyle
public int SetAnnotationStyle(uint num, ushort generation, string? styleJson = null)Colour, opacity and border width, then a new appearance: {"color":"#RRGGBB","opacity":0.5, "border_width":2}, every key optional (a missing key keeps the current value). 1 on success.
On NexPdfDocument