Skip to content

Latest commit

 

History

History
60 lines (40 loc) · 1.87 KB

README.md

File metadata and controls

60 lines (40 loc) · 1.87 KB

PDFjsSharp

Nuget Build Donate

Brings PDF.js to .net

Feature

  • Renders each page of a PDF to PNGs

Dependencies

get

  • NodeJs
    • node 20 or 22 x64 (older node versions are supported by older PDFjsSharp versions)

HowTo use

using var rasterizer = new Rasterizer();
var actualImages = await rasterizer.ConvertToPngAsync(@"../../../SourceTest.pdf", actualImagePath);
Assert.Equal(1, actualImages.Count);

Development

get .net 8 sdk

Upgrade npm packages

  • npx npm-check --update-all --skip-unused

Steps to update node_modules.win.*.zip

 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

Ubuntu 22.04

#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

Steps to update node_modules.linux.node*.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