-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplifying the proof of concept project; Updating dependencies; Upda…
…ting .net;
- Loading branch information
Showing
255 changed files
with
165 additions
and
106,376 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[*.cs] | ||
|
||
# CA2254: O modelo deve ser uma expressão estática | ||
dotnet_diagnostic.CA2254.severity = none | ||
|
||
# IDE0290: Usar construtor primário | ||
csharp_style_prefer_primary_constructors = false | ||
|
||
# IDE0160: Converter para bloquear o namespace com escopo | ||
csharp_style_namespace_declarations = file_scoped |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -348,3 +348,6 @@ MigrationBackup/ | |
|
||
# Ionide (cross platform F# VS Code tools) working folder | ||
.ionide/ | ||
|
||
# .vscode folder | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,94 +1,19 @@ | ||
# POC.Rotativa.AspNetCore | ||
|
||
## Application: | ||
|
||
This application contains an example of using the Rotativa.AspNetCore library, which converts a static view or a view with dynamic data into .pdf. | ||
|
||
--- | ||
|
||
## Frameworks: | ||
- .Net Core 2.1 | ||
- .Net Core 3.1 | ||
- .Net 5 | ||
- .Net 6 | ||
## Framework: | ||
|
||
- .Net 9 | ||
|
||
--- | ||
|
||
## Libraries (only most important): | ||
|
||
- Bootstrap | ||
- Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation | ||
- Rotativa.AspNetCore | ||
|
||
--- | ||
|
||
## How to configure and use: | ||
1. Create an Asp.Net Core Web Project | ||
|
||
2. Download the `Rotativa.AspNetCore` package via NuGet | ||
|
||
3. Create a folder in `wwwroot` called `rotativa-aspnetcore` | ||
|
||
4. Copy the following files to the folder: | ||
- `help-wkhtmltoimage.txt` | ||
- `help-wkhtmltopdf.txt` | ||
- `wkhtmltoimage.exe` | ||
- `wkhtmltopdf.exe` | ||
|
||
5. **Observation:** For each version of .Net an MVC and Environment configuration must be used. | ||
|
||
In the `Startup.cs` file, add in the `Configure` method, the line of code: | ||
|
||
```c# | ||
RotativaConfiguration.Setup(env.WebRootPath, @"lib/rotativa-aspnetcore"); | ||
``` | ||
|
||
For example: | ||
|
||
```c# | ||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) | ||
{ | ||
if (env.IsDevelopment()) | ||
{ | ||
app.UseDeveloperExceptionPage(); | ||
} | ||
else | ||
{ | ||
app.UseExceptionHandler("/Home/Error"); | ||
app.UseHsts(); | ||
} | ||
|
||
app.UseHttpsRedirection(); | ||
app.UseStaticFiles(); | ||
|
||
app.UseRouting(); | ||
|
||
app.UseAuthorization(); | ||
|
||
app.UseEndpoints(endpoints => | ||
{ | ||
endpoints.MapControllerRoute("default", "{controller=Home}/{action=Index}/{id?}"); | ||
}); | ||
|
||
RotativaConfiguration.Setup(env.WebRootPath, @"lib/rotativa-aspnetcore"); | ||
} | ||
``` | ||
|
||
6. In the Controller, use the `ViewAsPdf()` command to generate the .pdf from a view, passing the view and an object as parameters if necessary. | ||
|
||
```c# | ||
public IActionResult Index() | ||
{ | ||
List<Client> clients = new List<Client>() | ||
{ | ||
new Client(){ Cpf="127.256.369.35", Name="Lucas Santos", Gender="Male", Age=23, Telephone="3841-3856" }, | ||
new Client(){ Cpf="185.989.636.85", Name="Júlia Almeida", Gender="Female", Age=13, Telephone="3142-3885" }, | ||
new Client(){ Cpf="589.245.854.14", Name="Carlos Cesar", Gender="Male", Age=35, Telephone="3885-1212" }, | ||
new Client(){ Cpf="753.357.147.25", Name="Altair Silva", Gender="Male", Age=58, Telephone="3696-1296" }, | ||
new Client(){ Cpf="441.258.369.85", Name="Ana Clara", Gender="Female", Age=21, Telephone="3758-4745" }, | ||
new Client(){ Cpf="758.969.354.14", Name="Lara Magalhães", Gender="Female", Age=18, Telephone="3996-6658" }, | ||
new Client(){ Cpf="894.758.263.21", Name="Ronaldo Santos", Gender="Male", Age=40, Telephone="3745-7585" }, | ||
new Client(){ Cpf="141.456.251.32", Name="Marcus Vinícius", Gender="Male", Age=32, Telephone="3442-3365" } | ||
}; | ||
|
||
return new ViewAsPdf("Index", clients); | ||
} | ||
``` | ||
- Rotativa.AspNetCore |
33 changes: 0 additions & 33 deletions
33
src/POC.Rotativa.AspNetCore.Net5/Controllers/HomeController.cs
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
src/POC.Rotativa.AspNetCore.Net5/POC.Rotativa.AspNetCore.Net5.csproj
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
src/POC.Rotativa.AspNetCore.Net5/Properties/launchSettings.json
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.