Module: PdfOxide

Defined in:
lib/pdf_oxide.rb,
lib/pdf_oxide.rb,
lib/pdf_oxide/pdf.rb,
lib/pdf_oxide/errors.rb,
lib/pdf_oxide/version.rb,
lib/pdf_oxide/pdf_page.rb,
lib/pdf_oxide/pdf_policy.rb,
lib/pdf_oxide/pdf_signer.rb,
lib/pdf_oxide/ffi/library.rb,
lib/pdf_oxide/ffi/bindings.rb,
lib/pdf_oxide/pdf_document.rb,
lib/pdf_oxide/pdf_validator.rb,
lib/pdf_oxide/auto_extractor.rb,
lib/pdf_oxide/document_editor.rb,
lib/pdf_oxide/markdown_converter.rb,
lib/pdf_oxide/ffi/string_marshaller.rb

Defined Under Namespace

Modules: FFI, MarkdownConverter, PdfPolicy, PdfValidator Classes: ArgumentError, AutoExtractor, ComplianceError, DocumentEditor, EncryptedError, Error, FileNotFoundError, InternalError, InvalidStateError, IoError, ParseError, Pdf, PdfDocument, PdfPage, PdfSigner, PermissionError, RedactionError, SearchError, SignatureError, StateError, UnsupportedFeatureError, UnsupportedPlatformError

Constant Summary collapse

Bindings =

Convenience constants reaching into the FFI sub-module. Keeps downstream callers free of the ‘PdfOxide::FFI::` prefix when accessing the binding layer; matches the Java binding’s flat shape.

FFI::Bindings
StringMarshaller =
FFI::StringMarshaller
VERSION =
'0.3.69'

Class Method Summary collapse

Class Method Details

.open(source, password: nil, &block) ⇒ PdfDocument

Open a PDF for reading.

Returns:



51
52
53
# File 'lib/pdf_oxide.rb', line 51

def open(source, password: nil, &block)
  PdfDocument.open(source, password: password, &block)
end

.set_max_ops_per_stream(limit) ⇒ Integer

Set the process-global content-stream operator cap.

A negative ‘limit` restores the default (1,000,000); any non-negative value (including 0) becomes the explicit cap.

Parameters:

  • limit (Integer)

Returns:

  • (Integer)

    the previous cap (or -1 if the default was active).



67
68
69
# File 'lib/pdf_oxide.rb', line 67

def set_max_ops_per_stream(limit)
  Bindings.pdf_oxide_set_max_ops_per_stream(Integer(limit))
end

.set_preserve_unmapped_glyphs(preserve) ⇒ Integer

Toggle the process-global U+FFFD (unmapped-glyph) preservation flag used by the high-level text extraction accessors.

Parameters:

  • preserve (Boolean, Integer)

    truthy / non-zero = preserve, falsey / 0 = filter (the v0.3.54 default).

Returns:

  • (Integer)

    the previous value (‘0` or `1`).



77
78
79
80
81
82
# File 'lib/pdf_oxide.rb', line 77

def set_preserve_unmapped_glyphs(preserve)
  # preserve may be Boolean or Integer; avoid numeric predicates that
  # would raise on a Boolean (e.g. true.zero?). falsey / 0 = filter.
  flag = [false, nil, 0].include?(preserve) ? 0 : 1
  Bindings.pdf_oxide_set_preserve_unmapped_glyphs(flag)
end

.versionString

Returns library version.

Returns:

  • (String)

    library version.



56
57
58
# File 'lib/pdf_oxide.rb', line 56

def version
  VERSION
end