Files
pdf/engine/include/pdfengine/content_stream.hpp
T
2026-06-16 19:06:48 +05:30

36 lines
1.1 KiB
C++

#pragma once
#include <string>
#include <vector>
namespace pdfengine {
/// Result of extracting a raw PDF content stream from a page.
/// rawContent — bytes as-found in the PDF (may be compressed)
/// decodedContent — after applying all /Filter chains (FlateDecode, etc.)
/// pageIndex — 0-based page index
/// filters — list of filter names applied, e.g. {"FlateDecode"}
/// compressed — true if at least one filter was applied
struct ExtractedStream {
std::string rawContent;
std::string decodedContent;
int pageIndex = 0;
std::vector<std::string> filters;
bool compressed = false;
bool multiStream = false;
};
/// Verifies structural integrity of a decoded content stream.
/// Returns true if all of: BT, ET, Tf, Tj/TJ are present.
struct StreamVerification {
bool hasBT = false;
bool hasET = false;
bool hasTf = false;
bool hasTj = false; // Tj or TJ
bool multiStream = false; // page had multiple /Contents streams
};
StreamVerification verifyContentStream(const ExtractedStream& stream);
} // namespace pdfengine