Skip to main content

write_pdf_with_annotations

Function write_pdf_with_annotations 

Source
pub fn write_pdf_with_annotations(
    scene: &Scene,
    annotations: &[Annotation],
) -> Result<Vec<u8>, PdfError>
Expand description

Render a Scene in pages mode + a slice of Annotations and return the serialised PDF bytes.

Constraints:

  • scene must be in pages mode (same contract as crate::write_pdf_from_scene).
  • Each annotation’s source_page_index must be < scene.pages.len().

Wire-level shape: every annotation becomes one indirect dict carrying /Type /Annot /Subtype /X /Rect … per §12.5.2 Table 164 + the matching subtype’s §12.5.6.X table. Each page’s /Annots is the array of references to its annotations.