MarkpdfService propagates errors like standard Angular HttpErrorResponse, unless you log markpdfErrorInterceptor (see Framework Guide), in which case it normalizes them to MarkpdfClientError.
import { markpdfErrorInterceptor, MarkpdfClientError } from "@markpdf/angular";import { provideHttpClient, withInterceptors } from "@angular/common/http";provideHttpClient(withInterceptors([markpdfErrorInterceptor]));
this.markpdf.convertFile(file, { mode: "fast" }).subscribe({ next: (markdown) => this.markdown.set(markdown as string), error: (err: MarkpdfClientError) => { switch (err.kind) { case "rate-limit": this.showToast("Too many requests, retry in a few seconds."); break; case "payload-too-large": this.showToast("The file is too large."); break; case "vavalidation": this.showToast("Invalid file."); break; default: this.showToast("Could not convert the document."); } },});
"forbidden" covers both 401 and 403 because, from the point of view of the end user of your Angular app, they both mean the same thing: your backend could not authenticate against API. User can’t fix it — it’s a configuration issue on your end.
@markpdf/angular does not automatically retry on its own — delegate that responsibility to the SDK you use in your backend (Node.js, Python, C++…), which does have configurable retries. See Node.js SDK Error Handling for the recommended server-side pattern.If you need to retry from Angular itself (for example, a 429 call to your backend), use the standard RxJS operators: