Brings PDF.js to .net
- Renders each page of a PDF to PNGs
get
- NodeJs
- node 20 or 22 x64 (older node versions are supported by older PDFjsSharp versions)
- Install nuget package PdfjsSharp
using var rasterizer = new Rasterizer();
var actualImages = await rasterizer.ConvertToPngAsync(@"../../../SourceTest.pdf", actualImagePath);
Assert.Equal(1, actualImages.Count);
get .net 8 sdk
- npx npm-check --update-all --skip-unused
cd .\PdfjsSharp\
nvm install 22;nvm use 22;rm -R .\node_modules\;npm install --omit=dev;rm .\node_modules.win.node22.zip;Compress-Archive -LiteralPath .\node_modules\ -DestinationPath .\node_modules.win.node22.zip;Compress-Archive -Update .\Rasterize.mjs .\node_modules.win.node22.zip
#In case you have no nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash
exit
nvm install 22
sudo apt install dotnet8 zip
nvm install 22
nvm use 22
rm -R ./node_modules/
npm install --omit=dev && rm node_modules.linux.node22.zip && zip -r node_modules.linux.node22.zip node_modules && zip -g node_modules.linux.node22.zip Rasterize.mjs