Crates.io | pstoedit |
lib.rs | pstoedit |
version | 0.1.1 |
source | src |
created_at | 2020-07-13 18:36:41.99322 |
updated_at | 2024-04-21 19:39:28.205598 |
description | Rust bindings to pstoedit |
homepage | |
repository | https://github.com/hanmertens/pstoedit-rs |
max_upload_size | |
id | 264784 |
size | 48,378 |
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.
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.
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()?;
}
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.pstoedit_
: compatible with pstoedit version
3.17–3.78.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.