pub struct PdfPreprocessor { /* private fields */ }Expand description
PDF Preprocessor with pluggable backend
Processes PDF documents through two stages:
- Backend extraction: PDF bytes → Blazegraph XHTML
- XHTML parsing: Blazegraph XHTML → PreprocessorOutput
Implementations§
Source§impl PdfPreprocessor
impl PdfPreprocessor
Sourcepub fn new_with_jni(
jre_path: &Path,
jar_path: &Path,
) -> Result<PdfPreprocessor, Error>
pub fn new_with_jni( jre_path: &Path, jar_path: &Path, ) -> Result<PdfPreprocessor, Error>
Create PdfPreprocessor with JNI backend (default JVM settings)
§Arguments
jre_path- Path to JRE directoryjar_path- Path to blazing-tika.jar
Sourcepub fn new_with_jni_args(
jre_path: &Path,
jar_path: &Path,
jvm_args: &[String],
) -> Result<PdfPreprocessor, Error>
pub fn new_with_jni_args( jre_path: &Path, jar_path: &Path, jvm_args: &[String], ) -> Result<PdfPreprocessor, Error>
Create PdfPreprocessor with JNI backend and custom JVM arguments
§Arguments
jre_path- Path to JRE directoryjar_path- Path to blazing-tika.jarjvm_args- Additional JVM arguments (e.g., “-Xmx4g”, “-XX:+UseG1GC”)
§Example
ⓘ
let jvm_args = vec![
"-Xms1g".to_string(),
"-Xmx4g".to_string(),
"-XX:+UseG1GC".to_string(),
"-XX:MaxGCPauseMillis=100".to_string(),
];
let preprocessor = PdfPreprocessor::new_with_jni_args(&jre_path, &jar_path, &jvm_args)?;Sourcepub fn backend_name(&self) -> &str
pub fn backend_name(&self) -> &str
Get the backend name for logging
Sourcepub fn is_healthy(&self) -> bool
pub fn is_healthy(&self) -> bool
Check if the backend is healthy
Trait Implementations§
Source§impl Preprocessor for PdfPreprocessor
impl Preprocessor for PdfPreprocessor
Source§fn parse_pdf_to_markup_language(
&self,
pdf_bytes: &[u8],
) -> Result<String, Error>
fn parse_pdf_to_markup_language( &self, pdf_bytes: &[u8], ) -> Result<String, Error>
Step 1: Extract PDF to XHTML via backend
Source§fn parse_markup_to_preprocessor_output(
&self,
markup: &str,
) -> Result<PreprocessorOutput, Error>
fn parse_markup_to_preprocessor_output( &self, markup: &str, ) -> Result<PreprocessorOutput, Error>
Step 2: Parse XHTML to PreprocessorOutput
Source§fn supports_file_type(&self, path: &Path) -> bool
fn supports_file_type(&self, path: &Path) -> bool
Check if preprocessor supports the given file type
Source§fn process(&self, document_bytes: &[u8]) -> Result<PreprocessorOutput, Error>
fn process(&self, document_bytes: &[u8]) -> Result<PreprocessorOutput, Error>
Convenience method: Full document processing (combines both steps) Read more
Source§fn process_file(&self, input: &Path) -> Result<PreprocessorOutput, Error>
fn process_file(&self, input: &Path) -> Result<PreprocessorOutput, Error>
Convenience method: Process from file path Read more
Auto Trait Implementations§
impl Freeze for PdfPreprocessor
impl RefUnwindSafe for PdfPreprocessor
impl Send for PdfPreprocessor
impl Sync for PdfPreprocessor
impl Unpin for PdfPreprocessor
impl UnsafeUnpin for PdfPreprocessor
impl UnwindSafe for PdfPreprocessor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more