{"id":13671801,"url":"https://github.com/typst/pdf-writer","last_synced_at":"2025-05-14T02:04:58.985Z","repository":{"id":38445165,"uuid":"313448065","full_name":"typst/pdf-writer","owner":"typst","description":"A step-by-step PDF writer.","archived":false,"fork":false,"pushed_at":"2025-04-02T08:16:59.000Z","size":2124,"stargazers_count":537,"open_issues_count":2,"forks_count":31,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-04-13T21:25:30.627Z","etag":null,"topics":["pdf-generation","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/typst.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["typst"]}},"created_at":"2020-11-16T22:57:36.000Z","updated_at":"2025-04-11T19:06:27.000Z","dependencies_parsed_at":"2023-02-17T22:16:14.680Z","dependency_job_id":"f17fa604-7b65-4007-aa87-d96817236c0c","html_url":"https://github.com/typst/pdf-writer","commit_stats":{"total_commits":120,"total_committers":3,"mean_commits":40.0,"dds":"0.33333333333333337","last_synced_commit":"b3c4b4cff11fe19acb00b8ce2dbb80cbbd5421d4"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typst%2Fpdf-writer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typst%2Fpdf-writer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typst%2Fpdf-writer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typst%2Fpdf-writer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/typst","download_url":"https://codeload.github.com/typst/pdf-writer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254052692,"owners_count":22006716,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["pdf-generation","rust"],"created_at":"2024-08-02T09:01:19.151Z","updated_at":"2025-05-14T02:04:58.952Z","avatar_url":"https://github.com/typst.png","language":"Rust","funding_links":["https://github.com/sponsors/typst"],"categories":["Rust"],"sub_categories":[],"readme":"# pdf-writer\n[![Crates.io](https://img.shields.io/crates/v/pdf-writer.svg)](https://crates.io/crates/pdf-writer)\n[![Documentation](https://docs.rs/pdf-writer/badge.svg)](https://docs.rs/pdf-writer)\n\nA step-by-step PDF writer.\n\n```toml\n[dependencies]\npdf-writer = \"0.12\"\n```\n\nThe entry point into the API is the main `Pdf`, which constructs the document\ninto one big internal buffer. The top-level writer has many methods to create\nspecialized writers for specific PDF objects. These all follow the same general\npattern: They borrow the main buffer mutably, expose a builder pattern for\nwriting individual fields in a strongly typed fashion and finish up the object\nwhen dropped.\n\nThere are a few more top-level structs with internal buffers, like the builder\nfor `Content` streams, but wherever possible buffers are borrowed from parent\nwriters to minimize allocations.\n\n## Minimal example\nThe following example creates a PDF with a single, empty A4 page.\n\n```rust\nuse pdf_writer::{Pdf, Rect, Ref};\n\n// Define some indirect reference ids we'll use.\nlet catalog_id = Ref::new(1);\nlet page_tree_id = Ref::new(2);\nlet page_id = Ref::new(3);\n\n// Write a document catalog and a page tree with one A4 page that uses no resources.\nlet mut pdf = Pdf::new();\npdf.catalog(catalog_id).pages(page_tree_id);\npdf.pages(page_tree_id).kids([page_id]).count(1);\npdf.page(page_id)\n    .parent(page_tree_id)\n    .media_box(Rect::new(0.0, 0.0, 595.0, 842.0))\n    .resources();\n\n// Finish with cross-reference table and trailer and write to file.\nstd::fs::write(\"target/empty.pdf\", pdf.finish())?;\n```\n\nFor more examples, check out the [examples folder] in the repository.\n\n## Safety\nThis crate forbids unsafe code, but it depends on a few popular crates that use\nunsafe internally.\n\n## License\nThis crate is dual-licensed under the MIT and Apache 2.0 licenses.\n\n[examples folder]: https://github.com/typst/pdf-writer/tree/main/examples\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftypst%2Fpdf-writer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftypst%2Fpdf-writer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftypst%2Fpdf-writer/lists"}