ConversionPdf.h header

#include <ew/app/ConversionPdf.h>

Namespace ew::app

Enumerations

enum class PdfDisposition { Convert, Reference }

What the conversion should do with one PDF (docs/AI_FOLDER_CONVERSION.md §4 C11) – James's canonical example of a disposition question: a rulebook PDF should usually stay a reference, while notes exported to PDF should usually be converted like any other prose.

Functions

QString ew::app::extractPdfText(const QString &absolutePath, QString *errorMessage=nullptr)

Extracts the text of every page of the PDF at absolute path absolutePath (pages joined by blank lines, empty pages skipped) for the Convert disposition. A load failure returns empty text and sets errorMessage (when given); a PDF that loads but has no text layer (a pure scan) returns empty text with NO error, so the caller can fall back to Reference and say why.

PdfDisposition ew::app::inferredPdfDisposition(const QString &relativePath, int pageCount)

The role-inferred default disposition for the PDF at relativePath with pageCount pages (pass a negative count when unknown): Reference when the file name reads as a book/manual/rules reference or the page count is at/above kPdfReferencePageThreshold, Convert otherwise. Pure.

PdfDisposition ew::app::pdfDispositionFromChoice(int chosenOption)

Maps a resolved ConversionQuestion::chosenOption back to the disposition (option 1 = Reference; anything else = Convert, matching the option order).

ConversionQuestion ew::app::pdfDispositionQuestion(const QString &relativePath, int pageCount)

Builds the per-PDF disposition question (subject = relativePath; option 0 = convert, option 1 = reference) with inferredPdfDisposition as the recommended default. In supervised mode the wizard asks it; in autonomous mode the recommendation is taken; either way the choice is logged in the report. Pure.

int ew::app::pdfPageCount(const QString &absolutePath)

The page count of the PDF at absolute path absolutePath, or -1 when it cannot be loaded.

ConvertedSource ew::app::sourceForReferencedPdf(const QString &relativePath)

The research Source recorded for a PDF kept as a reference: titled by the file's stem (falling back to the file name), other fields left empty for the writer. Pure.

Constants

int ew::app::kPdfReferencePageThreshold = 50

Page count at or above which a PDF reads as a book/manual and defaults to Reference.