2

I was trying to find a way to build a pdf from a html code with .net core 2, I found a way to do it with some node.js libaries(that works local) but when publish the project and install in IIS doesn't work

this is my package.json

{
  "name": "",
  "version": "",
  "dependencies": {
    "jsreport-core": "^1.5.1",
    "jsreport-jsrender": "^1.0.2",
    "jsreport-phantom-pdf": "^1.4.6"
  }
}

this is my csproj file

  <PropertyGroup>
    <TargetFramework>netcoreapp2.0</TargetFramework>
    <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
    <ApplicationIcon />
    <OutputType>Exe</OutputType>
    <StartupObject />
    <TypeScriptToolsVersion>2.5</TypeScriptToolsVersion>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
    <PlatformTarget>x86</PlatformTarget>
    <DebugType>full</DebugType>
    <DebugSymbols>true</DebugSymbols>
  </PropertyGroup>

  <ItemGroup>
    <Compile Remove="obj\**" />
    <Content Remove="obj\**" />
    <EmbeddedResource Remove="obj\**" />
    <None Remove="obj\**" />
  </ItemGroup>

  <ItemGroup>
    <Folder Include="wwwroot\uploads\banner\" />   
  </ItemGroup>

  <ItemGroup>

    <PackageReference Include="AutoMapper" Version="6.2.2" />
    <PackageReference Include="FluentValidation.AspNetCore" Version="7.4.0" />
    <PackageReference Include="JWT" Version="3.1.1" />
    <PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.3" />
    <PackageReference Include="Microsoft.AspNetCore.NodeServices" Version="2.0.2" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.0.1" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.Design" Version="1.1.4" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.0.1" />
    <PackageReference Include="Microsoft.IdentityModel.Tokens" Version="5.2.0" />
    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.0.0" />
    <Content Include="node_modules\foo\**" CopyToPublishDirectory="PreserveNewest" />
    <Content Include="node_modules\**" />
    <Content Include=".\pdf.js" />
  </ItemGroup>

  <ItemGroup>
    <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.1" />
  </ItemGroup>

  <PropertyGroup Condition="'$(Configuration)' == 'Debug'">
    <TypeScriptTarget>ES5</TypeScriptTarget>
    <TypeScriptJSXEmit>None</TypeScriptJSXEmit>
    <TypeScriptModuleKind />
    <TypeScriptCompileOnSaveEnabled>True</TypeScriptCompileOnSaveEnabled>
    <TypeScriptNoImplicitAny>False</TypeScriptNoImplicitAny>
    <TypeScriptRemoveComments>False</TypeScriptRemoveComments>
    <TypeScriptOutFile />
    <TypeScriptOutDir />
    <TypeScriptGeneratesDeclarations>False</TypeScriptGeneratesDeclarations>
    <TypeScriptNoEmitOnError>True</TypeScriptNoEmitOnError>
    <TypeScriptSourceMap>True</TypeScriptSourceMap>
    <TypeScriptMapRoot />
    <TypeScriptSourceRoot />
  </PropertyGroup>

</Project>

the error is "cannot find module 'jsreport-core'"

2
  • It seems that not every package got copied. Shouldn't you have CopyToPublishDirectory="PreserveNewest"in <Content Include="node_modules"? Commented Mar 3, 2018 at 20:46
  • just FYI here you can find how to use jsreport-core without node service. Commented Mar 6, 2018 at 16:19

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.