-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial support for Pdf reports in PDF/A 1A and 1B (#762)
* Initial support for PDF/A 1a and 1b for .NET and .NET Framework reports. * Initialize default complianceLevel with None (default used until now). * Do not check report name in test until while #761 is open. * Set sRGB Color Space Profile for PDFA_1B. * Turn off test of PDFA. It seems to cause a timeout when running on github actions.
- Loading branch information
1 parent
a9c0a9d
commit 1638203
Showing
10 changed files
with
398 additions
and
9 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
3 changes: 3 additions & 0 deletions
3
dotnet/src/dotnetcore/GxPdfReportsCS/Properties/AssemblyInfo.cs
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,3 @@ | ||
using System.Runtime.CompilerServices; | ||
|
||
[assembly: InternalsVisibleTo("DotNetCoreWebUnitTest")] |
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
Binary file added
BIN
+3.07 KB
dotnet/src/dotnetframework/GxPdfReportsCS/sRGB Color Space Profile.icm
Binary file not shown.
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
61 changes: 61 additions & 0 deletions
61
dotnet/test/DotNetCoreWebUnitTest/Middleware/WebReportTest.cs
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,61 @@ | ||
using System; | ||
using System.IO; | ||
using System.Net.Http; | ||
using System.Reflection; | ||
using System.Threading.Tasks; | ||
using Codeuctivity; | ||
using com.genexus.reports; | ||
using GeneXus.Metadata; | ||
using GeneXus.Programs; | ||
using Spire.Pdf; | ||
using Xunit; | ||
namespace xUnitTesting | ||
{ | ||
public class WebReportTest : MiddlewareTest | ||
{ | ||
public WebReportTest() : base() | ||
{ | ||
ClassLoader.FindType("apdfwebbasictest", "GeneXus.Programs", "apdfwebbasictest", Assembly.GetExecutingAssembly(), true);//Force loading assembly for webhook procedure | ||
ClassLoader.FindType("apdfwebwoutimage", "GeneXus.Programs", "apdfwebwoutimage", Assembly.GetExecutingAssembly(), true); | ||
server.AllowSynchronousIO = true; | ||
} | ||
[Fact(Skip = "temporary turned off due to timeout error")] | ||
public void TestPDFA() | ||
{ | ||
HttpClient client = server.CreateClient(); | ||
TestPDFA_1AB(client, "apdfwebbasictest.aspx", Spire.Pdf.PdfConformanceLevel.Pdf_A1A).GetAwaiter().GetResult(); | ||
TestPDFA_1AB(client, "apdfwebwoutimage.aspx", Spire.Pdf.PdfConformanceLevel.Pdf_A1A).GetAwaiter().GetResult(); | ||
PDFReportItextSharp.SetDefaultComplianceLevel(com.genexus.reports.PdfConformanceLevel.Pdf_A1B); | ||
TestPDFA_1AB(client, "apdfwebbasictest.aspx", Spire.Pdf.PdfConformanceLevel.Pdf_A1B).GetAwaiter().GetResult(); | ||
TestPDFA_1AB(client, "apdfwebwoutimage.aspx", Spire.Pdf.PdfConformanceLevel.Pdf_A1B).GetAwaiter().GetResult(); | ||
|
||
} | ||
async Task TestPDFA_1AB(HttpClient client, string serviceName, Spire.Pdf.PdfConformanceLevel expectedLevel) | ||
{ | ||
HttpResponseMessage response = await client.GetAsync(serviceName); | ||
response.EnsureSuccessStatusCode(); | ||
Assert.Equal(System.Net.HttpStatusCode.OK, response.StatusCode); | ||
String fileName = response.Content.Headers.ContentDisposition.FileName; | ||
//Assert.Equal("Report.pdf", fileName); | ||
using (var fs = new FileStream(fileName, FileMode.Create, FileAccess.Write, FileShare.None)) | ||
{ | ||
await response.Content.CopyToAsync(fs); | ||
} | ||
PdfDocument pdf = new PdfDocument(); | ||
pdf.LoadFromFile(fileName); | ||
Spire.Pdf.PdfConformanceLevel conformance = pdf.Conformance; | ||
|
||
Assert.True(expectedLevel == conformance, $"Conformance level is {conformance} but {expectedLevel} was expected"); | ||
|
||
PdfAValidator pdfAValidator = new PdfAValidator(); | ||
Report result = await pdfAValidator.ValidateWithDetailedReportAsync(fileName); | ||
bool isValid = await pdfAValidator.ValidateAsync(fileName); | ||
Assert.True(isValid, result.RawOutput); | ||
|
||
|
||
|
||
} | ||
|
||
} | ||
|
||
} |
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,27 @@ | ||
ComplianceLevel= pdf_a1a | ||
JustifiedTypeAll= false | ||
OutputFileDirectory= . | ||
ServerPrinting= false | ||
EmbeedNotSpecifiedFonts= false | ||
Leading= 2 | ||
Embeed Fonts= false | ||
DottedStyle= 1;2 | ||
LeftMargin= 0.75 | ||
Barcode128AsImage= true | ||
LongDotDashedStyle= 6;2;1;2 | ||
DEBUG= false | ||
SearchNewFontsOnce= true | ||
TopMargin= 0.75 | ||
LongDashedStyle= 6;2 | ||
DashedStyle= 4;2 | ||
SearchNewFonts= false | ||
BottomMargin= 6 | ||
AdjustToPaper= true | ||
MarginsInsideBorder= false | ||
LineCapProjectingSquare= true | ||
RunDirection= 2 | ||
Version= 1.0.0.0 | ||
|
||
[Fonts Location (MS)] | ||
Microsoft Sans Serif= C:\Windows\fonts\micross.ttf | ||
Microsoft Sans Serif,Bold= C:\Windows\fonts\micross.ttf |
Oops, something went wrong.