How elloza/pptx2pdfwasm works
• Client Application / User Code – This is where a developer calls the Python API (for example, creating an instance of the PPTXtoPDFConverter, starting the server, initiating a conversion, and eventually stopping the server).
• PPTXtoPDFConverter Class – Central to the library, encapsulating the logic to launch and manage the conversion process.
• Local Web Server – Spawned by the converter; its main role is to host the web application which in turn utilizes the Libre Office wasm binaries.
• Static Assets & WASM Files – These resources (found in pptx2pdfwasm/static/static.zip) are extracted on the first run and include the compiled Libre Office wasm code and related web assets.
• Headless Browser (Playwright/Selenium) – This acts as a remote controller that loads the hosted web page, triggers the conversion within the WASM-based Libre Office instance, and finally handles conversion output.
• Test Suite – Represents the automated tests (located in the tests directory) ensuring that conversion works as expected.
Relationships and interactions
• The Client Application (or user’s code) calls the PPTXtoPDFConverter API.
• PPTXtoPDFConverter starts the local web server and ensures the static assets are extracted.
• The converter then launches a headless browser session (using Playwright or Selenium) to load the web page provided by the server.
• The web page uses the Libre Office wasm version to perform the conversion task.
• Finally, the output (converted PDF) is returned back to the converter, which then completes the process.
• All these interactions are verified in the Test Suite.
Architectural patterns and design principles
• Modular Design: Note how the conversion logic is isolated in its own module (converter.py) and the static assets are packaged separately, allowing for a clear separation of concerns.
• Resource Initialization: The on-first-run extraction of compressed static resources is an important initialization step.
• Use of Automation: The role of the headless browser for controlling the conversion process is a key part of this design.
Technology details
• Python for the main library (as evidenced by files like setup.py, pyproject.toml, and the package structure in pptx2pdfwasm/).
• Headless browser tools such as Playwright (or Selenium).
• Libre Office wasm (from ZetaOffice) as the underlying conversion engine.
• Web server technology (likely a lightweight built-in server to serve static content).
Specific elements to add
• Boxed components representing each subsystem with concise labels.
• From Client Application to PPTXtoPDFConverter.
• From Converter to Local Web Server.
• From Local Web Server to Headless Browser.
• From WASM execution (within the Headless Browser) back to the Converter with the conversion results.
• Annotations noting key actions such as "extract static.zip on first run", "start headless browser session", and "perform conversion using Libre Office WASM".