pstoedit

Crates.iopstoedit
lib.rspstoedit
version0.1.1
sourcesrc
created_at2020-07-13 18:36:41.99322
updated_at2024-04-21 19:39:28.205598
descriptionRust bindings to pstoedit
homepage
repositoryhttps://github.com/hanmertens/pstoedit-rs
max_upload_size
id264784
size48,378
Han (hanmertens)

documentation

README

pstoedit

CI

Rust bindings to pstoedit.

This crate contains Rust bindings to pstoedit, a C++ program that can translate PostScript and PDF graphics into other vector formats.

Features

The API is similar to the C API of pstoedit. Information on drivers can be inquired and arbitrary commands to pstoedit can be constructed and run.

Optional Cargo features:

  • smallvec: potentially reduce the number of allocations using the smallvec crate.

Additionally, features are used to specify the targeted pstoedit version. Due to backward incompatibility, using pstoedit 4.00 or later without specifying an appropriate feature for this crate will result in a runtime error. See below for more details.

Examples

use pstoedit::{DriverInfo, Command};

pstoedit::init()?;

// For every driver ...
for driver in &DriverInfo::get()? {
    let format = driver.symbolic_name()?;
    let extension = driver.extension()?;
    let output_name = format!("output-{}.{}", format, extension);

    // ... convert input.ps to that format
    Command::new().args_slice(&["-f", format, "input.ps"])?.arg(output_name)?.run()?;
}

Requirements and compatibility

Only dynamic linking to pstoedit is supported, so pstoedit needs to be installed. Multiple versions are supported, but the appropriate feature starting with pstoedit_ has to be enabled to prevent a runtime IncompatibleVersion error.

  • pstoedit_4_00: compatible with pstoedit version 4.00–4.01, and likely with future 4.xx releases.
  • No feature starting with pstoedit_: compatible with pstoedit version 3.17–3.78.

License

Licensed under the GNU General Public License; either version 2 of the License (LICENSE or https://www.gnu.org/licenses/old-licenses/gpl-2.0.html), or (at your option) any later version.

Commit count: 24

cargo fmt