Skip to content

Commit 84cfd50

Browse files
authored
Document no parallelization support for PDFium (#162)
Added section explaining lack of parallelization support due to PDFium's thread-safety issues and suggested alternatives for processing multiple PDFs.
1 parent c3e7212 commit 84cfd50

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,15 @@ https://github.com/sungaila/PDFtoImage.git?path=etc/UnityPackage
4545
* [Universal Windows Platform (UWP)](https://learn.microsoft.com/en-us/windows/uwp/get-started/universal-application-platform-guide)
4646
* [Windows UI Library 3 (WinUI 3)](https://learn.microsoft.com/en-us/windows/apps/winui/winui3/)
4747

48+
## No parallelization support
49+
The native PDFium library used by this project for rendering is **not thread-safe**. For that reason, all calls into PDFium are protected with locks.
50+
51+
This means that you can only process one PDF at a time.
52+
53+
If you need true parallel processing, you’ll have to spawn multiple processes and distribute the workload across them, then collect the results using inter-process communication (IPC) and appropriate serialization.
54+
55+
Ghostscript may be easier for this use case, since (under certain conditions) it can support multiple instances within the same process.
56+
4857
## Index and Range for .NET Framework
4958
[PolySharp](https://github.com/Sergio0694/PolySharp) is used to enable the use of `System.Index` and `System.Range` in .NET Framework projects. As a side effect, the following classes are generated and exposed, which **should not be** used directly by your project:
5059
- `System.Index`

0 commit comments

Comments
 (0)