[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"docs:ffi":3},{"versions":4,"version":29,"nav":32,"path":90,"page":129},[5,10,13,17,20,23,26],{"name":6,"label":7,"prefix":8,"channel":9},"1.3","1.3.0 (latest)","","latest",{"name":11,"label":12,"prefix":11,"channel":11},"next","next (main)",{"name":14,"label":15,"prefix":14,"channel":16},"1.2","1.2.1","old",{"name":18,"label":19,"prefix":18,"channel":16},"1.1","1.1.1",{"name":21,"label":22,"prefix":21,"channel":16},"1.0","1.0.0",{"name":24,"label":25,"prefix":24,"channel":16},"0.2","0.2.0",{"name":27,"label":28,"prefix":27,"channel":16},"0.1","0.1.0",{"name":6,"label":7,"prefix":8,"channel":9,"base":30,"ref":31},"\u002Fdocs","v1.3.0",[33,37,40,43,46,49,52,55,58,61,64,68,71,74,77,80,83,86,89,93,96,99,102,105,108,111,114,117,120,123,126],{"slug":34,"title":35,"group":36},"index","Overview","Guide",{"slug":38,"title":39,"group":36},"getting-started","Getting started",{"slug":41,"title":42,"group":36},"php","PHP API",{"slug":44,"title":45,"group":36},"laravel","Laravel",{"slug":47,"title":48,"group":36},"resources","Resources",{"slug":50,"title":51,"group":36},"deployment","Deployment",{"slug":53,"title":54,"group":36},"troubleshooting","Troubleshooting",{"slug":56,"title":57,"group":36},"from-wkhtmltopdf","Coming from wkhtmltopdf",{"slug":59,"title":60,"group":36},"stability","Stability and upgrades",{"slug":62,"title":63,"group":36},"ai-assistants","Docs for AI assistants",{"slug":65,"title":66,"group":67},"css","CSS reference","Reference",{"slug":69,"title":70,"group":67},"paged-media","Paged media",{"slug":72,"title":73,"group":67},"fonts","Fonts",{"slug":75,"title":76,"group":67},"extensions","Extensions",{"slug":78,"title":79,"group":67},"compatibility","Compatibility",{"slug":81,"title":82,"group":67},"pdf","The PDF",{"slug":84,"title":85,"group":67},"cli","Command line",{"slug":87,"title":88,"group":67},"rust","Rust library",{"slug":90,"title":91,"group":92},"ffi","C library (experimental)","Internals",{"slug":94,"title":95,"group":92},"protocol","Worker protocol",{"slug":97,"title":98,"group":92},"releasing","Releasing",{"slug":100,"title":101,"group":92},"adr","Architecture decisions",{"slug":103,"title":104,"group":92,"parent":101},"adr\u002F0001-record-architecture-decisions","1. Record architecture decisions",{"slug":106,"title":107,"group":92,"parent":101},"adr\u002F0002-rust-and-fragmentation-in-layout","2. Rust core with fragmentation inside layout",{"slug":109,"title":110,"group":92,"parent":101},"adr\u002F0003-css-parsing-and-own-selector-matching","3. lightningcss for parsing, own selector matching and cascade",{"slug":112,"title":113,"group":92,"parent":101},"adr\u002F0004-extensions-only-where-css-has-no-way","4. Extensions only where CSS has no way",{"slug":115,"title":116,"group":92,"parent":101},"adr\u002F0005-public-api-and-deprecations","5. Public API, semantic versioning and deprecations",{"slug":118,"title":119,"group":92,"parent":101},"adr\u002F0006-pages-that-grow-with-their-content","6. Pages that grow with their content",{"slug":121,"title":122,"group":92,"parent":101},"adr\u002F0007-layers-for-screen-and-print","7. Layers for screen and print, and form fields as an option",{"slug":124,"title":125,"group":92,"parent":101},"adr\u002F0008-c-library-experimental","8. An experimental C library beside the worker",{"slug":127,"title":128,"group":92,"parent":101},"adr\u002F0009-resources-in-batches","9. Resources in batches, fetching stays with the caller",{"title":91,"seoTitle":130,"seoDescription":131,"html":132,"headings":133,"editUrl":157,"sourceUrl":158,"markdownUrl":159,"prev":160,"next":161},"C library (experimental) · Fagus docs","crates\u002Ffagus-ffi builds Fagus as a C library: a shared library (libfagus_ffi.so, libfagus_ffi.dylib, fagus_ffi.dll) and a static one, with the header fagus.h.","\u003Ch1 id=\"c-library-experimental\">C library (experimental)\u003C\u002Fh1>\n\u003Cp>\u003Ccode>crates\u002Ffagus-ffi\u003C\u002Fcode> builds Fagus as a C library: a shared library (\u003Ccode>libfagus_ffi.so\u003C\u002Fcode>,\n\u003Ccode>libfagus_ffi.dylib\u003C\u002Fcode>, \u003Ccode>fagus_ffi.dll\u003C\u002Fcode>) and a static one, with the header\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fnforst\u002Ffagus\u002Fblob\u002Fmain\u002Fcrates\u002Ffagus-ffi\u002Finclude\u002Ffagus.h\">\u003Ccode>fagus.h\u003C\u002Fcode>\u003C\u002Fa>. It renders\ndocuments in the caller's process, for languages that call C through FFI, instead of the\n\u003Ca href=\"\u002Fdocs\u002Fprotocol\">worker process\u003C\u002Fa>.\u003C\u002Fp>\n\u003Cp>\u003Cstrong>Experimental.\u003C\u002Fstrong> The library is not part of the \u003Ca href=\"\u002Fdocs\u002Fstability\">stable API\u003C\u002Fa>: its functions and\noptions may change in any release, also a minor or a patch release, and \u003Ccode>fagus_abi()\u003C\u002Fcode> returns 0\nwhile that is so. The PHP package does not use it: for PHP, the package and its worker stay the\nsupported way, and once the worker runs, it renders as fast as the library (\u003Ca href=\"#speed\">Speed\u003C\u002Fa>).\nWhy the library is experimental, and what it leaves out, is in\n\u003Ca href=\"\u002Fdocs\u002Fadr\u002F0008-c-library-experimental\">ADR 8\u003C\u002Fa>.\u003C\u002Fp>\n\u003Ch2 id=\"get-it\">Get it\u003Ca class=\"f-doc-anchor\" href=\"#get-it\" aria-label=\"Link to this section\">#\u003C\u002Fa>\u003C\u002Fh2>\n\u003Cp>Each \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fnforst\u002Ffagus\u002Freleases\">release\u003C\u002Fa> since 1.0.0 has the library as\n\u003Ccode>fagus-ffi-&lt;target&gt;.tar.gz\u003C\u002Fcode> for Linux (\u003Ccode>x86_64-unknown-linux-gnu\u003C\u002Fcode>, \u003Ccode>aarch64-unknown-linux-gnu\u003C\u002Fcode>,\nglibc 2.17 or newer), macOS (\u003Ccode>x86_64-apple-darwin\u003C\u002Fcode>, \u003Ccode>aarch64-apple-darwin\u003C\u002Fcode>) and Windows\n(\u003Ccode>x86_64-pc-windows-msvc\u003C\u002Fcode>), with the header \u003Ccode>fagus.h\u003C\u002Fcode> and the licenses. Its SHA-256 is in\n\u003Ccode>SHA256SUMS\u003C\u002Fcode>, and \u003Ccode>gh attestation verify fagus-ffi-&lt;target&gt;.tar.gz --repo nforst\u002Ffagus\u003C\u002Fcode> checks\nthat the release workflow built it. There is none for musl (Alpine): build it there.\u003C\u002Fp>\n\u003Cp>To build it yourself, from a checkout of the release:\u003C\u002Fp>\n\u003Cdiv class=\"f-doc-code\">\u003Cdiv class=\"f-doc-code-bar\">\u003Cspan>sh\u003C\u002Fspan>\u003Cbutton type=\"button\" class=\"f-doc-copy\" data-copy aria-label=\"Copy code\">\u003Csvg xmlns=\"http:\u002F\u002Fwww.w3.org\u002F2000\u002Fsvg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">\u003Crect width=\"14\" height=\"14\" x=\"8\" y=\"8\" rx=\"2\"\u002F>\u003Cpath d=\"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\"\u002F>\u003C\u002Fsvg>\u003Cspan>Copy\u003C\u002Fspan>\u003C\u002Fbutton>\u003C\u002Fdiv>\u003Cpre class=\"shiki github-dark-default\" style=\"background-color:#0d1117;color:#e6edf3\" tabindex=\"0\">\u003Ccode>\u003Cspan class=\"line\" style=\"padding-left:2ch;text-indent:-2ch\">\u003Cspan style=\"color:#FFA657\">cargo\u003C\u002Fspan>\u003Cspan style=\"color:#A5D6FF\"> build\u003C\u002Fspan>\u003Cspan style=\"color:#79C0FF\"> --release\u003C\u002Fspan>\u003Cspan style=\"color:#79C0FF\"> -p\u003C\u002Fspan>\u003Cspan style=\"color:#A5D6FF\"> fagus-ffi\u003C\u002Fspan>\u003C\u002Fspan>\u003C\u002Fcode>\u003C\u002Fpre>\u003C\u002Fdiv>\n\u003Cp>This needs Rust 1.97 or newer and writes \u003Ccode>target\u002Frelease\u002Flibfagus_ffi.so\u003C\u002Fcode> (\u003Ccode>.dylib\u003C\u002Fcode> on macOS,\n\u003Ccode>fagus_ffi.dll\u003C\u002Fcode> with \u003Ccode>fagus_ffi.dll.lib\u003C\u002Fcode> on Windows) and the static \u003Ccode>libfagus_ffi.a\u003C\u002Fcode>\n(\u003Ccode>fagus_ffi.lib\u003C\u002Fcode>). On musl, build the shared library with\n\u003Ccode>RUSTFLAGS=&quot;-C target-feature=-crt-static&quot;\u003C\u002Fcode>. The header is \u003Ccode>crates\u002Ffagus-ffi\u002Finclude\u002Ffagus.h\u003C\u002Fcode>.\u003C\u002Fp>\n\u003Ch2 id=\"render-a-document\">Render a document\u003Ca class=\"f-doc-anchor\" href=\"#render-a-document\" aria-label=\"Link to this section\">#\u003C\u002Fa>\u003C\u002Fh2>\n\u003Cp>A document is the render request of the \u003Ca href=\"\u002Fdocs\u002Fprotocol#rendering\">worker protocol\u003C\u002Fa>: the JSON header\nof \u003Ccode>R\u003C\u002Fcode>, with \u003Ccode>blobs\u003C\u002Fcode> for the lengths of its data blocks, and the data blocks one after another.\nThe answer is the header of \u003Ccode>P\u003C\u002Fcode> or \u003Ccode>E\u003C\u002Fcode> as JSON, and the PDF. So the options are those of the\nprotocol, with the same names and defaults.\u003C\u002Fp>\n\u003Cdiv class=\"f-doc-code\">\u003Cdiv class=\"f-doc-code-bar\">\u003Cspan>c\u003C\u002Fspan>\u003Cbutton type=\"button\" class=\"f-doc-copy\" data-copy aria-label=\"Copy code\">\u003Csvg xmlns=\"http:\u002F\u002Fwww.w3.org\u002F2000\u002Fsvg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">\u003Crect width=\"14\" height=\"14\" x=\"8\" y=\"8\" rx=\"2\"\u002F>\u003Cpath d=\"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\"\u002F>\u003C\u002Fsvg>\u003Cspan>Copy\u003C\u002Fspan>\u003C\u002Fbutton>\u003C\u002Fdiv>\u003Cpre class=\"shiki github-dark-default\" style=\"background-color:#0d1117;color:#e6edf3\" tabindex=\"0\">\u003Ccode>\u003Cspan class=\"line\" style=\"padding-left:2ch;text-indent:-2ch\">\u003Cspan>#include &#x3C;stdio.h>\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\" style=\"padding-left:2ch;text-indent:-2ch\">\u003Cspan>#include &#x3C;string.h>\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\" style=\"padding-left:2ch;text-indent:-2ch\">\u003Cspan>#include \"fagus.h\"\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\" style=\"padding-left:2ch;text-indent:-2ch\">\u003Cspan>\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\" style=\"padding-left:2ch;text-indent:-2ch\">\u003Cspan>int main(void) {\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\" style=\"padding-left:6ch;text-indent:-6ch\">\u003Cspan>    char *error = NULL;\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\" style=\"padding-left:6ch;text-indent:-6ch\">\u003Cspan>    FagusEngine *engine = fagus_engine_new(NULL, 0, &#x26;error);   \u002F* the default options *\u002F\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\" style=\"padding-left:6ch;text-indent:-6ch\">\u003Cspan>    if (engine == NULL) {\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\" style=\"padding-left:10ch;text-indent:-10ch\">\u003Cspan>        fprintf(stderr, \"%s\\n\", error);\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\" style=\"padding-left:10ch;text-indent:-10ch\">\u003Cspan>        fagus_string_free(error);\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\" style=\"padding-left:10ch;text-indent:-10ch\">\u003Cspan>        return 1;\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\" style=\"padding-left:6ch;text-indent:-6ch\">\u003Cspan>    }\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\" style=\"padding-left:6ch;text-indent:-6ch\">\u003Cspan>    const char *html = \"&#x3C;h1>Rechnung&#x3C;\u002Fh1>\";\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\" style=\"padding-left:6ch;text-indent:-6ch\">\u003Cspan>    char request[256];\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\" style=\"padding-left:6ch;text-indent:-6ch\">\u003Cspan>    snprintf(request, sizeof request,\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\" style=\"padding-left:15ch;text-indent:-15ch\">\u003Cspan>             \"{\\\"id\\\":1,\\\"html\\\":0,\\\"base\\\":\\\"\u002Fapp\u002Ftemplates\\\",\\\"blobs\\\":[%zu]}\", strlen(html));\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\" style=\"padding-left:6ch;text-indent:-6ch\">\u003Cspan>    FagusResult *result = fagus_render(engine, request, strlen(request), html, strlen(html));\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\" style=\"padding-left:6ch;text-indent:-6ch\">\u003Cspan>    size_t length;\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\" style=\"padding-left:6ch;text-indent:-6ch\">\u003Cspan>    if (fagus_result_ok(result)) {\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\" style=\"padding-left:10ch;text-indent:-10ch\">\u003Cspan>        const uint8_t *pdf = fagus_result_pdf(result, &#x26;length);\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\" style=\"padding-left:10ch;text-indent:-10ch\">\u003Cspan>        FILE *file = fopen(\"invoice.pdf\", \"wb\");\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\" style=\"padding-left:10ch;text-indent:-10ch\">\u003Cspan>        fwrite(pdf, 1, length, file);\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\" style=\"padding-left:10ch;text-indent:-10ch\">\u003Cspan>        fclose(file);\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\" style=\"padding-left:6ch;text-indent:-6ch\">\u003Cspan>    } else {\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\" style=\"padding-left:10ch;text-indent:-10ch\">\u003Cspan>        \u002F* {\"id\":1,\"message\":\"…\",\"diagnostics\":[…]} *\u002F\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\" style=\"padding-left:10ch;text-indent:-10ch\">\u003Cspan>        fprintf(stderr, \"%s\\n\", fagus_result_header(result, &#x26;length));\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\" style=\"padding-left:6ch;text-indent:-6ch\">\u003Cspan>    }\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\" style=\"padding-left:6ch;text-indent:-6ch\">\u003Cspan>    fagus_result_free(result);\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\" style=\"padding-left:6ch;text-indent:-6ch\">\u003Cspan>    fagus_engine_free(engine);\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\" style=\"padding-left:6ch;text-indent:-6ch\">\u003Cspan>    return 0;\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\" style=\"padding-left:2ch;text-indent:-2ch\">\u003Cspan>}\u003C\u002Fspan>\u003C\u002Fspan>\u003C\u002Fcode>\u003C\u002Fpre>\u003C\u002Fdiv>\n\u003Cp>Link it with \u003Ccode>-lfagus_ffi\u003C\u002Fcode>. An engine keeps its fonts and caches for every document, as a worker\ndoes, so make one and keep it. It may render documents on several threads at once.\u003C\u002Fp>\n\u003Ctable class=\"f-doc-table f-stack-table\">\n\u003Cthead>\n\u003Ctr>\n\u003Cth>Function\u003C\u002Fth>\n\u003Cth>Does\u003C\u002Fth>\n\u003C\u002Ftr>\n\u003C\u002Fthead>\n\u003Ctbody>\n\u003Ctr>\n\u003Ctd>\u003Ccode>fagus_version()\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd data-label=\"Does\">The version of Fagus, such as \u003Ccode>1.0.0\u003C\u002Fcode>\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>\u003Ccode>fagus_abi()\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd data-label=\"Does\">The version of this interface: 0 while it is experimental\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>\u003Ccode>fagus_protocol()\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd data-label=\"Does\">The worker protocol whose requests it takes: 1\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>\u003Ccode>fagus_engine_new(options, len, &amp;error)\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd data-label=\"Does\">A new engine, or NULL and a message in \u003Ccode>error\u003C\u002Fcode>\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>\u003Ccode>fagus_engine_free(engine)\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd data-label=\"Does\">Ends an engine that renders nothing at the time\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>\u003Ccode>fagus_render(engine, request, len, data, len)\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd data-label=\"Does\">Renders a request; never NULL\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>\u003Ccode>fagus_result_ok(result)\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd data-label=\"Does\">1 for a PDF, 0 for an error\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>\u003Ccode>fagus_result_header(result, &amp;len)\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd data-label=\"Does\">The header of \u003Ccode>P\u003C\u002Fcode> or \u003Ccode>E\u003C\u002Fcode>: JSON, ending with NUL\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>\u003Ccode>fagus_result_pdf(result, &amp;len)\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd data-label=\"Does\">The PDF, or NULL for an error\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>\u003Ccode>fagus_result_free(result)\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd data-label=\"Does\">Gives the answer back, with its header and PDF\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>\u003Ccode>fagus_string_free(error)\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd data-label=\"Does\">Gives a message of \u003Ccode>fagus_engine_new\u003C\u002Fcode> back\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003C\u002Ftbody>\n\u003C\u002Ftable>\n\u003Cp>Every function checks its pointers for NULL and catches panics, which come back as errors\n(\u003Ccode>internal error: …\u003C\u002Fcode>); none of them ends the process on bad input. Memory the library hands out\nis given back with the function for it, never with \u003Ccode>free()\u003C\u002Fcode>.\u003C\u002Fp>\n\u003Ch3 id=\"options-of-the-engine\">Options of the engine\u003Ca class=\"f-doc-anchor\" href=\"#options-of-the-engine\" aria-label=\"Link to this section\">#\u003C\u002Fa>\u003C\u002Fh3>\n\u003Cp>\u003Ccode>fagus_engine_new\u003C\u002Fcode> takes JSON with the options of \u003Ca href=\"\u002Fdocs\u002Fcli#the-worker\">\u003Ccode>fagus worker\u003C\u002Fcode>\u003C\u002Fa>, or NULL\nfor the defaults. An option it does not know is refused, so that a misspelt one does not go\nunnoticed.\u003C\u002Fp>\n\u003Ctable class=\"f-doc-table f-stack-table\">\n\u003Cthead>\n\u003Ctr>\n\u003Cth>Option\u003C\u002Fth>\n\u003Cth>Default\u003C\u002Fth>\n\u003Cth>Description\u003C\u002Fth>\n\u003C\u002Ftr>\n\u003C\u002Fthead>\n\u003Ctbody>\n\u003Ctr>\n\u003Ctd>\u003Ccode>fontDirs\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd data-label=\"Default\">none\u003C\u002Ftd>\n\u003Ctd data-label=\"Description\">Directories with font files\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>\u003Ccode>systemFonts\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd data-label=\"Default\">\u003Ccode>false\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd data-label=\"Description\">Use the fonts installed on the machine too\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>\u003Ccode>locale\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd data-label=\"Default\">none\u003C\u002Ftd>\n\u003Ctd data-label=\"Description\">The language of the texts of form controls, such as \u003Ccode>&quot;de-DE&quot;\u003C\u002Fcode>\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>\u003Ccode>sansSerif\u003C\u002Fcode>, \u003Ccode>serif\u003C\u002Fcode>, \u003Ccode>monospace\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd data-label=\"Default\">none\u003C\u002Ftd>\n\u003Ctd data-label=\"Description\">The families of the generic families\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>\u003Ccode>memoryBudget\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd data-label=\"Default\">2 GiB\u003C\u002Ftd>\n\u003Ctd data-label=\"Description\">The \u003Ca href=\"\u002Fdocs\u002Fcli#limits\">memory budget\u003C\u002Fa> of each document in bytes, unless a request sets its own; \u003Ccode>0\u003C\u002Fcode> for none\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>\u003Ccode>timeLimit\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd data-label=\"Default\">none\u003C\u002Ftd>\n\u003Ctd data-label=\"Description\">The \u003Ca href=\"\u002Fdocs\u002Fcli#limits\">time limit\u003C\u002Fa> of each document in milliseconds, unless a request sets its own; \u003Ccode>0\u003C\u002Fcode> for none\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003C\u002Ftbody>\n\u003C\u002Ftable>\n\u003Ch3 id=\"what-the-library-leaves-out\">What the library leaves out\u003Ca class=\"f-doc-anchor\" href=\"#what-the-library-leaves-out\" aria-label=\"Link to this section\">#\u003C\u002Fa>\u003C\u002Fh3>\n\u003Cp>The library asks its caller nothing while it renders. A request with \u003Ccode>ask: true\u003C\u002Fcode>, or with a\n\u003Ccode>signature\u003C\u002Fcode> that has \u003Ccode>certificates\u003C\u002Fcode>, \u003Ccode>timestamp\u003C\u002Fcode> or \u003Ccode>revocation\u003C\u002Fcode>, is answered with an error\n(\u003Ccode>`ask` needs a caller that answers questions, and there is none\u003C\u002Fcode>); \u003Ccode>askMany\u003C\u002Fcode> alone has no\neffect. Resources come from the\nrequest's \u003Ccode>resources\u003C\u002Fcode>, as \u003Ccode>data:\u003C\u002Fcode> URLs or as files of \u003Ccode>base\u003C\u002Fcode> and \u003Ccode>root\u003C\u002Fcode>; signatures with a PKCS#12\nfile work. The answer has no \u003Ccode>rss\u003C\u002Fcode> and \u003Ccode>maxRss\u003C\u002Fcode>: the memory is that of your own process.\u003C\u002Fp>\n\u003Ch2 id=\"from-php\">From PHP\u003Ca class=\"f-doc-anchor\" href=\"#from-php\" aria-label=\"Link to this section\">#\u003C\u002Fa>\u003C\u002Fh2>\n\u003Cp>PHP's \u003Ca href=\"https:\u002F\u002Fwww.php.net\u002Fmanual\u002Fen\u002Fbook.ffi.php\">FFI extension\u003C\u002Fa> loads the library. \u003Ccode>FFI::cdef()\u003C\u002Fcode>\ntakes the declarations of the header without its comments and preprocessor lines;\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fnforst\u002Ffagus\u002Fblob\u002Fmain\u002Ftools\u002Fffi.php\">\u003Ccode>tools\u002Fffi.php\u003C\u002Fcode>\u003C\u002Fa> does that and calls\nevery function.\u003C\u002Fp>\n\u003Cdiv class=\"f-doc-code\">\u003Cdiv class=\"f-doc-code-bar\">\u003Cspan>php\u003C\u002Fspan>\u003Cbutton type=\"button\" class=\"f-doc-copy\" data-copy aria-label=\"Copy code\">\u003Csvg xmlns=\"http:\u002F\u002Fwww.w3.org\u002F2000\u002Fsvg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">\u003Crect width=\"14\" height=\"14\" x=\"8\" y=\"8\" rx=\"2\"\u002F>\u003Cpath d=\"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\"\u002F>\u003C\u002Fsvg>\u003Cspan>Copy\u003C\u002Fspan>\u003C\u002Fbutton>\u003C\u002Fdiv>\u003Cpre class=\"shiki github-dark-default\" style=\"background-color:#0d1117;color:#e6edf3\" tabindex=\"0\">\u003Ccode>\u003Cspan class=\"line\" style=\"padding-left:2ch;text-indent:-2ch\">\u003Cspan style=\"color:#E6EDF3\">$ffi \u003C\u002Fspan>\u003Cspan style=\"color:#FF7B72\">=\u003C\u002Fspan>\u003Cspan style=\"color:#79C0FF\"> FFI\u003C\u002Fspan>\u003Cspan style=\"color:#FF7B72\">::\u003C\u002Fspan>\u003Cspan style=\"color:#D2A8FF\">cdef\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">($declarations, \u003C\u002Fspan>\u003Cspan style=\"color:#A5D6FF\">'\u002Fopt\u002Ffagus\u002Flibfagus_ffi.so'\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">);\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\" style=\"padding-left:2ch;text-indent:-2ch\">\u003Cspan style=\"color:#E6EDF3\">$engine \u003C\u002Fspan>\u003Cspan style=\"color:#FF7B72\">=\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\"> $ffi\u003C\u002Fspan>\u003Cspan style=\"color:#FF7B72\">->\u003C\u002Fspan>\u003Cspan style=\"color:#D2A8FF\">fagus_engine_new\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">(\u003C\u002Fspan>\u003Cspan style=\"color:#79C0FF\">null\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">, \u003C\u002Fspan>\u003Cspan style=\"color:#79C0FF\">0\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">, \u003C\u002Fspan>\u003Cspan style=\"color:#79C0FF\">null\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">);\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\" style=\"padding-left:2ch;text-indent:-2ch\">\u003C\u002Fspan>\n\u003Cspan class=\"line\" style=\"padding-left:2ch;text-indent:-2ch\">\u003Cspan style=\"color:#E6EDF3\">$request \u003C\u002Fspan>\u003Cspan style=\"color:#FF7B72\">=\u003C\u002Fspan>\u003Cspan style=\"color:#79C0FF\"> json_encode\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">([\u003C\u002Fspan>\u003Cspan style=\"color:#A5D6FF\">'id'\u003C\u002Fspan>\u003Cspan style=\"color:#FF7B72\"> =>\u003C\u002Fspan>\u003Cspan style=\"color:#79C0FF\"> 1\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">, \u003C\u002Fspan>\u003Cspan style=\"color:#A5D6FF\">'html'\u003C\u002Fspan>\u003Cspan style=\"color:#FF7B72\"> =>\u003C\u002Fspan>\u003Cspan style=\"color:#79C0FF\"> 0\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">, \u003C\u002Fspan>\u003Cspan style=\"color:#A5D6FF\">'base'\u003C\u002Fspan>\u003Cspan style=\"color:#FF7B72\"> =>\u003C\u002Fspan>\u003Cspan style=\"color:#A5D6FF\"> '\u002Fapp\u002Ftemplates'\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">, \u003C\u002Fspan>\u003Cspan style=\"color:#A5D6FF\">'blobs'\u003C\u002Fspan>\u003Cspan style=\"color:#FF7B72\"> =>\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\"> [\u003C\u002Fspan>\u003Cspan style=\"color:#79C0FF\">strlen\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">($html)]]);\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\" style=\"padding-left:2ch;text-indent:-2ch\">\u003Cspan style=\"color:#E6EDF3\">$result \u003C\u002Fspan>\u003Cspan style=\"color:#FF7B72\">=\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\"> $ffi\u003C\u002Fspan>\u003Cspan style=\"color:#FF7B72\">->\u003C\u002Fspan>\u003Cspan style=\"color:#D2A8FF\">fagus_render\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">($engine, $request, \u003C\u002Fspan>\u003Cspan style=\"color:#79C0FF\">strlen\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">($request), $html, \u003C\u002Fspan>\u003Cspan style=\"color:#79C0FF\">strlen\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">($html));\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\" style=\"padding-left:2ch;text-indent:-2ch\">\u003Cspan style=\"color:#E6EDF3\">$header \u003C\u002Fspan>\u003Cspan style=\"color:#FF7B72\">=\u003C\u002Fspan>\u003Cspan style=\"color:#79C0FF\"> json_decode\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">($ffi\u003C\u002Fspan>\u003Cspan style=\"color:#FF7B72\">->\u003C\u002Fspan>\u003Cspan style=\"color:#D2A8FF\">fagus_result_header\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">($result, \u003C\u002Fspan>\u003Cspan style=\"color:#79C0FF\">null\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">), \u003C\u002Fspan>\u003Cspan style=\"color:#79C0FF\">true\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">);   \u003C\u002Fspan>\u003Cspan style=\"color:#8B949E\">\u002F\u002F a const char * is a PHP string\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\" style=\"padding-left:2ch;text-indent:-2ch\">\u003Cspan style=\"color:#FF7B72\">if\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\"> ($ffi\u003C\u002Fspan>\u003Cspan style=\"color:#FF7B72\">->\u003C\u002Fspan>\u003Cspan style=\"color:#D2A8FF\">fagus_result_ok\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">($result) \u003C\u002Fspan>\u003Cspan style=\"color:#FF7B72\">===\u003C\u002Fspan>\u003Cspan style=\"color:#79C0FF\"> 1\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">) {\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\" style=\"padding-left:6ch;text-indent:-6ch\">\u003Cspan style=\"color:#E6EDF3\">    $length \u003C\u002Fspan>\u003Cspan style=\"color:#FF7B72\">=\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\"> $ffi\u003C\u002Fspan>\u003Cspan style=\"color:#FF7B72\">->\u003C\u002Fspan>\u003Cspan style=\"color:#D2A8FF\">new\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">(\u003C\u002Fspan>\u003Cspan style=\"color:#A5D6FF\">'size_t'\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">);\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\" style=\"padding-left:6ch;text-indent:-6ch\">\u003Cspan style=\"color:#E6EDF3\">    $pdf \u003C\u002Fspan>\u003Cspan style=\"color:#FF7B72\">=\u003C\u002Fspan>\u003Cspan style=\"color:#79C0FF\"> FFI\u003C\u002Fspan>\u003Cspan style=\"color:#FF7B72\">::\u003C\u002Fspan>\u003Cspan style=\"color:#D2A8FF\">string\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">($ffi\u003C\u002Fspan>\u003Cspan style=\"color:#FF7B72\">->\u003C\u002Fspan>\u003Cspan style=\"color:#D2A8FF\">fagus_result_pdf\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">($result, \u003C\u002Fspan>\u003Cspan style=\"color:#79C0FF\">FFI\u003C\u002Fspan>\u003Cspan style=\"color:#FF7B72\">::\u003C\u002Fspan>\u003Cspan style=\"color:#D2A8FF\">addr\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">($length)), $length\u003C\u002Fspan>\u003Cspan style=\"color:#FF7B72\">->\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">cdata);\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\" style=\"padding-left:2ch;text-indent:-2ch\">\u003Cspan style=\"color:#E6EDF3\">}\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\" style=\"padding-left:2ch;text-indent:-2ch\">\u003Cspan style=\"color:#E6EDF3\">$ffi\u003C\u002Fspan>\u003Cspan style=\"color:#FF7B72\">->\u003C\u002Fspan>\u003Cspan style=\"color:#D2A8FF\">fagus_result_free\u003C\u002Fspan>\u003Cspan style=\"color:#E6EDF3\">($result);\u003C\u002Fspan>\u003C\u002Fspan>\u003C\u002Fcode>\u003C\u002Fpre>\u003C\u002Fdiv>\n\u003Cul>\n\u003Cli>PHP's default \u003Ccode>ffi.enable=preload\u003C\u002Fcode> allows \u003Ccode>FFI::cdef()\u003C\u002Fcode> on the command line only. In PHP-FPM and\nother web servers, the declarations must be loaded by the \u003Ca href=\"https:\u002F\u002Fwww.php.net\u002Fmanual\u002Fen\u002Fopcache.preloading.php\">preload\nscript\u003C\u002Fa> (\u003Ccode>opcache.preload\u003C\u002Fcode>) with\n\u003Ccode>FFI::load()\u003C\u002Fcode> and taken with \u003Ccode>FFI::scope()\u003C\u002Fcode> in the request, or \u003Ccode>ffi.enable=1\u003C\u002Fcode> allows FFI\neverywhere, which PHP advises against. \u003Ccode>FFI::load()\u003C\u002Fcode> reads no \u003Ccode>#include\u003C\u002Fcode> or \u003Ccode>#ifndef\u003C\u002Fcode>: give it\na file of its own with \u003Ccode>#define FFI_SCOPE &quot;fagus&quot;\u003C\u002Fcode>, \u003Ccode>#define FFI_LIB &quot;\u002Fopt\u002Ffagus\u002Flibfagus_ffi.so&quot;\u003C\u002Fcode>\nand the declarations of \u003Ccode>fagus.h\u003C\u002Fcode>. Docker's official PHP images build the extension only\nwith \u003Ccode>docker-php-ext-install ffi\u003C\u002Fcode>.\u003C\u002Fli>\n\u003Cli>Make the engine in the request, or keep it in a long-running process (a queue worker, Octane),\nnever in the preload script: PHP-FPM starts its workers by forking the process that preloads,\nand the threads of an engine do not survive that.\u003C\u002Fli>\n\u003C\u002Ful>\n\u003Ch2 id=\"next-to-the-worker\">Next to the worker\u003Ca class=\"f-doc-anchor\" href=\"#next-to-the-worker\" aria-label=\"Link to this section\">#\u003C\u002Fa>\u003C\u002Fh2>\n\u003Cp>What the \u003Ca href=\"\u002Fdocs\u002Fdeployment#worker-processes\">worker process\u003C\u002Fa> gives that a library in your process\ncannot:\u003C\u002Fp>\n\u003Cul>\n\u003Cli>\u003Cstrong>A crash ends only the worker.\u003C\u002Fstrong> A bug that ends the process (a stack overflow, running out\nof memory, a fault in a dependency's unsafe code) ends the PHP-FPM worker or your program\nwith the library, and the request with it; with the worker, PHP gets an \u003Ccode>EngineException\u003C\u002Fcode> and\nthe next document starts a new one. Panics are caught in both.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>The \u003Ca href=\"\u002Fdocs\u002Fcli#sandbox\">sandbox\u003C\u002Fa>.\u003C\u002Fstrong> On Linux, the worker gives up the network, other programs\nand files it does not need. A library cannot do that to the process that loads it.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Memory back after large documents.\u003C\u002Fstrong> The worker hands freed memory back to the system after\neach document on Linux, and the PHP package replaces a worker that has grown (\u003Ccode>maxMemory\u003C\u002Fcode>).\nIn-process, freed memory stays with your process's allocator until the process ends (for\nPHP-FPM, \u003Ccode>pm.max_requests\u003C\u002Fcode>).\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Limits of the process.\u003C\u002Fstrong> \u003Ccode>--memory-limit\u003C\u002Fcode> and \u003Ccode>--cpu-limit\u003C\u002Fcode> end a worker, not your process.\nThe memory budget and the time limit of each document work in both.\u003C\u002Fli>\n\u003Cli>\u003Cstrong>One binary, one version.\u003C\u002Fstrong> The PHP package checks that the worker speaks its protocol and\nis of its release. The library is whatever file you load: compare \u003Ccode>fagus_version()\u003C\u002Fcode> with what\nyou expect.\u003C\u002Fli>\n\u003C\u002Ful>\n\u003Cp>The library starts the same threads as a worker, with the first document: one that renders (more\nwhile several of your threads render at once, up to one per processor) and two that compress the\nPDF, unless \u003Ccode>RAYON_NUM_THREADS\u003C\u002Fcode> says otherwise.\u003C\u002Fp>\n\u003Ch2 id=\"speed\">Speed\u003Ca class=\"f-doc-anchor\" href=\"#speed\" aria-label=\"Link to this section\">#\u003C\u002Fa>\u003C\u002Fh2>\n\u003Cp>Once a worker runs, the process, the pipe and the copies between PHP and the worker cost little\nbeside the render. What the library saves is the start of the worker, which PHP-FPM pays in each\nrequest that renders. Measured from PHP on an Apple M2 Pro with the invoices of \u003Ccode>tools\u002Fgen.py\u003C\u002Fcode>,\nin milliseconds, medians of seven rounds on a busy machine\n(\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fnforst\u002Ffagus\u002Fblob\u002Fmain\u002Fbench\u002FREADME.md#the-worker-and-the-c-library\">bench\u002FREADME.md\u003C\u002Fa>):\u003C\u002Fp>\n\u003Ctable class=\"f-doc-table f-stack-table\">\n\u003Cthead>\n\u003Ctr>\n\u003Cth>Invoice\u003C\u002Fth>\n\u003Cth style=\"text-align:right\">Rust, in-process\u003C\u002Fth>\n\u003Cth style=\"text-align:right\">PHP, worker\u003C\u002Fth>\n\u003Cth style=\"text-align:right\">PHP, library\u003C\u002Fth>\n\u003Cth style=\"text-align:right\">New worker and its first document\u003C\u002Fth>\n\u003Cth style=\"text-align:right\">New library engine and its first document\u003C\u002Fth>\n\u003C\u002Ftr>\n\u003C\u002Fthead>\n\u003Ctbody>\n\u003Ctr>\n\u003Ctd>1 page\u003C\u002Ftd>\n\u003Ctd style=\"text-align:right\" data-label=\"Rust, in-process\">3.08\u003C\u002Ftd>\n\u003Ctd style=\"text-align:right\" data-label=\"PHP, worker\">3.12\u003C\u002Ftd>\n\u003Ctd style=\"text-align:right\" data-label=\"PHP, library\">3.12\u003C\u002Ftd>\n\u003Ctd style=\"text-align:right\" data-label=\"New worker and its first document\">11.1\u003C\u002Ftd>\n\u003Ctd style=\"text-align:right\" data-label=\"New library engine and its first document\">5.7\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>10 pages\u003C\u002Ftd>\n\u003Ctd style=\"text-align:right\" data-label=\"Rust, in-process\">20.6\u003C\u002Ftd>\n\u003Ctd style=\"text-align:right\" data-label=\"PHP, worker\">21.0\u003C\u002Ftd>\n\u003Ctd style=\"text-align:right\" data-label=\"PHP, library\">21.6\u003C\u002Ftd>\n\u003Ctd style=\"text-align:right\" data-label=\"New worker and its first document\">32.0\u003C\u002Ftd>\n\u003Ctd style=\"text-align:right\" data-label=\"New library engine and its first document\">26.3\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>100 pages\u003C\u002Ftd>\n\u003Ctd style=\"text-align:right\" data-label=\"Rust, in-process\">213\u003C\u002Ftd>\n\u003Ctd style=\"text-align:right\" data-label=\"PHP, worker\">214\u003C\u002Ftd>\n\u003Ctd style=\"text-align:right\" data-label=\"PHP, library\">225\u003C\u002Ftd>\n\u003Ctd style=\"text-align:right\" data-label=\"New worker and its first document\">234\u003C\u002Ftd>\n\u003Ctd style=\"text-align:right\" data-label=\"New library engine and its first document\">239\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003C\u002Ftbody>\n\u003C\u002Ftable>\n\u003Cp>In a queue worker, under Octane or in a long-running script, the worker is started once, and\nthe library gains nothing. Memory is about the same: PHP and the worker together peaked at 23 MB\nfor the 1-page invoice and 133 MB for the 100-page one, PHP with the library at 20 MB and 126 MB.\u003C\u002Fp>\n",[134,138,141,145,148,151,154],{"id":135,"text":136,"level":137},"get-it","Get it",2,{"id":139,"text":140,"level":137},"render-a-document","Render a document",{"id":142,"text":143,"level":144},"options-of-the-engine","Options of the engine",3,{"id":146,"text":147,"level":144},"what-the-library-leaves-out","What the library leaves out",{"id":149,"text":150,"level":137},"from-php","From PHP",{"id":152,"text":153,"level":137},"next-to-the-worker","Next to the worker",{"id":155,"text":156,"level":137},"speed","Speed","https:\u002F\u002Fgithub.com\u002Fnforst\u002Ffagus\u002Fedit\u002Fmain\u002Fdocs\u002Fffi.md","https:\u002F\u002Fgithub.com\u002Fnforst\u002Ffagus\u002Fblob\u002Fv1.3.0\u002Fdocs\u002Fffi.md","\u002Fdocs\u002Fffi.md",{"slug":87,"title":88},{"slug":94,"title":95}]