public virtual void PrintClipTest()
        {
            PdfViewerPreferences preferences = new PdfViewerPreferences();
            PdfDictionary        dictionary  = preferences.GetPdfObject();

            NUnit.Framework.Assert.AreEqual(0, dictionary.Size());
            // Set non-appropriate value
            preferences.SetPrintClip(PdfViewerPreferences.PdfViewerPreferencesConstants.PRINT_AREA);
            NUnit.Framework.Assert.AreEqual(0, dictionary.Size());
            preferences.SetPrintClip(PdfViewerPreferences.PdfViewerPreferencesConstants.CROP_BOX);
            NUnit.Framework.Assert.AreEqual(1, dictionary.Size());
            NUnit.Framework.Assert.AreEqual(PdfName.CropBox, dictionary.Get(PdfName.PrintClip));
            preferences.SetPrintClip(PdfViewerPreferences.PdfViewerPreferencesConstants.ART_BOX);
            NUnit.Framework.Assert.AreEqual(1, dictionary.Size());
            NUnit.Framework.Assert.AreEqual(PdfName.ArtBox, dictionary.Get(PdfName.PrintClip));
            preferences.SetPrintClip(PdfViewerPreferences.PdfViewerPreferencesConstants.BLEED_BOX);
            NUnit.Framework.Assert.AreEqual(1, dictionary.Size());
            NUnit.Framework.Assert.AreEqual(PdfName.BleedBox, dictionary.Get(PdfName.PrintClip));
            preferences.SetPrintClip(PdfViewerPreferences.PdfViewerPreferencesConstants.MEDIA_BOX);
            NUnit.Framework.Assert.AreEqual(1, dictionary.Size());
            NUnit.Framework.Assert.AreEqual(PdfName.MediaBox, dictionary.Get(PdfName.PrintClip));
            preferences.SetPrintClip(PdfViewerPreferences.PdfViewerPreferencesConstants.TRIM_BOX);
            NUnit.Framework.Assert.AreEqual(1, dictionary.Size());
            NUnit.Framework.Assert.AreEqual(PdfName.TrimBox, dictionary.Get(PdfName.PrintClip));
        }
        public virtual void PrintScalingTest()
        {
            PdfViewerPreferences preferences = new PdfViewerPreferences();
            PdfDictionary        dictionary  = preferences.GetPdfObject();

            NUnit.Framework.Assert.AreEqual(0, dictionary.Size());
            // Set non-appropriate value
            preferences.SetPrintScaling(PdfViewerPreferences.PdfViewerPreferencesConstants.PRINT_AREA);
            NUnit.Framework.Assert.AreEqual(0, dictionary.Size());
            preferences.SetPrintScaling(PdfViewerPreferences.PdfViewerPreferencesConstants.NONE);
            NUnit.Framework.Assert.AreEqual(1, dictionary.Size());
            NUnit.Framework.Assert.AreEqual(PdfName.None, dictionary.Get(PdfName.PrintScaling));
            preferences.SetPrintScaling(PdfViewerPreferences.PdfViewerPreferencesConstants.APP_DEFAULT);
            NUnit.Framework.Assert.AreEqual(1, dictionary.Size());
            NUnit.Framework.Assert.AreEqual(PdfName.AppDefault, dictionary.Get(PdfName.PrintScaling));
        }
        public virtual void DirectionTest()
        {
            PdfViewerPreferences preferences = new PdfViewerPreferences();
            PdfDictionary        dictionary  = preferences.GetPdfObject();

            NUnit.Framework.Assert.AreEqual(0, dictionary.Size());
            // Set non-appropriate value
            preferences.SetDirection(PdfViewerPreferences.PdfViewerPreferencesConstants.PRINT_AREA);
            NUnit.Framework.Assert.AreEqual(0, dictionary.Size());
            preferences.SetDirection(PdfViewerPreferences.PdfViewerPreferencesConstants.LEFT_TO_RIGHT);
            NUnit.Framework.Assert.AreEqual(1, dictionary.Size());
            NUnit.Framework.Assert.AreEqual(PdfName.L2R, dictionary.Get(PdfName.Direction));
            preferences.SetDirection(PdfViewerPreferences.PdfViewerPreferencesConstants.RIGHT_TO_LEFT);
            NUnit.Framework.Assert.AreEqual(1, dictionary.Size());
            NUnit.Framework.Assert.AreEqual(PdfName.R2L, dictionary.Get(PdfName.Direction));
        }
        public virtual void DuplexTest()
        {
            PdfViewerPreferences preferences = new PdfViewerPreferences();
            PdfDictionary        dictionary  = preferences.GetPdfObject();

            NUnit.Framework.Assert.AreEqual(0, dictionary.Size());
            // Set non-appropriate value
            preferences.SetDuplex(PdfViewerPreferences.PdfViewerPreferencesConstants.PRINT_AREA);
            NUnit.Framework.Assert.AreEqual(0, dictionary.Size());
            preferences.SetDuplex(PdfViewerPreferences.PdfViewerPreferencesConstants.SIMPLEX);
            NUnit.Framework.Assert.AreEqual(1, dictionary.Size());
            NUnit.Framework.Assert.AreEqual(PdfName.Simplex, dictionary.Get(PdfName.Duplex));
            preferences.SetDuplex(PdfViewerPreferences.PdfViewerPreferencesConstants.DUPLEX_FLIP_LONG_EDGE);
            NUnit.Framework.Assert.AreEqual(1, dictionary.Size());
            NUnit.Framework.Assert.AreEqual(PdfName.DuplexFlipLongEdge, dictionary.Get(PdfName.Duplex));
            preferences.SetDuplex(PdfViewerPreferences.PdfViewerPreferencesConstants.DUPLEX_FLIP_SHORT_EDGE);
            NUnit.Framework.Assert.AreEqual(1, dictionary.Size());
            NUnit.Framework.Assert.AreEqual(PdfName.DuplexFlipShortEdge, dictionary.Get(PdfName.Duplex));
        }
        public virtual void NonFullScreenPageModeTest()
        {
            PdfViewerPreferences preferences = new PdfViewerPreferences();
            PdfDictionary        dictionary  = preferences.GetPdfObject();

            NUnit.Framework.Assert.AreEqual(0, dictionary.Size());
            // Set non-appropriate value
            preferences.SetNonFullScreenPageMode(PdfViewerPreferences.PdfViewerPreferencesConstants.PRINT_AREA);
            NUnit.Framework.Assert.AreEqual(0, dictionary.Size());
            preferences.SetNonFullScreenPageMode(PdfViewerPreferences.PdfViewerPreferencesConstants.USE_THUMBS);
            NUnit.Framework.Assert.AreEqual(1, dictionary.Size());
            NUnit.Framework.Assert.AreEqual(PdfName.UseThumbs, dictionary.Get(PdfName.NonFullScreenPageMode));
            preferences.SetNonFullScreenPageMode(PdfViewerPreferences.PdfViewerPreferencesConstants.USE_NONE);
            NUnit.Framework.Assert.AreEqual(1, dictionary.Size());
            NUnit.Framework.Assert.AreEqual(PdfName.UseNone, dictionary.Get(PdfName.NonFullScreenPageMode));
            preferences.SetNonFullScreenPageMode(PdfViewerPreferences.PdfViewerPreferencesConstants.USE_OC);
            NUnit.Framework.Assert.AreEqual(1, dictionary.Size());
            NUnit.Framework.Assert.AreEqual(PdfName.UseOC, dictionary.Get(PdfName.NonFullScreenPageMode));
            preferences.SetNonFullScreenPageMode(PdfViewerPreferences.PdfViewerPreferencesConstants.USE_OUTLINES);
            NUnit.Framework.Assert.AreEqual(1, dictionary.Size());
            NUnit.Framework.Assert.AreEqual(PdfName.UseOutlines, dictionary.Get(PdfName.NonFullScreenPageMode));
        }
Example #6
0
 /// <summary>
 /// This method sets the document viewer preferences, specifying the way the document shall be displayed on the
 /// screen
 /// </summary>
 /// <param name="preferences"/>
 public virtual iText.Kernel.Pdf.PdfCatalog SetViewerPreferences(PdfViewerPreferences preferences)
 {
     return(Put(PdfName.ViewerPreferences, preferences.GetPdfObject()));
 }