ConvertZipFile() public method

public ConvertZipFile ( byte zipFile, ConversionOptions options ) : byte[]
zipFile byte
options ConversionOptions
return byte[]
Exemplo n.º 1
0
 public void TestZipExceptionOnUnsupportedFileType()
 {
     string tempFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "test_files\\zip\\archive_with_unsupported_file.zip");
     byte[] testFile = File.ReadAllBytes(tempFilePath);
     PdfConverter converter = new PdfConverter();
     byte[] pdf = converter.ConvertZipFile(testFile, new ConversionOptions() { SilentFailOnUnsupportedType = false });
 }
Exemplo n.º 2
0
        public void TestZip()
        {
            string tempFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "test_files\\zip\\archive.zip");
            byte[] testFile = File.ReadAllBytes(tempFilePath);
            PdfConverter converter = new PdfConverter();
            byte[] pdf = converter.ConvertZipFile(testFile, new ConversionOptions());
            Assert.IsNotNull(pdf);

            Document doc = new Document();
            PdfReader reader = new PdfReader(pdf);
            int pages = reader.NumberOfPages;
            doc.Close();

            Assert.IsTrue(pages == 5);
        }
Exemplo n.º 3
0
        public void TestZipUnsupportedFileType()
        {
            string tempFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "test_files\\zip\\archive_with_unsupported_file.zip");
            byte[] testFile = File.ReadAllBytes(tempFilePath);
            PdfConverter converter = new PdfConverter();
            byte[] pdf = converter.ConvertZipFile(testFile, new ConversionOptions() { SilentFailOnUnsupportedType = true, UsePlaceholderPageOnUnsupportedType = true });
            Assert.IsNotNull(pdf);
            Assert.IsTrue(pdf.Length > 0);

            Document doc = new Document();
            PdfReader reader = new PdfReader(pdf);
            int pages = reader.NumberOfPages;
            doc.Close();

            Assert.IsTrue(pages == 6);
        }