Exemplo n.º 1
0
        private void TransformPptxStream(Stream stream, OptimizeDiagnostic diagnostic, ImageOptimizerOptions options, CancellationToken token)
        {
            using var document = OpenXmlFactory.OpenPowerPoint(stream, true, options.OpenXmlUriAutoRecovery);
            var transformation = new OptimizerPowerPoint(_memoryStreamManager, options);

            transformation.Transform(document, diagnostic, token);

            foreach (var slide in document.PresentationPart.SlideParts)
            {
                foreach (var part in slide.EmbeddedPackageParts)
                {
                    token.ThrowIfCancellationRequested();
                    TransformEmbeddedPart(part, diagnostic, options, token);
                }
            }
        }
Exemplo n.º 2
0
 public PowerPointAnalyzer(string fileName)
 {
     _fileName   = fileName;
     _fileStream = File.Open(fileName, FileMode.Open);
     _document   = OpenXmlFactory.OpenPowerPoint(_fileStream, false, true);
 }