Ejemplo n.º 1
0
 virtual public String DecodeStringToUnicode(PdfString ps)
 {
     if (ps.IsHexWriting())
     {
         return(PdfEncodings.ConvertToString(ps.GetBytes(), "UnicodeBigUnmarked"));
     }
     else
     {
         return(ps.ToUnicodeString());
     }
 }
Ejemplo n.º 2
0
        internal static void ValidateTemplateForSignedDeferredResult(String output, String sigFieldName, PdfName filter
                                                                     , PdfName subFilter, int estimatedSize)
        {
            PdfDocument outDocument   = new PdfDocument(new PdfReader(output));
            PdfObject   outSigDictObj = PdfAcroForm.GetAcroForm(outDocument, false).GetField(sigFieldName).GetValue();

            NUnit.Framework.Assert.IsTrue(outSigDictObj.IsDictionary());
            PdfDictionary outSigDict = (PdfDictionary)outSigDictObj;
            PdfArray      byteRange  = outSigDict.GetAsArray(PdfName.ByteRange);

            NUnit.Framework.Assert.IsNotNull(byteRange);
            NUnit.Framework.Assert.IsTrue(byteRange.Size() == 4);
            NUnit.Framework.Assert.AreEqual(filter, outSigDict.GetAsName(PdfName.Filter));
            NUnit.Framework.Assert.AreEqual(subFilter, outSigDict.GetAsName(PdfName.SubFilter));
            PdfString outSigContents = outSigDict.GetAsString(PdfName.Contents);

            NUnit.Framework.Assert.IsTrue(outSigContents.IsHexWriting());
            NUnit.Framework.Assert.AreEqual(new byte[estimatedSize], outSigContents.GetValueBytes());
        }