Skip to main content

Crate document_svg

Crate document_svg 

Source
Expand description

Bounded conversion of PDF, Office, web, text, diagram, CAD/CAM/3D, simulation, raster, chart, table, and math documents to deterministic SVG pages, plus SVG transforms and reverse packaging into Office, CAD, diagram, data, and UI-code formats.

Use convert_path for normal file conversion. It detects supported inputs from their extensions or a bounded content prefix, writes one SVG per output page, and writes conversion.json beside the SVG files.

Use the public cad, ir and svg modules when working directly with CAD entities or constructing a page from custom drawing data.

Call svg_to_document with one SVG or a directory of SVG pages to package Office, draw.io, CAD/CAM/3D, simulation, diagram, table, math, image, or UI-code output. Office exports preserve page appearance; they do not reconstruct the source application’s paragraphs, cells, formulas, or editable shapes.

Re-exports§

pub use transform::TransformOptions;
pub use transform::transform_svg;

Modules§

cad
CAD / CAM / CAE / 3D / Simulation file format converters and SVG reverse-packaging.
chart
Chart and data visualization (Bar, Line, Pie), Page IR rendering, and CSV/data reverse extraction.
code
Code generation from SVG: React JSX/TSX, Vue 3 components, and CSS Data URIs.
diagram
Diagram parsing (Graphviz DOT and Mermaid), hierarchical layout, and reverse extraction.
document
HTML, EPUB, DocBook, DITA, HWPX, XMind, NIfTI, FITS, MRC, NetCDF, HDF5/CGNS, Exodus II, standalone JPEG 2000, EPS/PostScript, SQLite, Microsoft Access ACE/Jet headers, CIF/PDBx, MOL2, RDF Turtle, Protein Data Bank coordinates, FASTA/FASTQ sequences, GFF3/GTF/BED/VCF/SAM/WIG/MAF annotations, GenBank/EMBL/UniProt flat files, Newick/NEXUS phylogenetic trees, Stockholm/CLUSTAL alignments, RIS bibliographies, legacy Word Binary text, legacy Visio Binary metadata, Autodesk DWG header metadata, Rhino 3DM header metadata, Apple iWork package metadata, Flat OPC, AASX, FDF, XFDF, LandXML, MathML, XMP, XDP, SpreadsheetML, CML, RDF/XML, BCF, QIF, JSON, JSON-LD, OpenAPI/Swagger, AsyncAPI, JSON Schema, WSDL, OPML, RSS/Atom, Apple Property Lists, TEI P5, ALTO OCR, METS archive XML, MARCXML, MARC21 ISO 2709, MODS, PREMIS, IIIF Presentation, EAD, EAC-CPF, Dublin Core XML, ISO 19115/19139, S1000D, UBL, XBRL, STEP-XML, PLMXML, OpenSCAD, AMF, FDF, XFDF, LandXML, MathML, XMP, XDP, SpreadsheetML, CML, RDF/XML, BCF, XFDF, XFDF, LandXML, MathML, XMP, FDF, HAR, WARC, WACZ, Postman Collections, GraphQL SDL, Protocol Buffers, Kubernetes manifests, Docker Compose, JUnit-compatible XML reports, SARIF, Terraform JSON plans, CycloneDX BOMs, SPDX JSON/tag:value, JaCoCo/Cobertura coverage, LCOV tracefiles, JSON Patch, JSON Merge Patch, CSL-JSON, JSON Feed, CloudEvents JSON, HL7 FHIR JSON, Apache Avro JSON schemas/protocols, OpenTelemetry OTLP JSON, OCEL 2.0 JSON, JSON:API, CityGML, CityJSON, STIX JSON, TAXII JSON, ARFF, SYLK, DIF, GraphML, GEXF, XGMML, ReqIF requirements, XMI model interchange, MIME e-mail/Outlook MSG/MBOX/MHTML, iCalendar/vCalendar/vCard, DICOM images, Structured Reports and encapsulated PDF, V2000 MOL/SDF chemical structures and RXN diagrams, Microsoft Project XML schedules, BPMN/CMMN/DMN models, SubRip/WebVTT/TTML subtitles, XLIFF localization files, Jupyter/Quarto notebooks, reStructuredText, Org-mode, RTF, XPS, and OpenDocument text, table, presentation, and drawing files to bounded SVG vector pages.
ir
Output-independent page model used by all input converters.
math
LaTeX math formula parsing, box model layout, SVG rendering, and reverse extraction.
metafile
Standalone EMF and WMF (Windows Metafile) to SVG converter using emf-core.
qr
QR code and barcode vector SVG generation.
svg
Deterministic SVG serialization for the public crate::ir model.
table
Markdown and structured table parsing, grid layout, SVG rendering, and reverse extraction.
transform
SVG Transform: Post-processing and tailoring of SVG documents (minify, monochrome, responsive).
vectorize
Bounded PNG/JPEG/BMP/TIFF/WebP/Netpbm grayscale raster vectorization.

Structs§

ByteConversionReport
Document-level conversion details returned after all pages are emitted.
ByteConvertLimits
Output bounds for convert_bytes. These limits cover generated SVG and selectable/searchable text geometry; input, expanded ZIP parts, XML events, and page count are bounded by ConvertOptions.
ConversionReport
ConvertOptions
PageReport
ReverseOptions
ReverseReport
SvgPage
One self-contained SVG page produced by convert_bytes.
TextSpan
Approximate selectable/searchable text geometry associated with a page. Coordinates and transforms use SVG user units (points).

Enums§

Error
OpenXmlFormat
Former name of ReverseFormat, kept so existing callers still compile.
ReverseFormat
SourceFormat

Functions§

convert_bytes
Convert a supported document directly from memory and emit completed pages as soon as they are rendered. This API is designed for browser/WASM and server preview callers that should not need temporary files.
convert_path
svg_to_document
svg_to_openxml
Former name of svg_to_document, kept so existing callers still compile.

Type Aliases§

Result