Skip to main content

TableDrawing

Trait TableDrawing 

Source
pub trait TableDrawing {
    // Required methods
    fn draw_table(
        &mut self,
        page_id: ObjectId,
        table: Table,
        position: (f32, f32),
    ) -> Result<()>;
    fn add_table_to_page(
        &mut self,
        page_id: ObjectId,
        table: Table,
    ) -> Result<()>;
    fn create_table_content(
        &self,
        table: &Table,
        position: (f32, f32),
    ) -> Result<Vec<Object>>;
    fn draw_table_with_pagination(
        &mut self,
        page_id: ObjectId,
        table: Table,
        position: (f32, f32),
    ) -> Result<PagedTableResult>;
    fn draw_table_with_hook(
        &mut self,
        page_id: ObjectId,
        table: Table,
        position: (f32, f32),
        hook: Option<&mut dyn TaggedCellHook>,
    ) -> Result<()>;
    fn draw_table_with_pagination_and_hook(
        &mut self,
        page_id: ObjectId,
        table: Table,
        position: (f32, f32),
        hook: Option<&mut dyn TaggedCellHook>,
    ) -> Result<PagedTableResult>;
}
Expand description

Extension trait for lopdf::Document to add table drawing capabilities

Required Methods§

Source

fn draw_table( &mut self, page_id: ObjectId, table: Table, position: (f32, f32), ) -> Result<()>

Draw a table at the specified position on a page

§Arguments
  • page_id - The object ID of the page to draw on
  • table - The table to draw
  • position - The (x, y) position of the table’s top-left corner
§Returns

Returns Ok(()) on success, or an error if the table cannot be drawn

Source

fn add_table_to_page(&mut self, page_id: ObjectId, table: Table) -> Result<()>

Add a table to a page with automatic positioning

This method will find an appropriate position on the page for the table

Source

fn create_table_content( &self, table: &Table, position: (f32, f32), ) -> Result<Vec<Object>>

Create table content operations without adding to document

Useful for custom positioning or combining with other content

Source

fn draw_table_with_pagination( &mut self, page_id: ObjectId, table: Table, position: (f32, f32), ) -> Result<PagedTableResult>

Draw a table with automatic page wrapping

This method will automatically create new pages as needed when the table exceeds the available space on the current page. Header rows will be repeated on each new page if configured.

§Arguments
  • page_id - The object ID of the starting page
  • table - The table to draw
  • position - The (x, y) position of the table’s top-left corner
§Returns

Returns a PagedTableResult with information about pages used

Source

fn draw_table_with_hook( &mut self, page_id: ObjectId, table: Table, position: (f32, f32), hook: Option<&mut dyn TaggedCellHook>, ) -> Result<()>

Draw a table with an optional tagged-cell hook.

Existing rendering behavior is unchanged when hook is None.

Source

fn draw_table_with_pagination_and_hook( &mut self, page_id: ObjectId, table: Table, position: (f32, f32), hook: Option<&mut dyn TaggedCellHook>, ) -> Result<PagedTableResult>

Draw a paginated table with an optional tagged-cell hook.

Existing rendering behavior is unchanged when hook is None.

Implementations on Foreign Types§

Source§

impl TableDrawing for Document

Source§

fn draw_table( &mut self, page_id: ObjectId, table: Table, position: (f32, f32), ) -> Result<()>

Source§

fn add_table_to_page(&mut self, page_id: ObjectId, table: Table) -> Result<()>

Source§

fn create_table_content( &self, table: &Table, position: (f32, f32), ) -> Result<Vec<Object>>

Source§

fn draw_table_with_pagination( &mut self, page_id: ObjectId, table: Table, position: (f32, f32), ) -> Result<PagedTableResult>

Source§

fn draw_table_with_hook( &mut self, page_id: ObjectId, table: Table, position: (f32, f32), hook: Option<&mut dyn TaggedCellHook>, ) -> Result<()>

Source§

fn draw_table_with_pagination_and_hook( &mut self, page_id: ObjectId, table: Table, position: (f32, f32), hook: Option<&mut dyn TaggedCellHook>, ) -> Result<PagedTableResult>

Implementors§