#![warn(missing_docs)]
#![warn(clippy::pedantic)]
#![deny(unsafe_code)]
#![allow(
clippy::uninlined_format_args,
clippy::manual_string_new,
clippy::cast_precision_loss,
clippy::doc_markdown,
clippy::write_with_newline,
clippy::items_after_statements
)]
pub use easypdf_core::*;
pub use easypdf_derive::PdfModel;
pub use easypdf_reader::{PdfReader, ReadStrategy};
pub use easypdf_core::{AtomicFileOutput, PdfInput, ResourceLimits};
pub use easypdf_core::io::guards::{guard_decompression_bomb, guard_element_explosion};
pub use easypdf_core::io::repair::{attempt_repair, is_likely_corrupt, RepairOptions};
pub use easypdf_core::io::ssrf_guard::validate_url as validate_io_url;
pub use easypdf_core::{
ImageData, ImageFormat, ListItem, PdfBlock, PdfBlockType, PdfDocumentModel, PdfPageModel,
SourceLocation,
};
pub use easypdf_writer::{PdfWriter, PdfWriterBuilder, WriteBackend};
pub use easypdf_reader::PdfManipulator;
pub use easypdf_writer::PdfTemplateFiller;
pub use easypdf_core::layout::Direction as LayoutDirection;
pub use easypdf_core::layout::FlowLayout;
#[cfg(feature = "markdown")]
pub use easypdf_markdown::{
ImagePolicy, MarkdownConversionResult, MarkdownExportReport, MarkdownExportResult,
MarkdownProcessorCapabilities, MarkdownProfile, MarkdownRenderer, MarkdownWarning, OcrPolicy,
PdfMarkdownBuilder, PdfMarkdownExportBuilder, PdfMarkdownProcessor, TablePolicy,
};
#[cfg(feature = "markdown")]
pub use easypdf_markdown::{
DetailedProcessorCapabilities, ProcessorCapability, ProcessorPipeline,
PRIORITY_GENERIC, PRIORITY_SPECIFIC,
};
#[cfg(feature = "markdown-table")]
pub use easypdf_markdown::table::{ColumnSeparator, TableDetectionConfig, TableDetectorProcessor};
#[cfg(feature = "ocr")]
pub use easypdf_markdown::ocr::{OcrConfig, OcrEngine, OcrImage, OcrProcessor, OcrResult, OcrTrigger, WordBox};
#[cfg(feature = "ocr")]
pub use easypdf_ocr::{
AuthMethod as OcrAuthMethod, BackoffStrategy, HttpClientConfig as OcrHttpClientConfig,
HttpOcrEngine, OcrHttpError, RateLimitConfig,
};
#[cfg(feature = "render")]
pub use easypdf_markdown::render::{
Background, PdfRenderer, RenderBackend, RenderConfig, RenderedImage,
};
#[cfg(feature = "render")]
pub use easypdf_markdown::render::error::RenderError;
#[cfg(feature = "resident")]
pub use easypdf_runtime::resident::{
AutosaveMode, ResidentClient, ResidentConfig, ResidentServer,
};
#[cfg(feature = "resident")]
pub use easypdf_runtime::resident::serve as resident_serve;
#[cfg(feature = "resident")]
pub use easypdf_runtime::resident::try_attach as resident_try_attach;
#[cfg(feature = "mcp")]
pub use easypdf_runtime::mcp::McpServer;
mod builders;
pub use builders::{
PdfCreateBuilder, PdfImageBuilder, PdfManipulateBuilder, PdfPositionedTextBuilder,
PdfReadBuilder, PdfSplitBuilder, PdfTableBuilder, PdfTextBuilder,
};
mod pdf_fill_builder;
pub use pdf_fill_builder::PdfFillBuilder;
mod writer_helpers;
pub use writer_helpers::{write_table, PageNumberHandler};
pub mod prelude;
#[cfg(any(test, feature = "html"))]
mod html;
#[cfg(feature = "html")]
pub use html::HtmlToPdfBuilder;
#[cfg(any(test, feature = "html"))]
use html::markdown_to_html;
mod crypto_facade;
mod facade_features;
#[cfg(test)]
mod tests;
use std::path::{Path, PathBuf};
pub struct EasyPdf;
impl EasyPdf {
#[must_use = "builder method"]
pub fn create(path: impl Into<PathBuf>) -> PdfCreateBuilder {
PdfCreateBuilder::new(path)
}
#[cfg(feature = "html")]
pub fn from_html(html: &str) -> crate::Result<HtmlToPdfBuilder> {
Ok(HtmlToPdfBuilder::new(html))
}
#[cfg(feature = "html")]
pub fn from_markdown(md: &str) -> crate::Result<HtmlToPdfBuilder> {
let html = markdown_to_html(md);
Ok(HtmlToPdfBuilder::new(&html))
}
#[must_use = "builder method"]
pub fn read(path: impl Into<PathBuf>) -> PdfReadBuilder {
PdfReadBuilder::new(path)
}
#[cfg(feature = "markdown")]
#[must_use = "builder method"]
pub fn export_markdown(
input: impl Into<PathBuf>,
output: impl Into<PathBuf>,
) -> PdfMarkdownExportBuilder {
PdfMarkdownExportBuilder::new(input, output)
}
#[cfg(feature = "markdown")]
#[must_use = "builder method"]
pub fn to_markdown(input: impl Into<PathBuf>) -> PdfMarkdownBuilder {
PdfMarkdownBuilder::new(input)
}
pub fn merge(input_paths: &[impl AsRef<Path>], output: impl AsRef<Path>) -> Result<()> {
easypdf_reader::PdfManipulator::merge_files(input_paths, output)
}
#[must_use = "builder method"]
pub fn split(path: impl Into<PathBuf>) -> PdfSplitBuilder {
PdfSplitBuilder::new(path)
}
#[must_use = "builder method"]
pub fn manipulate(path: impl Into<PathBuf>) -> PdfManipulateBuilder {
PdfManipulateBuilder::new(path)
}
#[must_use = "builder method"]
pub fn fill_form(
template_path: impl Into<PathBuf>,
data: &dyn easypdf_core::PdfModel,
) -> PdfFillBuilder {
PdfFillBuilder::new(template_path, data)
}
}