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.
Ported some missing map files from the https://github.com/LibrePDF/Op…
…enPDF project
- Loading branch information
Showing
179 changed files
with
303,041 additions
and
23,674 deletions.
There are no files selected for viewing
100 changes: 100 additions & 0 deletions
100
src/iTextSharp.LGPLv2.Core.FunctionalTests/Issues/Issue34.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,100 @@ | ||
using System; | ||
using System.Collections; | ||
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/34 | ||
/// </summary> | ||
[TestClass] | ||
public class Issue34 | ||
{ | ||
[TestMethod] | ||
public void Verify_Issue34_Create_Font_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(); | ||
|
||
// STSong-Light requires this language pack http://ardownload.adobe.com/pub/adobe/reader/win/AcrobatDC/misc/FontPack1900820071_XtdAlf_Lang_DC.msi | ||
var baseFont = BaseFont.CreateFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED); | ||
var font = new Font(baseFont, 12); | ||
|
||
pdfDoc.Add(new Paragraph(font.BaseFont.PostscriptFontName, font)); | ||
pdfDoc.Add(new Paragraph("你好", font)); | ||
|
||
pdfDoc.Close(); | ||
fileStream.Dispose(); | ||
|
||
TestUtils.VerifyPdfFileIsReadable(pdfFilePath); | ||
} | ||
|
||
[TestMethod] | ||
public void Verify_Issue34_Fill_Form1_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; | ||
|
||
var baseFont = BaseFont.CreateFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED); | ||
form.AddSubstitutionFont(baseFont); | ||
|
||
foreach (DictionaryEntry field in form.Fields) | ||
{ | ||
Console.WriteLine(field.Key); | ||
} | ||
|
||
form.SetField("Text Field0", "你好"); | ||
|
||
stamper.Close(); | ||
reader.Close(); | ||
stream.Dispose(); | ||
} | ||
|
||
[TestMethod] | ||
public void Verify_Issue34_Fill_Form2_CanBe_Processed() | ||
{ | ||
var pdfFilePath = TestUtils.GetOutputFileName(); | ||
var stream = new FileStream(pdfFilePath, FileMode.Create); | ||
|
||
var path = TestUtils.GetPdfsPath("SamplePDFForm.pdf"); | ||
var reader = new PdfReader(path); | ||
var stamper = new PdfStamper(reader, stream); | ||
|
||
var form = stamper.AcroFields; | ||
|
||
var baseFont = BaseFont.CreateFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED); | ||
form.AddSubstitutionFont(baseFont); | ||
|
||
foreach (DictionaryEntry field in form.Fields) | ||
{ | ||
Console.WriteLine(field.Key); | ||
} | ||
|
||
form.SetField("First Name", "你好"); | ||
form.SetField("Last Name", "你好"); | ||
form.SetField("Awesome Checkbox", true ? "Yes" : "Off"); | ||
|
||
// set this if you want the result PDF to not be editable. | ||
stamper.FormFlattening = true; | ||
|
||
stamper.Close(); | ||
reader.Close(); | ||
stream.Dispose(); | ||
} | ||
} | ||
} |
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
+290 KB
src/iTextSharp.LGPLv2.Core.FunctionalTests/iTextExamples/resources/pdfs/SamplePDFForm.pdf
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
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
+128 KB
src/iTextSharp.LGPLv2.Core/iTextSharp/text/pdf/fonts/Adobe-CNS1-UCS2.cmap
Binary file not shown.
Binary file added
BIN
+128 KB
src/iTextSharp.LGPLv2.Core/iTextSharp/text/pdf/fonts/Adobe-GB1-UCS2.cmap
Binary file not shown.
Binary file added
BIN
+128 KB
src/iTextSharp.LGPLv2.Core/iTextSharp/text/pdf/fonts/Adobe-Japan1-UCS2.cmap
Binary file not shown.
Binary file added
BIN
+128 KB
src/iTextSharp.LGPLv2.Core/iTextSharp/text/pdf/fonts/Adobe-Korea1-UCS2.cmap
Binary file not shown.
Oops, something went wrong.