mod pdf_builder;
pub use pdf_builder::{Pdf, PdfBuilder, PdfConfig};
pub use crate::editor::{
AnnotationId, AnnotationWrapper, ElementId, ImageInfo, PdfElement, PdfImage, PdfPage, PdfPath,
PdfStructure, PdfTable, PdfText,
};
pub use crate::editor::{EncryptionAlgorithm, EncryptionConfig, Permissions};
pub use crate::writer::{
Annotation, CaretAnnotation, FileAttachmentAnnotation, FreeTextAnnotation, HighlightMode,
InkAnnotation, LineAnnotation, LinkAction, LinkAnnotation, PolygonAnnotation, PopupAnnotation,
RedactAnnotation, ShapeAnnotation, StampAnnotation, StampType, TextAnnotation,
TextMarkupAnnotation, WatermarkAnnotation,
};
pub use crate::document::ReadingOrder;
pub use crate::geometry::Rect;
pub use crate::elements::{ImageContent, PathContent, TableContent, TextContent};
pub use crate::extractors::page_labels::{PageLabelExtractor, PageLabelRange, PageLabelStyle};
pub use crate::writer::PageLabelsBuilder;
pub use crate::extractors::xmp::{XmpExtractor, XmpMetadata};
pub use crate::writer::{iso_timestamp, XmpWriter};
pub use crate::search::{SearchOptions, SearchResult, TextSearcher};
pub use crate::writer::{AFRelationship, EmbeddedFile, EmbeddedFilesBuilder};
#[cfg(feature = "rendering")]
pub use crate::rendering::{ImageFormat, PageRenderer, RenderOptions, RenderedImage};
#[cfg(feature = "rendering")]
pub use crate::debug::{DebugOptions, DebugVisualizer, ElementColors};
pub use crate::compliance::{
validate_pdf_a, ComplianceError, ComplianceWarning, ErrorCode, PdfALevel, PdfAPart,
PdfAValidator, ValidationResult, ValidationStats, WarningCode,
};
pub use crate::xfa::{
add_converted_field, add_converted_page, analyze_xfa_document, convert_xfa_document,
ConvertedField, ConvertedPage, XfaAnalysis, XfaConversionOptions, XfaConversionResult,
XfaConverter, XfaExtractor, XfaField, XfaFieldType, XfaForm, XfaOption, XfaPage, XfaParser,
};
#[cfg(not(target_arch = "wasm32"))]
pub fn merge_pdfs<P: AsRef<std::path::Path>>(paths: &[P]) -> crate::error::Result<Vec<u8>> {
if paths.is_empty() {
return Err(crate::error::Error::InvalidPdf("No PDF paths provided".to_string()));
}
let first = crate::document::PdfDocument::open(paths[0].as_ref())?;
let mut editor = crate::editor::DocumentEditor::from_document(first)?;
for path in &paths[1..] {
editor.merge_from(path)?;
}
editor.save_to_bytes()
}