pptxboss 2.0.0__tar.gz → 2.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. {pptxboss-2.0.0 → pptxboss-2.2.0}/Cargo.lock +6 -6
  2. {pptxboss-2.0.0 → pptxboss-2.2.0}/Cargo.toml +4 -4
  3. {pptxboss-2.0.0 → pptxboss-2.2.0}/PKG-INFO +7 -4
  4. {pptxboss-2.0.0/crates/pptxboss-check → pptxboss-2.2.0}/README.md +6 -3
  5. {pptxboss-2.0.0/crates/pptxboss-testkit → pptxboss-2.2.0/crates/pptxboss-check}/README.md +6 -3
  6. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-core/README.md +6 -3
  7. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-py/src/write.rs +25 -5
  8. {pptxboss-2.0.0 → pptxboss-2.2.0/crates/pptxboss-testkit}/README.md +6 -3
  9. pptxboss-2.2.0/crates/pptxboss-write/README.md +336 -0
  10. pptxboss-2.2.0/crates/pptxboss-write/src/fonts.rs +307 -0
  11. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-write/src/lib.rs +24 -0
  12. pptxboss-2.2.0/crates/pptxboss-write/src/lzcomp.rs +820 -0
  13. pptxboss-2.2.0/crates/pptxboss-write/src/mtx.rs +1124 -0
  14. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-write/src/parts.rs +106 -4
  15. pptxboss-2.2.0/crates/pptxboss-write/tests/data/boxy-bold.ttf +0 -0
  16. pptxboss-2.2.0/crates/pptxboss-write/tests/data/boxy-hinted.ttf +0 -0
  17. pptxboss-2.2.0/crates/pptxboss-write/tests/data/boxy-regular.ttf +0 -0
  18. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-write/tests/roundtrip.rs +56 -0
  19. {pptxboss-2.0.0 → pptxboss-2.2.0}/pyproject.toml +1 -1
  20. {pptxboss-2.0.0 → pptxboss-2.2.0}/python/pptxboss/_pptxboss.pyi +6 -1
  21. pptxboss-2.0.0/crates/pptxboss-write/README.md +0 -333
  22. {pptxboss-2.0.0 → pptxboss-2.2.0}/LICENSE-APACHE +0 -0
  23. {pptxboss-2.0.0 → pptxboss-2.2.0}/LICENSE-MIT +0 -0
  24. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-check/Cargo.toml +0 -0
  25. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-check/src/container.rs +0 -0
  26. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-check/src/content_types.rs +0 -0
  27. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-check/src/core_props.rs +0 -0
  28. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-check/src/lib.rs +0 -0
  29. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-check/src/pml.rs +0 -0
  30. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-check/src/relationships.rs +0 -0
  31. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-check/src/xml_parts.rs +0 -0
  32. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-check/tests/rules.rs +0 -0
  33. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-core/Cargo.toml +0 -0
  34. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-core/benches/read.rs +0 -0
  35. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-core/examples/cfb_ls.rs +0 -0
  36. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-core/examples/inflate_ab.rs +0 -0
  37. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-core/examples/inflate_check.rs +0 -0
  38. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-core/examples/open_loop.rs +0 -0
  39. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-core/examples/open_phases.rs +0 -0
  40. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-core/examples/part_costs.rs +0 -0
  41. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-core/examples/ppt_dump.rs +0 -0
  42. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-core/examples/ppt_text.rs +0 -0
  43. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-core/examples/ppt_walk.rs +0 -0
  44. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-core/examples/read_counts.rs +0 -0
  45. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-core/examples/time_file.rs +0 -0
  46. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-core/src/cfb.rs +0 -0
  47. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-core/src/chart.rs +0 -0
  48. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-core/src/comments.rs +0 -0
  49. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-core/src/crc32.rs +0 -0
  50. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-core/src/diagram.rs +0 -0
  51. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-core/src/document.rs +0 -0
  52. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-core/src/encoding.rs +0 -0
  53. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-core/src/error.rs +0 -0
  54. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-core/src/hash.rs +0 -0
  55. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-core/src/inflate.rs +0 -0
  56. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-core/src/lib.rs +0 -0
  57. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-core/src/markdown.rs +0 -0
  58. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-core/src/mce.rs +0 -0
  59. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-core/src/model.rs +0 -0
  60. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-core/src/opc.rs +0 -0
  61. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-core/src/package.rs +0 -0
  62. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-core/src/pml.rs +0 -0
  63. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-core/src/ppt.rs +0 -0
  64. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-core/src/presentation.rs +0 -0
  65. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-core/src/properties.rs +0 -0
  66. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-core/src/slide.rs +0 -0
  67. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-core/src/text.rs +0 -0
  68. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-core/src/xml.rs +0 -0
  69. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-core/src/zip.rs +0 -0
  70. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-core/tests/document.rs +0 -0
  71. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-py/Cargo.toml +0 -0
  72. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-py/src/lib.rs +0 -0
  73. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-py/src/model.rs +0 -0
  74. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-py/src/package.rs +0 -0
  75. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-testkit/Cargo.toml +0 -0
  76. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-testkit/examples/gen_fixtures.rs +0 -0
  77. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-testkit/src/deck.rs +0 -0
  78. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-testkit/src/legacy.rs +0 -0
  79. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-testkit/src/lib.rs +0 -0
  80. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-write/Cargo.toml +0 -0
  81. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-write/examples/placed.rs +0 -0
  82. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-write/examples/styled.rs +0 -0
  83. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-write/src/image.rs +0 -0
  84. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-write/src/layout.rs +0 -0
  85. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-write/src/markdown.rs +0 -0
  86. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-write/src/metrics.rs +0 -0
  87. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-write/src/metrics_data.rs +0 -0
  88. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-write/src/style.rs +0 -0
  89. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-write/src/xml.rs +0 -0
  90. {pptxboss-2.0.0 → pptxboss-2.2.0}/crates/pptxboss-write/src/zipw.rs +0 -0
  91. {pptxboss-2.0.0 → pptxboss-2.2.0}/python/pptxboss/__init__.py +0 -0
  92. {pptxboss-2.0.0 → pptxboss-2.2.0}/python/pptxboss/py.typed +0 -0
  93. {pptxboss-2.0.0 → pptxboss-2.2.0}/python/pptxboss/write.py +0 -0
@@ -355,7 +355,7 @@ checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85"
355
355
 
356
356
  [[package]]
357
357
  name = "pptxboss-check"
358
- version = "2.0.0"
358
+ version = "2.2.0"
359
359
  dependencies = [
360
360
  "pptxboss-core",
361
361
  "pptxboss-testkit",
@@ -364,7 +364,7 @@ dependencies = [
364
364
 
365
365
  [[package]]
366
366
  name = "pptxboss-cli"
367
- version = "2.0.0"
367
+ version = "2.2.0"
368
368
  dependencies = [
369
369
  "clap",
370
370
  "pptxboss-check",
@@ -377,7 +377,7 @@ dependencies = [
377
377
 
378
378
  [[package]]
379
379
  name = "pptxboss-core"
380
- version = "2.0.0"
380
+ version = "2.2.0"
381
381
  dependencies = [
382
382
  "criterion",
383
383
  "flate2",
@@ -388,7 +388,7 @@ dependencies = [
388
388
 
389
389
  [[package]]
390
390
  name = "pptxboss-py"
391
- version = "2.0.0"
391
+ version = "2.2.0"
392
392
  dependencies = [
393
393
  "pptxboss-check",
394
394
  "pptxboss-core",
@@ -398,14 +398,14 @@ dependencies = [
398
398
 
399
399
  [[package]]
400
400
  name = "pptxboss-testkit"
401
- version = "2.0.0"
401
+ version = "2.2.0"
402
402
  dependencies = [
403
403
  "flate2",
404
404
  ]
405
405
 
406
406
  [[package]]
407
407
  name = "pptxboss-write"
408
- version = "2.0.0"
408
+ version = "2.2.0"
409
409
  dependencies = [
410
410
  "flate2",
411
411
  "pptxboss-check",
@@ -3,7 +3,7 @@ resolver = "2"
3
3
  members = ["crates/pptxboss-core", "crates/pptxboss-check", "crates/pptxboss-write", "crates/pptxboss-py", "crates/pptxboss-testkit"]
4
4
 
5
5
  [workspace.package]
6
- version = "2.0.0" # x-release-please-version
6
+ version = "2.2.0" # x-release-please-version
7
7
  edition = "2021"
8
8
  license = "MIT OR Apache-2.0"
9
9
  repository = "https://github.com/4thel00z/pptxboss"
@@ -16,9 +16,9 @@ keywords = ["pptx", "powerpoint", "ecma-376", "ooxml"]
16
16
  # Inter-crate dependencies carry an explicit `version` (required by
17
17
  # `cargo publish`) alongside the local `path`. The markers keep them in
18
18
  # lockstep with the workspace version at release time.
19
- pptxboss-core = { path = "crates/pptxboss-core", version = "2.0.0" } # x-release-please-version
20
- pptxboss-check = { path = "crates/pptxboss-check", version = "2.0.0" } # x-release-please-version
21
- pptxboss-write = { path = "crates/pptxboss-write", version = "2.0.0" } # x-release-please-version
19
+ pptxboss-core = { path = "crates/pptxboss-core", version = "2.2.0" } # x-release-please-version
20
+ pptxboss-check = { path = "crates/pptxboss-check", version = "2.2.0" } # x-release-please-version
21
+ pptxboss-write = { path = "crates/pptxboss-write", version = "2.2.0" } # x-release-please-version
22
22
  criterion = { version = "0.5", default-features = false, features = ["cargo_bench_support"] }
23
23
 
24
24
  # Release builds trade compile time for cross-crate inlining and tighter
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pptxboss
3
- Version: 2.0.0
3
+ Version: 2.2.0
4
4
  Classifier: Development Status :: 3 - Alpha
5
5
  Classifier: Intended Audience :: Developers
6
6
  Classifier: Programming Language :: Rust
@@ -212,9 +212,12 @@ deck.write_to("review.pptx")?;
212
212
  Content without coordinates is placed by the layout engine: it measures
213
213
  text with embedded font metrics, stacks blocks or sets them in columns,
214
214
  shrinks body text to the theme's minimum when a slide is full, and
215
- continues what is left on the next slide. Output is deterministic (fixed
216
- timestamps, fixed part order), reads back through `pptxboss-core`, and
217
- passes `pptxboss check` with no findings.
215
+ continues what is left on the next slide. `Theme::embed_font` stores a
216
+ TrueType or OpenType file in the deck, compressed the way PowerPoint
217
+ stores its own embedded fonts, so it renders in that font on machines
218
+ that lack it. Output is deterministic (fixed timestamps, fixed
219
+ part order), reads back through `pptxboss-core`, and passes
220
+ `pptxboss check` with no findings.
218
221
 
219
222
  The same from Python, and from Markdown through the CLI:
220
223
 
@@ -189,9 +189,12 @@ deck.write_to("review.pptx")?;
189
189
  Content without coordinates is placed by the layout engine: it measures
190
190
  text with embedded font metrics, stacks blocks or sets them in columns,
191
191
  shrinks body text to the theme's minimum when a slide is full, and
192
- continues what is left on the next slide. Output is deterministic (fixed
193
- timestamps, fixed part order), reads back through `pptxboss-core`, and
194
- passes `pptxboss check` with no findings.
192
+ continues what is left on the next slide. `Theme::embed_font` stores a
193
+ TrueType or OpenType file in the deck, compressed the way PowerPoint
194
+ stores its own embedded fonts, so it renders in that font on machines
195
+ that lack it. Output is deterministic (fixed timestamps, fixed
196
+ part order), reads back through `pptxboss-core`, and passes
197
+ `pptxboss check` with no findings.
195
198
 
196
199
  The same from Python, and from Markdown through the CLI:
197
200
 
@@ -189,9 +189,12 @@ deck.write_to("review.pptx")?;
189
189
  Content without coordinates is placed by the layout engine: it measures
190
190
  text with embedded font metrics, stacks blocks or sets them in columns,
191
191
  shrinks body text to the theme's minimum when a slide is full, and
192
- continues what is left on the next slide. Output is deterministic (fixed
193
- timestamps, fixed part order), reads back through `pptxboss-core`, and
194
- passes `pptxboss check` with no findings.
192
+ continues what is left on the next slide. `Theme::embed_font` stores a
193
+ TrueType or OpenType file in the deck, compressed the way PowerPoint
194
+ stores its own embedded fonts, so it renders in that font on machines
195
+ that lack it. Output is deterministic (fixed timestamps, fixed
196
+ part order), reads back through `pptxboss-core`, and passes
197
+ `pptxboss check` with no findings.
195
198
 
196
199
  The same from Python, and from Markdown through the CLI:
197
200
 
@@ -189,9 +189,12 @@ deck.write_to("review.pptx")?;
189
189
  Content without coordinates is placed by the layout engine: it measures
190
190
  text with embedded font metrics, stacks blocks or sets them in columns,
191
191
  shrinks body text to the theme's minimum when a slide is full, and
192
- continues what is left on the next slide. Output is deterministic (fixed
193
- timestamps, fixed part order), reads back through `pptxboss-core`, and
194
- passes `pptxboss check` with no findings.
192
+ continues what is left on the next slide. `Theme::embed_font` stores a
193
+ TrueType or OpenType file in the deck, compressed the way PowerPoint
194
+ stores its own embedded fonts, so it renders in that font on machines
195
+ that lack it. Output is deterministic (fixed timestamps, fixed
196
+ part order), reads back through `pptxboss-core`, and passes
197
+ `pptxboss check` with no findings.
195
198
 
196
199
  The same from Python, and from Markdown through the CLI:
197
200
 
@@ -435,10 +435,12 @@ fn scale_from(sizes: HashMap<String, u32>) -> PyResult<TypeScale> {
435
435
  Ok(scale)
436
436
  }
437
437
 
438
- /// Colors, fonts, type scale and backgrounds shared by every slide.
439
- /// `colors` maps slot names (dark1, light1, dark2, light2, accent1 to
440
- /// accent6, hyperlink, followed_hyperlink) to `#RRGGBB`; `sizes` maps
441
- /// display, title, subtitle, body, table and minimum to points.
438
+ /// Colors, fonts, type scale, backgrounds and embedded fonts shared by
439
+ /// every slide. `colors` maps slot names (dark1, light1, dark2, light2,
440
+ /// accent1 to accent6, hyperlink, followed_hyperlink) to `#RRGGBB`;
441
+ /// `sizes` maps display, title, subtitle, body, table and minimum to
442
+ /// points; `embed_fonts` holds TrueType or OpenType files stored in the
443
+ /// deck.
442
444
  #[pyclass(module = "pptxboss.write")]
443
445
  #[derive(Clone)]
444
446
  pub struct Theme {
@@ -448,7 +450,7 @@ pub struct Theme {
448
450
  #[pymethods]
449
451
  impl Theme {
450
452
  #[new]
451
- #[pyo3(signature = (name="pptxboss", *, colors=None, major_font=None, minor_font=None, font=None, sizes=None, inverted=false, background=None))]
453
+ #[pyo3(signature = (name="pptxboss", *, colors=None, major_font=None, minor_font=None, font=None, sizes=None, inverted=false, background=None, embed_fonts=None))]
452
454
  #[allow(clippy::too_many_arguments)]
453
455
  fn new(
454
456
  name: &str,
@@ -459,8 +461,12 @@ impl Theme {
459
461
  sizes: Option<HashMap<String, u32>>,
460
462
  inverted: bool,
461
463
  background: Option<Background>,
464
+ embed_fonts: Option<Vec<Vec<u8>>>,
462
465
  ) -> PyResult<Self> {
463
466
  let mut inner = CoreTheme::new(name);
467
+ for data in embed_fonts.unwrap_or_default() {
468
+ inner = inner.embed_font(data);
469
+ }
464
470
  if let Some(sizes) = sizes {
465
471
  inner = inner.scale(scale_from(sizes)?);
466
472
  }
@@ -511,6 +517,20 @@ impl Theme {
511
517
  CoreTheme::PRESETS.to_vec()
512
518
  }
513
519
 
520
+ /// Stores a TrueType or OpenType font file in the deck. Files of one
521
+ /// family fill its regular, bold, italic and bold italic slots. Saving
522
+ /// fails for a font whose license forbids embedding.
523
+ fn embed_font(mut slf: PyRefMut<'_, Self>, data: Vec<u8>) -> PyRefMut<'_, Self> {
524
+ slf.inner = std::mem::take(&mut slf.inner).embed_font(data);
525
+ slf
526
+ }
527
+
528
+ /// The number of embedded font files.
529
+ #[getter]
530
+ fn embedded_font_count(&self) -> usize {
531
+ self.inner.embedded_fonts.len()
532
+ }
533
+
514
534
  /// A background for one layout; `inverted` swaps light and dark text on it.
515
535
  #[pyo3(signature = (layout, background, *, inverted=false))]
516
536
  fn layout_background<'py>(
@@ -189,9 +189,12 @@ deck.write_to("review.pptx")?;
189
189
  Content without coordinates is placed by the layout engine: it measures
190
190
  text with embedded font metrics, stacks blocks or sets them in columns,
191
191
  shrinks body text to the theme's minimum when a slide is full, and
192
- continues what is left on the next slide. Output is deterministic (fixed
193
- timestamps, fixed part order), reads back through `pptxboss-core`, and
194
- passes `pptxboss check` with no findings.
192
+ continues what is left on the next slide. `Theme::embed_font` stores a
193
+ TrueType or OpenType file in the deck, compressed the way PowerPoint
194
+ stores its own embedded fonts, so it renders in that font on machines
195
+ that lack it. Output is deterministic (fixed timestamps, fixed
196
+ part order), reads back through `pptxboss-core`, and passes
197
+ `pptxboss check` with no findings.
195
198
 
196
199
  The same from Python, and from Markdown through the CLI:
197
200
 
@@ -0,0 +1,336 @@
1
+ <h1 align="center">pptxboss</h1>
2
+
3
+ <p align="center">
4
+ <strong>A PowerPoint engine written from scratch in Rust: read .pptx and legacy .ppt decks, extract text, notes, tables, charts and images, render Markdown, verify against ECMA-376, create decks. One core, a CLI, and pythonic bindings.</strong>
5
+ </p>
6
+
7
+ <p align="center">
8
+ <a href="https://github.com/4thel00z/pptxboss/actions/workflows/ci.yaml"><img src="https://github.com/4thel00z/pptxboss/actions/workflows/ci.yaml/badge.svg" alt="CI"></a>
9
+ <a href="https://github.com/4thel00z/pptxboss/actions/workflows/python-ci.yml"><img src="https://github.com/4thel00z/pptxboss/actions/workflows/python-ci.yml/badge.svg" alt="python-ci"></a>
10
+ <a href="https://4thel00z.github.io/pptxboss/"><img src="https://img.shields.io/badge/docs-book-blue?logo=mdbook&logoColor=white" alt="Documentation"></a>
11
+ <a href="https://pypi.org/project/pptxboss/"><img src="https://img.shields.io/pypi/v/pptxboss?logo=pypi&logoColor=white" alt="PyPI"></a>
12
+ <img src="https://img.shields.io/badge/rust-2021-000000?logo=rust&logoColor=white" alt="Rust 2021">
13
+ <a href="#license"><img src="https://img.shields.io/badge/license-MIT%20OR%20Apache--2.0-blue.svg" alt="MIT OR Apache-2.0"></a>
14
+ </p>
15
+
16
+ <p align="center">
17
+ <a href="https://4thel00z.github.io/pptxboss/">Docs</a> ·
18
+ <a href="https://pypi.org/project/pptxboss/">PyPI</a> ·
19
+ <a href="https://crates.io/crates/pptxboss-cli">crates.io</a> ·
20
+ <a href="#benchmarks">Benchmarks</a>
21
+ </p>
22
+
23
+ ---
24
+
25
+ Reading a PowerPoint file should not require PowerPoint, a Java runtime, or a
26
+ pure-Python XML tree. pptxboss is a clean-room reader built from the ECMA-376
27
+ specification (Office Open XML): safe Rust, no C dependencies, no bindings to
28
+ another engine, one core behind the CLI and the Python extension. It is a
29
+ **lenient reader**: real decks are damaged, so it tolerates broken archives,
30
+ content types and relationships, recovers the slide list when the
31
+ presentation part does not list it, and skips what it cannot read instead of
32
+ refusing, reporting every skip.
33
+
34
+ ## Highlights
35
+
36
+ - **Clean-room engine**: implemented from ECMA-376 Parts 1 to 4 in safe Rust,
37
+ with no compression or XML dependency.
38
+ - **Reads only what it needs**: extracting text from a 42 MB deck never
39
+ reads its 40 MB of media.
40
+ - **Fast on one core, faster on all**: slides are read in parallel across
41
+ cores. `--threads 1` keeps everything on the calling thread and is still
42
+ the fastest engine measured ([benchmarks](#benchmarks)).
43
+ - **Strict and Transitional alike**: the Open XML SDK's Strict-namespace
44
+ test decks, which most readers refuse, read and verify like any other,
45
+ and `mc:AlternateContent` is resolved per Part 3.
46
+ - **The whole deck, not just the slides**: speaker notes, comments with
47
+ their authors, threaded comments included, sections, core and application
48
+ properties, embedded objects with their bytes, pictures with their image
49
+ parts, hyperlinks, and alternative text on request. Chart titles, series,
50
+ categories and values and the text of SmartArt diagrams are extracted
51
+ with the slide text.
52
+ - **Markdown output**: `pptxboss markdown` renders a deck as a heading per
53
+ slide, bullets with their levels, GFM tables, images, chart tables and
54
+ diagram outlines, with notes and comments as block quotes on request.
55
+ - **A verifier**: `pptxboss check` runs 72 structural rules from ECMA-376
56
+ Parts 1 and 2 over the container, part names, content types,
57
+ relationships, required parts, id ranges and XML well-formedness. Every
58
+ finding has a stable code, a severity and the clause it enforces. Decks
59
+ saved by PowerPoint pass with no findings.
60
+ - **Fastest measured**: 9,868 files/s extracting text over a 631-file
61
+ public corpus, and 7,942 files/s on one thread: 3.1x and 2.5x the next
62
+ fastest Rust engine, 16x to 20x the most-used Python library, with chart
63
+ and SmartArt text included that no other engine measured produces, and
64
+ paragraph-for-paragraph agreement on every file the comparison includes
65
+ ([benchmarks](#benchmarks)).
66
+ - **Reads legacy `.ppt` too**: the PowerPoint 97-2003 binary format is read
67
+ from the MS-CFB, MS-PPT and MS-ODRAW specifications into the same slide
68
+ model, so every reading command and API works on it unchanged.
69
+
70
+ ## Install
71
+
72
+ ```sh
73
+ pip install pptxboss # Python package with the extension module
74
+ cargo install pptxboss-cli # the pptxboss binary
75
+ ```
76
+
77
+ Coding agents get a bundled [skill](skills/pptxboss/SKILL.md): `pptxboss skill install` writes it into the agent's skill directory, and `npx skills add 4thel00z/pptxboss` installs it from [skills.sh](https://skills.sh).
78
+
79
+ ## Usage
80
+
81
+ ```sh
82
+ pptxboss info deck.pptx # slide count, size, one line per slide
83
+ pptxboss text deck.pptx # slide text, slides separated by blank lines
84
+ pptxboss text --notes --headings deck.pptx
85
+ pptxboss text --comments --alt-text deck.pptx # comments after each slide; alt text of pictures
86
+ pptxboss markdown --notes deck.pptx # the deck as Markdown, notes as block quotes
87
+ pptxboss text --json deck.pptx # [{"number": 1, "text": "..."}, ...]
88
+ pptxboss text --slides 2-4,7 deck.pptx # only those slides, in that order; also on info and markdown
89
+ pptxboss text --threads 1 deck.pptx # cap the worker threads (default: every core)
90
+ pptxboss check deck.pptx # verify against ECMA-376; exit 1 on errors
91
+ pptxboss check --json --quiet deck.pptx
92
+ pptxboss rules # every rule with its code, severity and clause
93
+ pptxboss create text out.pptx --title "Hello" --bullet "one" --bullet "two" --notes "say hi"
94
+ pptxboss create md out.pptx deck.md # '#' title slide, '##' content slides, list items, Notes:
95
+ pptxboss create blank out.pptx --slides 3
96
+ ```
97
+
98
+ <p align="center">
99
+ <img src="https://raw.githubusercontent.com/4thel00z/pptxboss/main/assets/screenshots/info.png" alt="pptxboss create md and pptxboss info in a terminal" width="760">
100
+ </p>
101
+
102
+ <p align="center">
103
+ <img src="https://raw.githubusercontent.com/4thel00z/pptxboss/main/assets/screenshots/check.png" alt="pptxboss markdown with notes, then pptxboss check reporting no findings" width="760">
104
+ </p>
105
+
106
+ Text semantics: shapes in z-order (which ECMA-376 makes the reading order),
107
+ paragraphs one per line, line breaks preserved, fields included, table rows
108
+ one per line with tab-separated cells, groups descended, chart titles and
109
+ data as rows, diagram nodes one per line, hidden shapes and
110
+ date/footer/slide-number placeholders left out unless asked for. Text is
111
+ never inherited from a layout or master, so empty placeholders stay empty.
112
+
113
+ <p align="center">
114
+ <img src="https://raw.githubusercontent.com/4thel00z/pptxboss/main/assets/screenshots/text.png" alt="pptxboss text with headings and notes for two slides" width="760">
115
+ </p>
116
+
117
+ ```python
118
+ import pptxboss
119
+
120
+ doc = pptxboss.Document("deck.pptx") # threads=1 to stay on one core
121
+ print(doc.slide_count, doc.slide_size)
122
+ for slide in doc: # slides parse lazily
123
+ print(slide.number, slide.title)
124
+ print(slide.text()) # z-order, one paragraph per line
125
+ print(slide.notes()) # speaker notes or None
126
+ for table in slide.tables(): # rows of cell texts
127
+ print(table)
128
+ for image in slide.images(): # pictures with their image parts
129
+ data = slide.image_bytes(image)
130
+ for comment in slide.comments(): # author, date, text; replies flagged
131
+ print(comment.author, comment.text)
132
+ for obj in slide.embedded_objects(): # p:oleObj with prog_id and part
133
+ data = slide.object_bytes(obj)
134
+ for chart in slide.charts(): # title, kinds, series with categories and values
135
+ print(chart.title, [s.name for s in chart.series])
136
+ for diagram in slide.diagrams(): # SmartArt as (level, text) items
137
+ print(diagram.items)
138
+ print(doc.markdown(notes=True)) # the deck as Markdown
139
+ props = doc.core_properties() # title, creator, created, modified, ...
140
+ for section in doc.sections(): # name and zero-based slide indexes
141
+ print(section.name, section.slides)
142
+ text, warnings = doc.text_reporting() # whole deck, plus what was skipped
143
+ text, report = doc.extract(indexes=[0, 2]) # chosen slides, structured report
144
+ package = doc.package() # raw parts, content types, relationships
145
+
146
+ for finding in pptxboss.check("deck.pptx"): # the verifier, most severe first
147
+ print(finding.severity, finding.code, finding.clause, finding.message)
148
+ report = pptxboss.check_report("deck.pptx") # findings plus parts_checked, truncated
149
+ ```
150
+
151
+ ```rust
152
+ use pptxboss_core::Document;
153
+
154
+ fn main() -> Result<(), Box<dyn std::error::Error>> {
155
+ let doc = Document::open("deck.pptx")?;
156
+ for slide in doc.slides() {
157
+ let slide = slide?;
158
+ println!("{}: {}", slide.number(), slide.title().unwrap_or_default());
159
+ println!("{}", slide.text());
160
+ if let Some(notes) = slide.notes_text()? {
161
+ println!("notes: {notes}");
162
+ }
163
+ }
164
+ let (text, report) = doc.text_reporting(&Default::default());
165
+ for warning in report.warnings() {
166
+ eprintln!("warning: {warning}");
167
+ }
168
+ println!("{text}");
169
+ Ok(())
170
+ }
171
+ ```
172
+
173
+ ## Create decks
174
+
175
+ ```rust
176
+ use pptxboss_write::{Block, Presentation, Slide, Theme};
177
+
178
+ let deck = Presentation::new()
179
+ .theme(Theme::slate())
180
+ .slide(Slide::title_slide("Quarterly review", Some("Q3 2026")))
181
+ .slide(Slide::titled("Highlights").bullet("Revenue up").sub_bullet("in every region", 1).notes("Pause here"))
182
+ .slide(Slide::titled("Numbers").columns(vec![
183
+ Block::bullets(["EMEA grew fastest", "APAC flat"]),
184
+ Block::table(vec![vec!["Region".into(), "Growth".into()], vec!["EMEA".into(), "12%".into()]], true),
185
+ ]));
186
+ deck.write_to("review.pptx")?;
187
+ ```
188
+
189
+ Content without coordinates is placed by the layout engine: it measures
190
+ text with embedded font metrics, stacks blocks or sets them in columns,
191
+ shrinks body text to the theme's minimum when a slide is full, and
192
+ continues what is left on the next slide. `Theme::embed_font` stores a
193
+ TrueType or OpenType file in the deck, compressed the way PowerPoint
194
+ stores its own embedded fonts, so it renders in that font on machines
195
+ that lack it. Output is deterministic (fixed timestamps, fixed
196
+ part order), reads back through `pptxboss-core`, and passes
197
+ `pptxboss check` with no findings.
198
+
199
+ The same from Python, and from Markdown through the CLI:
200
+
201
+ ```python
202
+ from pptxboss import write
203
+
204
+ deck = write.Presentation(theme=write.Theme.preset("nord"))
205
+ deck.add(write.Slide("Text beside a picture")
206
+ .columns(["Seven twelfths for the text", "Five for the picture"], write.Picture(open("chart.png", "rb").read()))
207
+ .table(rows))
208
+ deck.save("review.pptx")
209
+ ```
210
+
211
+ ```sh
212
+ pptxboss create md out.pptx slides.md --theme mocha # a long list continues on the next slide
213
+ ```
214
+
215
+ Slides from `cargo run -p pptxboss-write --example placed -- placed.pptx chart.png`,
216
+ rendered with LibreOffice:
217
+
218
+ <p align="center">
219
+ <img src="https://raw.githubusercontent.com/4thel00z/pptxboss/main/assets/examples/placed-agenda.webp" alt="An agenda of fourteen items, the first seven on this slide at full size" width="49%">
220
+ <img src="https://raw.githubusercontent.com/4thel00z/pptxboss/main/assets/examples/placed-beside.webp" alt="Three bullets beside a picture that keeps its aspect ratio" width="49%">
221
+ <img src="https://raw.githubusercontent.com/4thel00z/pptxboss/main/assets/examples/placed-table.webp" alt="The first fourteen rows of a twenty-eight row table with its header" width="49%">
222
+ <img src="https://raw.githubusercontent.com/4thel00z/pptxboss/main/assets/examples/placed-stacked.webp" alt="A paragraph, a table and three text columns stacked on one slide" width="49%">
223
+ </p>
224
+
225
+ Fourteen agenda items split seven and seven at full size instead of
226
+ shrinking; the table continues on a second slide with its header row;
227
+ the picture column takes five twelfths of the width.
228
+
229
+ ## Benchmarks
230
+
231
+ **pptxboss is the fastest library measured, on one thread as well as on
232
+ all cores: 2.5x to 3x the next fastest Rust engine and 16x to 20x
233
+ python-pptx, with paragraph-for-paragraph agreement on every file the
234
+ comparison includes.**
235
+
236
+ Text extraction from Python over the 737 `.pptx` files of the LibreOffice,
237
+ Apache POI, python-pptx, pandoc and Open XML SDK test suites, best of 3 per
238
+ file after a warm-up pass, aggregated over the 631 files every engine
239
+ handled, Apple M3 Pro. A file counts only when pptxboss reports nothing
240
+ skipped and its per-slide paragraphs match python-pptx after whitespace
241
+ normalization: 636 files pass, and not one is excluded for a disagreement.
242
+ The 101 exclusions are 86 Strict-namespace decks python-pptx cannot open,
243
+ 11 fuzzer-minimized archives, one encrypted deck, and two fuzzer cases
244
+ pptxboss reports as unreadable.
245
+
246
+ | Library | files/s | slides/s |
247
+ |---|--:|--:|
248
+ | pptxboss, all cores | 9,868 | 21,424 |
249
+ | pptxboss, one thread (`threads=1`) | 7,942 | 17,243 |
250
+ | office-oxide | 3,163 | 6,867 |
251
+ | kreuzberg | 1,866 | 4,051 |
252
+ | undoc | 1,831 | 3,975 |
253
+ | python-pptx | 488 | 1,060 |
254
+ | markitdown | 71 | 154 |
255
+
256
+ <details>
257
+ <summary>Method and fine print</summary>
258
+
259
+ Every engine is called from Python through its own adapter. pptxboss
260
+ spreads a deck's slides across cores unless `threads=1` keeps it on the
261
+ calling thread; the one-thread row is the like-for-like comparison, since
262
+ the other Rust engines run one thread per file (office-oxide's wheel was
263
+ measured at 0.9 to 1.1 CPU seconds per wall second). The pptxboss rows
264
+ include chart and SmartArt text, which none of the other engines produce;
265
+ on this corpus that costs pptxboss 13% of its one-thread time, and
266
+ `text(charts=False, diagrams=False)` leaves it out. The test-suite corpus
267
+ is small files, so the rows are dominated by per-file cost.
268
+
269
+ On two real-world PowerPoint decks (7 and 43 slides, 3 MB and 42 MB) the
270
+ same harness, best of 40:
271
+
272
+ | Deck | office-oxide | pptxboss, one thread | pptxboss, all cores |
273
+ |---|--:|--:|--:|
274
+ | 43 slides, wall | 4.89 ms | 1.38 ms | 0.44 ms |
275
+ | 43 slides, CPU | 5.19 ms | 1.41 ms | 2.60 ms |
276
+ | 7 slides, wall | 1.05 ms | 0.28 ms | 0.16 ms |
277
+ | 7 slides, CPU | 1.10 ms | 0.28 ms | 0.52 ms |
278
+
279
+ Legacy `.ppt` decks: over the 153 readable files of the LibreOffice and
280
+ Apache POI `.ppt` test suites (41 MB), the same harness reads text with
281
+ pptxboss in 15 ms against 61 ms for office-oxide, best of 3 per file, both
282
+ on one thread, which is the default for a legacy deck. The words agree on
283
+ 87 of the 89 decks that contain text; the other two have a broken user-edit
284
+ chain that pptxboss recovers only partially. office-oxide includes master
285
+ placeholder text, pptxboss never does.
286
+
287
+ The paragraph comparison is against python-pptx only, because the other
288
+ engines do not expose per-slide paragraphs. Absolute numbers depend on
289
+ the machine and on the cores macOS schedules the process on. Reproduce with
290
+ [`benchmarks/bench.py`](benchmarks/README.md) after
291
+ `benchmarks/corpora/fetch_public.sh`. Engine versions are recorded in
292
+ `benchmarks/results.json`.
293
+
294
+ </details>
295
+
296
+ ## What's inside
297
+
298
+ | Crate | What it does |
299
+ |---|---|
300
+ | `pptxboss-core` | Reads `.pptx` and legacy `.ppt` decks: slides, notes, tables, charts, diagrams, comments, pictures, properties, text and Markdown extraction |
301
+ | `pptxboss-check` | The verifier: 72 clause-numbered rules over package and presentation structure |
302
+ | `pptxboss-write` | Creates decks: titles, bullets, formatted runs with colors and links, text boxes, tables, pictures, notes; themes with presets and solid, gradient or picture backgrounds; Markdown to slides; deterministic output that passes the verifier with no findings |
303
+ | `pptxboss-cli` | The `pptxboss` binary |
304
+ | `pptxboss-py` | The `pptxboss._pptxboss` extension module behind the Python package |
305
+ | `pptxboss-testkit` | In-memory ZIP and deck builders for tests; not published |
306
+
307
+ ## Limitations
308
+
309
+ - Password-protected files (encrypted packages and encrypted `.ppt`) are
310
+ detected and refused with an error that says so, not decrypted.
311
+ - Legacy `.ppt` decks give their text, titles, notes, hidden flags, slide
312
+ size and pictures, and are read whole into memory; their tables, charts,
313
+ comments and properties are not read, the verifier covers ECMA-376
314
+ packages only, so `check` refuses them, and PowerPoint 95 files are
315
+ refused.
316
+ - No rendering of slides to images.
317
+
318
+ ## Documentation
319
+
320
+ The [pptxboss book](https://4thel00z.github.io/pptxboss/) covers installation, one guide chapter per task (text, notes and structure, images, verifying, creating decks, Markdown to slides) and CLI, Python, Rust and verifier-rule reference chapters. It is built with mdBook from [`docs/`](docs/) by the `book` workflow and published on GitHub Pages. Per-crate Rust API documentation is on [docs.rs](https://docs.rs/pptxboss-core).
321
+
322
+ ## Development
323
+
324
+ ```sh
325
+ cargo test --workspace
326
+ cargo clippy --workspace --all-targets -- -D warnings
327
+ maturin develop && pytest
328
+ make ci
329
+ ```
330
+
331
+ ## License
332
+
333
+ Licensed under either of Apache License, Version 2.0 or MIT license at your
334
+ option. Unless you explicitly state otherwise, any contribution intentionally
335
+ submitted for inclusion in this project shall be dual licensed as above,
336
+ without any additional terms or conditions.