pdfium_render/pdf/document/page/object/content_mark.rs
1//! Defines the [PdfContentMark] struct, a content marker capable of carrying metadata
2//! that can be attached to one or more [PdfPageObject] objects to apply logical groupings
3//! or organizational structure to a [PdfDocument].
4
5use crate::{bindgen::FPDF_PAGEOBJECTMARK, pdfium::PdfiumLibraryBindingsAccessor};
6use std::marker::PhantomData;
7
8#[cfg(doc)]
9use crate::pdf::document::{page::object::PdfPageObject, PdfDocument};
10
11/// A content marker identifying one or more [PdfPageObject] objects as "elements of interest"
12/// to a particular application or extension. Content markers can be used to attach metadata
13/// to single objects or groups of objects, and to organize rendered page objects into
14/// logical groupings or associations that may not necessarily be displayed during rendering
15/// but may have special significance to a processing application.
16///
17/// More information on content markers and PDF's concept of "marked content" in general
18/// in The PDF Reference, Sixth Edition, in Section 10.5, beginning on page 850.
19pub struct PdfPageObjectMark<'a> {
20 handle: FPDF_PAGEOBJECTMARK,
21 lifetime: PhantomData<&'a FPDF_PAGEOBJECTMARK>,
22}
23
24impl<'a> PdfPageObjectMark<'a> {
25 pub(crate) fn from_pdfium(handle: FPDF_PAGEOBJECTMARK) -> Self {
26 PdfPageObjectMark {
27 handle,
28 lifetime: PhantomData,
29 }
30 }
31
32 /// Returns the internal `FPDF_PAGEOBJECTMARK` handle for this [PdfContentMark].
33 #[inline]
34 pub(crate) fn handle(&self) -> FPDF_PAGEOBJECTMARK {
35 self.handle
36 }
37}
38
39impl<'a> PdfiumLibraryBindingsAccessor<'a> for PdfPageObjectMark<'a> {}
40
41#[cfg(feature = "thread_safe")]
42unsafe impl<'a> Send for PdfPageObjectMark<'a> {}
43
44#[cfg(feature = "thread_safe")]
45unsafe impl<'a> Sync for PdfPageObjectMark<'a> {}