public static void Main()
        {
            // NOTE:
            // When used in trial mode, the library imposes some restrictions.
            // Please visit http://bitmiracle.com/pdf-library/trial-restrictions.aspx
            // for more information.

            StringBuilder sb = new StringBuilder();

            using (PdfDocument pdf = new PdfDocument(@"..\Sample Data\signed.pdf"))
            {
                PdfControl field = pdf.GetControls().FirstOrDefault(c => c.Type == PdfWidgetType.Signature);
                if (field == null)
                {
                    Console.WriteLine("Document does not contain signature fields");
                    return;
                }

                PdfSignature         signature = ((PdfSignatureField)field).Signature;
                PdfSignatureContents contents  = signature.Contents;
                sb.AppendFormat("Signed part is intact: {0}\n", contents.VerifyDigest());

                DateTime signingTime = signature.SigningTime ?? DateTime.MinValue;
                sb.AppendFormat("Signed on: {0}\n", signingTime.ToShortDateString());

                var timestampToken = contents.GetTimestampToken();
                if (timestampToken != null)
                {
                    sb.AppendFormat("Embedded timestamp: {0}\n", timestampToken.GenerationTime);
                    if (timestampToken.TimestampAuthority != null)
                    {
                        sb.AppendFormat("Timestamp authority: {0}\n", timestampToken.TimestampAuthority.Name);
                    }
                    sb.AppendFormat("Timestamp is intact: {0}\n\n", contents.VerifyTimestamp());
                }
                else
                {
                    sb.AppendLine();
                }

                if (contents.CheckHasEmbeddedOcsp())
                {
                    sb.AppendLine("Signature has OCSP embedded.");
                    checkRevocation(signature, sb, PdfCertificateRevocationCheckMode.EmbeddedOcsp);
                }

                if (contents.CheckHasEmbeddedCrl())
                {
                    sb.AppendLine("Signature has CRL embedded.");
                    checkRevocation(signature, sb, PdfCertificateRevocationCheckMode.EmbeddedCrl);
                }

                checkRevocation(signature, sb, PdfCertificateRevocationCheckMode.OnlineOcsp);
                checkRevocation(signature, sb, PdfCertificateRevocationCheckMode.OnlineCrl);
            }

            Console.WriteLine(sb.ToString());
        }
        public static void Main()
        {
            // NOTE:
            // When used in trial mode, the library imposes some restrictions.
            // Please visit http://bitmiracle.com/pdf-library/trial-restrictions.aspx
            // for more information.

            StringBuilder sb = new StringBuilder();

            using (PdfDocument pdf = new PdfDocument(@"..\Sample Data\signed.pdf"))
            {
                PdfControl control = pdf.GetControls().FirstOrDefault(c => c.Type == PdfWidgetType.Signature);
                if (control == null)
                {
                    Console.WriteLine("Document does not contain signature fields");
                    return;
                }

                PdfSignatureField field = (PdfSignatureField)control;
                sb.AppendFormat("Signature field is invisible: {0}\n", isInvisible(field));

                PdfSignature signature = field.Signature;
                sb.AppendFormat("Signed by: {0}\n", signature.Name);
                sb.AppendFormat("Signing time: {0}\n", signature.SigningTime);
                sb.AppendFormat("Signed at: {0}\n", signature.Location);
                sb.AppendFormat("Reason for signing: {0}\n", signature.Reason);
                sb.AppendFormat("Signer's contact: {0}\n", signature.ContactInfo);

                PdfSignatureContents contents = signature.Contents;
                sb.AppendFormat("Has OCSP embedded: {0}\n", contents.CheckHasEmbeddedOcsp());
                sb.AppendFormat("Has CRL embedded: {0}\n", contents.CheckHasEmbeddedCrl());

                PdfSignatureCertificate certificate = contents.GetSigningCertificate();
                sb.AppendLine();
                sb.AppendLine("== Signing certificate:");
                sb.AppendFormat("Name: {0}\n", certificate.Name);
                sb.AppendFormat("Algorithm: {0}\n", certificate.AlgorithmName);
                sb.AppendFormat("Subject DN: {0}\n", certificate.Subject.Name);
                sb.AppendFormat("Issuer DN: {0}\n", certificate.Issuer.Name);
                sb.AppendFormat("Serial number: {0}\n", certificate.SerialNumber);
                sb.AppendFormat("Valid from {0} up to {1}\n", certificate.ValidFrom, certificate.ValidUpto);
                sb.AppendFormat("Timestamp Authority URL: {0}\n", certificate.GetTimestampAuthorityUrl());

                PdfSignatureCertificate issuer = contents.GetIssuerCertificateFor(certificate);
                sb.AppendLine();
                sb.AppendLine("== Issuer certificate:");
                sb.AppendFormat("Subject DN: {0}\n", issuer.Subject.Name);
                sb.AppendFormat("Issuer DN: {0}\n", issuer.Issuer.Name);
                sb.AppendFormat("Serial number: {0}\n", issuer.SerialNumber);
            }

            Console.WriteLine(sb.ToString());
        }
        public MainPage()
        {
            BindingContext = new MainViewModel();

            var pdfControl = new PdfControl()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
            };
            var layout = new StackLayout();

            layout.Children.Add(pdfControl);

            pdfControl.SetBinding(PdfControl.PdfPathProperty, "PdfPath");

            Content = layout;
        }
        private void SetResource(string filePath, bool loadWithTypeNone = false)
        {
            var typeInfo = FileType.GetFileViewType(filePath);

            if (loadWithTypeNone)
            {
                typeInfo.Type = FileViewType.None;
            }
            if (lastViewType != typeInfo.Type || MyGrid.Children[0] is HelloControl)
            {
                lastViewType = typeInfo.Type;
                MyGrid.Children.Clear();
            }
            else if (MyGrid.Children.Count == 1)
            {
                (MyGrid.Children[0] as FileControl).OnFileChanged((filePath, typeInfo.Ext));
                return;
            }
            FileControl fc;

            switch (typeInfo.Type)
            {
            case FileViewType.Image:
                fc = new ImageControl();
                GlobalNotify.OnResizeMode(true);
                break;

            case FileViewType.Code:
            case FileViewType.Txt:
                fc = new TextControl();
                GlobalNotify.OnResizeMode(true);
                break;

            case FileViewType.Music:
                fc = new MusicControl();
                GlobalNotify.OnResizeMode(false);
                break;

            case FileViewType.Video:
                fc = new VideoControl();
                GlobalNotify.OnResizeMode(true);
                break;

            case FileViewType.Pdf:
                fc = new PdfControl();
                GlobalNotify.OnResizeMode(true);
                break;

            case FileViewType.Excel:
                fc = new ExcelControl();
                GlobalNotify.OnResizeMode(true);
                break;

            case FileViewType.Word:
                fc = new WordControl();
                GlobalNotify.OnResizeMode(true);
                break;

            case FileViewType.PowerPoint:
                fc = new PowerPointControl();
                GlobalNotify.OnResizeMode(true);
                break;

            default:
                fc = new CommonControl();
                GlobalNotify.OnResizeMode(false);
                break;
            }
            if (fc != null)
            {
                LoadFile(fc, filePath, typeInfo.Ext);
            }
        }