/// Returns the text contained within this [PdfPageTextObject].
Returns the text contained within this [PdfPageTextObject].
Returns the text contained within this [ PdfPageTextObject ] .
pub fn text(&self) -> String {
        // Retrieving the text from Pdfium is a two-step operation. First, we call
        // FPDFTextObj_GetText() with a null buffer; this will retrieve the length of
        // the text in bytes. If the length is zero, then there is no text associated
        // with the page object.
        // If the length is non-zero, then we reserve a byte buffer of the given
        // length and call FPDFTextObj_GetText() again with a pointer to the buffer;
        // this will write the text to the buffer in UTF16-LE format.
        if let Ok(page_text) = self.page.text() {
            let buffer_length = self.bindings.FPDFTextObj_GetText(
                self.handle,
                *page_text.get_handle(),
                std::ptr::null_mut(),
                0,
            );
            if buffer_length == 0 {
                // There is no text.
                return String::new();
            }
            let mut buffer = create_byte_buffer(buffer_length as usize);
            let result = self.bindings.FPDFTextObj_GetText(
                self.handle,
                *page_text.get_handle(),
                buffer.as_mut_ptr() as *mut FPDF_WCHAR,
                buffer_length,
            );
            assert_eq!(result, buffer_length);
            get_string_from_pdfium_utf16le_bytes(buffer).unwrap_or_default()
        } else {
            // The containing PdfPage does not have an FPDF_TEXTPAGE associated with it.
            String::new()
        }
    }
pub fn text ( & self ) -> String { // Retrieving the text from Pdfium is a two-step operation. First, we call // FPDFTextObj_GetText() with a null buffer; this will retrieve the length of // the text in bytes. If the length is zero, then there is no text associated // with the page object. // If the length is non-zero, then we reserve a byte buffer of the given // length and call FPDFTextObj_GetText() again with a pointer to the buffer; // this will write the text to the buffer in UTF16-LE format. if let Ok ( page_text ) = self . page . text ( ) { let buffer_length = self . bindings . FPDFTextObj_GetText ( self . handle , * page_text . get_handle ( ) , std :: ptr :: null_mut ( ) , 0 , ) ; if buffer_length == 0 { // There is no text. return String :: new ( ) ; } let mut buffer = create_byte_buffer ( buffer_length as usize ) ; let result = self . bindings . FPDFTextObj_GetText ( self . handle , * page_text . get_handle ( ) , buffer . as_mut_ptr ( ) as * mut FPDF_WCHAR , buffer_length , ) ; assert_eq ! ( result buffer_length ) ; get_string_from_pdfium_utf16le_bytes ( buffer ) . unwrap_or_default ( ) } else { // The containing PdfPage does not have an FPDF_TEXTPAGE associated with it. String :: new ( ) } }
Returns the text contained within this [PdfPageTextObject].
Returns the text contained within this [ PdfPageTextObject ] .
&self