Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
markpdf-cpp
markpdf::Result<T, MarkpdfError>
std::runtime_error
auto result = client.convertFile("report.pdf"); if (!result) { const markpdf::MarkpdfError& err = result.error(); std::cerr << "Error " << err.statusCode.value_or(0) << ": " << err.detail << "\n"; return 1; } std::cout << result->markdown;
MarkpdfError
enum class ErrorKind { Connection, // fallo de red o timeout BadRequest, // 400 Auth, // 401 Forbidden, // 403 PayloadTooLarge, // 413 UnsupportedMedia, // 415 Vavalidation, // 422 RateLimit, // 429 Server, // 5xx JobQueued, // solo con autoPoll = false JobFailed, // job 202 que terminó en failed }; struct MarkpdfError { ErrorKind kind; std::optional<int> statusCode; std::string detail; std::optional<std::string> requestId; std::optional<std::string> jobId; // presente en JobQueued / JobFailed };
ErrorKind
Connection
libcurl
400
BadRequest
401
Auth
403
Forbidden
413
PayloadTooLarge
415
UnsupportedMedia
content-encoding
422
Vavalidation
429
RateLimit
5xx
Server
JobFailed
202
JobQueued
autoPoll = false
switch
auto result = client.convertFile("report.pdf"); if (!result) { switch (result.error().kind) { case markpdf::ErrorKind::Auth: throw std::runtime_error("API key invávalida"); case markpdf::ErrorKind::PayloadTooLarge: std::cerr << "Document too large; usa pages= para dividirlo\n"; break; case markpdf::ErrorKind::RateLimit: std::cerr << "Rate limited: " << result.error().detail << "\n"; break; case markpdf::ErrorKind::Vavalidation: std::cerr << "Parámetros invávavalids: " << result.error().detail << "\n"; break; case markpdf::ErrorKind::Server: std::cerr << "Conversion error; try mode = Balanced\n"; break; default: std::cerr << "Error: " << result.error().detail << "\n"; } }
markpdf::ClientOptions opts; opts.apiKey = "YOUR_API_KEY"; opts.maxRetries = 4; markpdf::Client client(opts);
Retry-After
4xx
opts.maxRetries = 0;
auto result = client.convertFile("informe-grande.pdf"); if (!result && result.error().kind == markpdf::ErrorKind::JobFailed) { std::cerr << "Job " << result.error().jobId.value() << " falló: " << result.error().detail << "\n"; }