forked from VahidN/iTextSharp.LGPLv2.Core
-
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.
Merge branch 'master' of https://github.com/VahidN/iTextSharp.LGPLv2.…
- Loading branch information
Showing
4 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
src/iTextSharp.LGPLv2.Core.FunctionalTests/Issues/Issue16.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,39 @@ | ||
using System; | ||
using System.Collections; | ||
using System.IO; | ||
using iTextSharp.text.pdf; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
namespace iTextSharp.LGPLv2.Core.FunctionalTests.Issues | ||
{ | ||
/// <summary> | ||
/// https://github.com/VahidN/iTextSharp.LGPLv2.Core/issues/16 | ||
/// </summary> | ||
[TestClass] | ||
public class Issue16 | ||
{ | ||
[TestMethod] | ||
public void Verify_Issue16_CanBe_Processed() | ||
{ | ||
var pdfFilePath = TestUtils.GetOutputFileName(); | ||
var stream = new FileStream(pdfFilePath, FileMode.Create); | ||
|
||
var path = TestUtils.GetPdfsPath("issue16.pdf"); | ||
var reader = new PdfReader(path); | ||
var stamper = new PdfStamper(reader, stream); | ||
|
||
var form = stamper.AcroFields; | ||
|
||
foreach (DictionaryEntry field in form.Fields) | ||
{ | ||
Console.WriteLine(field.Key); | ||
} | ||
|
||
form.SetField("Text Field0", "Value 1"); | ||
|
||
stamper.Close(); | ||
reader.Close(); | ||
stream.Dispose(); | ||
} | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
src/iTextSharp.LGPLv2.Core.FunctionalTests/Issues/Issue17.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,49 @@ | ||
using System.IO; | ||
using iTextSharp.text; | ||
using iTextSharp.text.pdf; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
namespace iTextSharp.LGPLv2.Core.FunctionalTests.Issues | ||
{ | ||
/// <summary> | ||
/// https://github.com/VahidN/iTextSharp.LGPLv2.Core/issues/17 | ||
/// </summary> | ||
[TestClass] | ||
public class Issue17 | ||
{ | ||
[TestMethod] | ||
public void Verify_Issue17_CanBe_Processed() | ||
{ | ||
var pdfDoc = new Document(PageSize.A4); | ||
|
||
var pdfFilePath = TestUtils.GetOutputFileName(); | ||
var fileStream = new FileStream(pdfFilePath, FileMode.Create); | ||
PdfWriter.GetInstance(pdfDoc, fileStream); | ||
|
||
pdfDoc.AddAuthor(TestUtils.Author); | ||
pdfDoc.Open(); | ||
|
||
var image = Image.GetInstance(TestUtils.GetImagePath("loa.jpg")); | ||
image.WidthPercentage = 60; | ||
image.Alignment = Element.ALIGN_RIGHT; | ||
|
||
var table = new PdfPTable(numColumns: 3); | ||
var cell = new PdfPCell(/*image: image, fit: false*/) | ||
{ | ||
Colspan = 2, | ||
//Border = 0, | ||
HorizontalAlignment = Element.ALIGN_RIGHT | ||
}; | ||
cell.AddElement(image); | ||
table.AddCell(cell); | ||
table.AddCell(new PdfPCell(new Phrase("Test..."))); | ||
|
||
pdfDoc.Add(table); | ||
|
||
pdfDoc.Close(); | ||
fileStream.Dispose(); | ||
|
||
TestUtils.VerifyPdfFileIsReadable(pdfFilePath); | ||
} | ||
} | ||
} |
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
+143 KB
src/iTextSharp.LGPLv2.Core.FunctionalTests/iTextExamples/resources/pdfs/issue16.pdf
Binary file not shown.