StartRenderPageJob
Document inspection, Rendering
Description
Starts a background job that renders a page of a PDF file without blocking the caller's thread
Because TPDFlib is not thread-safe, the job creates an isolated instance from the same source file and runs on a system task, so a large page can no longer own the host thread until it finishes
The job threads a cancel flag and a manual-reset pause gate into the renderer, which polls them between content-stream operators; this is what lets PauseRenderJob, ResumeRenderJob and CancelRenderJob interrupt a single in-flight page
Syntax
Delphi
Function TPDFlib.StartRenderPageJob(Const FileName, Password, OutputFileName: WideString; DPI: Double; Page, Options: Integer): Integer;DLL
int DLStartRenderPageJob(int InstanceID, const wchar_t* FileName, const wchar_t* Password, const wchar_t* OutputFileName, double DPI, int Page, int Options);ActiveX
Function PDFlib::StartRenderPageJob(FileName As String, Password As String, OutputFileName As String, DPI As Double, Page As Long, Options As Long) As LongParameters
| FileName | The source PDF file path |
|---|---|
| Password | The document password, or an empty string when the PDF is not encrypted |
| OutputFileName | The destination image path; the format follows Options as in RenderPageToFile |
| DPI | The render resolution |
| Page | The 1-based page number to render |
| Options | The image format option passed straight to RenderPageToFile |
Return values
| >0 | A 1-based job handle for use with the render-job control methods |
|---|---|
| 0 | The job could not be started |
Remarks
Poll progress with GetRenderJobState and block with WaitForRenderJob; both return the RENDER_JOB_STATE_* codes
Use PauseRenderJob, ResumeRenderJob and CancelRenderJob to interrupt a running page without losing the worker thread
The instance that started the job owns it; freeing the instance joins outstanding jobs, so a half-finished page never outlives its owner