Skip to main content

pdf_text_string

Function pdf_text_string 

Source
pub fn pdf_text_string(text: &str) -> Obj
Expand description

A string as pdfRepr writes Python text: ASCII as is, anything else as UTF-16BE with a byte-order mark.

use pltrs_render::{PdfObject, pdf_text_string};
assert_eq!(pdf_text_string("ab"), PdfObject::Str(b"ab".to_vec()));
assert_eq!(pdf_text_string("é"), PdfObject::Str(vec![0xfe, 0xff, 0, 0xe9]));