Struct pdfium_render::pages::PdfPages
source · [−]pub struct PdfPages<'a> { /* private fields */ }Expand description
The collection of PdfPage objects inside a PdfDocument.
Implementations
sourceimpl<'a> PdfPages<'a>
impl<'a> PdfPages<'a>
sourcepub fn create_page_at_start(
&mut self,
size: PdfPagePaperSize
) -> Result<PdfPage<'_>, PdfiumError>
pub fn create_page_at_start(
&mut self,
size: PdfPagePaperSize
) -> Result<PdfPage<'_>, PdfiumError>
Creates a new, empty PdfPage with the given PdfPagePaperSize and inserts it at the start of this PdfPages collection, shuffling down all other pages.
sourcepub fn create_page_at_end(
&mut self,
size: PdfPagePaperSize
) -> Result<PdfPage<'_>, PdfiumError>
pub fn create_page_at_end(
&mut self,
size: PdfPagePaperSize
) -> Result<PdfPage<'_>, PdfiumError>
Creates a new, empty PdfPage with the given PdfPagePaperSize and adds it to the end of this PdfPages collection.
sourcepub fn create_page_at_index(
&mut self,
size: PdfPagePaperSize,
index: PdfPageIndex
) -> Result<PdfPage<'_>, PdfiumError>
pub fn create_page_at_index(
&mut self,
size: PdfPagePaperSize,
index: PdfPageIndex
) -> Result<PdfPage<'_>, PdfiumError>
Creates a new, empty PdfPage with the given PdfPagePaperSize and inserts it into this PdfPages collection at the given page index.
sourcepub fn delete_page_at_index(
&mut self,
index: PdfPageIndex
) -> Result<(), PdfiumError>
pub fn delete_page_at_index(
&mut self,
index: PdfPageIndex
) -> Result<(), PdfiumError>
Deletes the page at the given index from this PdfPages collection.
sourcepub fn copy_page_from_document(
&mut self,
source: &PdfDocument<'_>,
source_page_index: PdfPageIndex,
destination_page_index: PdfPageIndex
) -> Result<(), PdfiumError>
pub fn copy_page_from_document(
&mut self,
source: &PdfDocument<'_>,
source_page_index: PdfPageIndex,
destination_page_index: PdfPageIndex
) -> Result<(), PdfiumError>
Copies a single page with the given source page index from the given source PdfDocument, inserting it at the given destination page index in this PdfPages collection.
sourcepub fn copy_pages_from_document(
&mut self,
source: &PdfDocument<'_>,
pages: &str,
destination_page_index: PdfPageIndex
) -> Result<(), PdfiumError>
pub fn copy_pages_from_document(
&mut self,
source: &PdfDocument<'_>,
pages: &str,
destination_page_index: PdfPageIndex
) -> Result<(), PdfiumError>
Copies one or more pages, specified using a user-friendly page range string, from the given source PdfDocument, inserting the pages sequentially starting at the given destination page index in this PdfPages collection.
The page range string should be in a comma-separated list of indexes and ranges, for example "1,3,5-7". Pages are indexed starting at one, not zero.
sourcepub fn copy_page_range_from_document(
&mut self,
source: &PdfDocument<'_>,
source_page_range: RangeInclusive<PdfPageIndex>,
destination_page_index: PdfPageIndex
) -> Result<(), PdfiumError>
pub fn copy_page_range_from_document(
&mut self,
source: &PdfDocument<'_>,
source_page_range: RangeInclusive<PdfPageIndex>,
destination_page_index: PdfPageIndex
) -> Result<(), PdfiumError>
Copies one or more pages with the given range of indices from the given source PdfDocument, inserting the pages sequentially starting at the given destination page index in this PdfPages collection.
sourcepub fn tile_into_new_document(
&self,
rows_per_page: u8,
columns_per_row: u8,
size: PdfPagePaperSize
) -> Result<PdfDocument<'_>, PdfiumError>
pub fn tile_into_new_document(
&self,
rows_per_page: u8,
columns_per_row: u8,
size: PdfPagePaperSize
) -> Result<PdfDocument<'_>, PdfiumError>
Creates a new PdfDocument by copying the pages in this PdfPages collection into tiled grids, the size of tile each shrinking or expanding as necessary to fit the given PdfPagePaperSize.
For example, to output all pages in this PdfPages collection into a new A3 landscape document with six source pages tiled on each destination page arranged into a 2 row x 3 column grid, you would call:
PdfPages::tile_into_new_document(2, 3, PdfPagePaperSize::a3().to_landscape())sourcepub fn len(&self) -> PdfPageIndex
pub fn len(&self) -> PdfPageIndex
Returns the number of pages in this PdfPages collection.
sourcepub fn as_range(&self) -> Range<PdfPageIndex>
pub fn as_range(&self) -> Range<PdfPageIndex>
Returns a Range from 0..(number of pages) for this PdfPages collection.
sourcepub fn as_range_inclusive(&self) -> RangeInclusive<PdfPageIndex>
pub fn as_range_inclusive(&self) -> RangeInclusive<PdfPageIndex>
Returns an inclusive Range from 0..=(number of pages - 1) for this PdfPages collection.
sourcepub fn get(&self, index: PdfPageIndex) -> Result<PdfPage<'_>, PdfiumError>
pub fn get(&self, index: PdfPageIndex) -> Result<PdfPage<'_>, PdfiumError>
sourcepub fn page_mode(&self) -> PdfPageMode
pub fn page_mode(&self) -> PdfPageMode
Returns the PdfPageMode setting embedded in the containing PdfDocument.
sourcepub fn iter(&self) -> PdfPagesIterator<'_>ⓘNotable traits for PdfPagesIterator<'a>impl<'a> Iterator for PdfPagesIterator<'a> type Item = PdfPage<'a>;
pub fn iter(&self) -> PdfPagesIterator<'_>ⓘNotable traits for PdfPagesIterator<'a>impl<'a> Iterator for PdfPagesIterator<'a> type Item = PdfPage<'a>;
Returns an iterator over all the pages in this PdfPages collection.
Auto Trait Implementations
impl<'a> !RefUnwindSafe for PdfPages<'a>
impl<'a> !Send for PdfPages<'a>
impl<'a> !Sync for PdfPages<'a>
impl<'a> Unpin for PdfPages<'a>
impl<'a> !UnwindSafe for PdfPages<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more