pub struct ResourceManager { /* private fields */ }Expand description
Manages fonts, images, and other resources during editing.
Provides allocation and tracking of:
- Fonts (/F1, /F2, etc.)
- Images/XObjects (/Im1, /Im2, etc.)
- Graphics states (/GS1, /GS2, etc.)
- Patterns, shadings, etc.
Implementations§
Source§impl ResourceManager
impl ResourceManager
Sourcepub fn register_font(&mut self, font_name: &str) -> String
pub fn register_font(&mut self, font_name: &str) -> String
Register or get a font resource name.
Returns the resource name (e.g., “/F1”, “/F2”) for use in content streams. If a font with this name is already registered, returns the existing name.
§Arguments
font_name- Font name (e.g., “Helvetica”, “Times-Roman”)
§Returns
Resource name to use in PDF content (e.g., “/F1”)
Sourcepub fn get_font_resource(&self, font_name: &str) -> Option<String>
pub fn get_font_resource(&self, font_name: &str) -> Option<String>
Get a font resource name by its font name.
Returns None if the font is not registered.
Sourcepub fn register_image(&mut self) -> String
pub fn register_image(&mut self) -> String
Register an image/XObject resource.
Returns the resource name (e.g., “/Im1”, “/Im2”) for use in content streams.
Sourcepub fn register_graphics_state(&mut self) -> String
pub fn register_graphics_state(&mut self) -> String
Register a graphics state resource.
Returns the resource name (e.g., “/GS1”, “/GS2”).
Sourcepub fn graphics_states(&self) -> Vec<(String, String)>
pub fn graphics_states(&self) -> Vec<(String, String)>
List all registered graphics states.
Sourcepub fn register_pattern(&mut self) -> String
pub fn register_pattern(&mut self) -> String
Register a pattern resource.
Returns the resource name (e.g., “/Pat1”, “/Pat2”).
Sourcepub fn register_shading(&mut self) -> String
pub fn register_shading(&mut self) -> String
Register a shading (gradient) resource.
Returns the resource name (e.g., “/Sh1”, “/Sh2”).
Sourcepub fn resource_count(&self) -> usize
pub fn resource_count(&self) -> usize
Get a count of all registered resources.
Trait Implementations§
Source§impl Clone for ResourceManager
impl Clone for ResourceManager
Source§fn clone(&self) -> ResourceManager
fn clone(&self) -> ResourceManager
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more