Skip to content
This repository was archived by the owner on Dec 14, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/azds.yaml
**/bin
**/charts
**/docker-compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md
52 changes: 52 additions & 0 deletions PdfApi.Client/Class1.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
using System.Net.Http.Json;
using PdfApi.Shared;

namespace PdfApi.Client;
public static class Program
{
public static async Task Main(string[] args)
{
while (true)
{
try
{
HttpClient client = new HttpClient();
client.BaseAddress = new Uri("http://104.210.129.44:5000");
var wk = await client.PostAsJsonAsync("/wk", new WkPdfRequest()
{
Url =
"https://painel.teorico.com.br/Classes/presenceData/2e337e88-7587-4a70-8adb-0a7b7988be80?key=pdfExportInternalOnlyChangeThisLater&offset=0",
FooterRight = "[page]/[toPage]",
FooterLeft = "[datetime]",
Replacements = new Dictionary<string, string>
{
{"datetime", DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss")}
},
PageMargins = new Margins
{
Right = 4,
Left = 4
},
FooterSpacing = 3,
IsLowQuality = true,
NoOutline = true,
ImageDpi = 300,
DisableExternalLinks = true,
DisableInternalLinks = true,
ImageQuality = 80,
PrintMediaType = true,
Dpi = 70,
FooterLine = true
});

wk.EnsureSuccessStatusCode();
var content = await wk.Content.ReadAsByteArrayAsync();
File.WriteAllBytes("hello.pdf", content);
}
catch (Exception ex)
{
Console.WriteLine("Error");
}
}
}
}
14 changes: 14 additions & 0 deletions PdfApi.Client/PdfApi.Client.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<OutputType>Exe</OutputType>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\PdfApi.Shared\PdfApi.Shared.csproj" />
</ItemGroup>

</Project>
Empty file added PdfApi.Client/Program.cs
Empty file.
7 changes: 7 additions & 0 deletions PdfApi.Shared/ContentDisposition.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace PdfApi.Shared;

public enum ContentDisposition
{
Attachment = 0, // this is the default
Inline
}
10 changes: 10 additions & 0 deletions PdfApi.Shared/ImageFormat.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace PdfApi.Shared;

/// <summary>
/// Image output format
/// </summary>
public enum ImageFormat
{
jpeg,
png
}
24 changes: 24 additions & 0 deletions PdfApi.Shared/Margins.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
namespace PdfApi.Shared;

public class Margins
{
/// <summary>
/// Page bottom margin in mm.
/// </summary>
public int? Bottom { get; set; }

/// <summary>
/// Page left margin in mm.
/// </summary>
public int? Left { get; set; }

/// <summary>
/// Page right margin in mm.
/// </summary>
public int? Right { get; set; }

/// <summary>
/// Page top margin in mm.
/// </summary>
public int? Top { get; set; }
}
10 changes: 10 additions & 0 deletions PdfApi.Shared/Orientation.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace PdfApi.Shared;

/// <summary>
/// Page orientation.
/// </summary>
public enum Orientation
{
Landscape,
Portrait
}
9 changes: 9 additions & 0 deletions PdfApi.Shared/PdfApi.Shared.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

</Project>
157 changes: 157 additions & 0 deletions PdfApi.Shared/Size.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
namespace PdfApi.Shared;

/// <summary>
/// Page size.
/// </summary>
public enum Size
{
/// <summary>
/// 841 x 1189 mm
/// </summary>
A0,

/// <summary>
/// 594 x 841 mm
/// </summary>
A1,

/// <summary>
/// 420 x 594 mm
/// </summary>
A2,

/// <summary>
/// 297 x 420 mm
/// </summary>
A3,

/// <summary>
/// 210 x 297 mm
/// </summary>
A4,

/// <summary>
/// 148 x 210 mm
/// </summary>
A5,

/// <summary>
/// 105 x 148 mm
/// </summary>
A6,

/// <summary>
/// 74 x 105 mm
/// </summary>
A7,

/// <summary>
/// 52 x 74 mm
/// </summary>
A8,

/// <summary>
/// 37 x 52 mm
/// </summary>
A9,

/// <summary>
/// 1000 x 1414 mm
/// </summary>
B0,

/// <summary>
/// 707 x 1000 mm
/// </summary>
B1,

/// <summary>
/// 500 x 707 mm
/// </summary>
B2,

/// <summary>
/// 353 x 500 mm
/// </summary>
B3,

/// <summary>
/// 250 x 353 mm
/// </summary>
B4,

/// <summary>
/// 176 x 250 mm
/// </summary>
B5,

/// <summary>
/// 125 x 176 mm
/// </summary>
B6,

/// <summary>
/// 88 x 125 mm
/// </summary>
B7,

/// <summary>
/// 62 x 88 mm
/// </summary>
B8,

/// <summary>
/// 33 x 62 mm
/// </summary>
B9,

/// <summary>
/// 31 x 44 mm
/// </summary>
B10,

/// <summary>
/// 163 x 229 mm
/// </summary>
C5E,

/// <summary>
/// 105 x 241 mm - U.S. Common 10 Envelope
/// </summary>
Comm10E,

/// <summary>
/// 110 x 220 mm
/// </summary>
Dle,

/// <summary>
/// 190.5 x 254 mm
/// </summary>
Executive,

/// <summary>
/// 210 x 330 mm
/// </summary>
Folio,

/// <summary>
/// 431.8 x 279.4 mm
/// </summary>
Ledger,

/// <summary>
/// 215.9 x 355.6 mm
/// </summary>
Legal,

/// <summary>
/// 215.9 x 279.4 mm
/// </summary>
Letter,

/// <summary>
/// 279.4 x 431.8 mm
/// </summary>
Tabloid
}
Loading