Skip to main content

select_compose_base

Function select_compose_base 

Source
pub fn select_compose_base<'a>(
    source: &'a [u8],
    annotation_pdf: &'a [u8],
) -> Result<&'a [u8], PdfEditError>
Expand description

Picks which bytes prepare_pdf_save should compose source_commands on top of. The frontend sends pdf.js’s saveDocument() output as annotation_pdf: a one-byte sentinel [0] when there are no annotation edits, or (per pdf.js’s own incremental-save format) the original file bytes verbatim followed by appended annotation objects/xref when there are. Composing on top of the annotation bytes (rather than discarding them) is what makes annotation edits survive Save.