public string Stamp() { var fileNameOrStream = ... // Get your image from somewhere using (var lifetime = AccusoftProvider.ImagXpress) // Replace this with your own license { var load = new LoadOptions(); // All my images are multipage tiff files var save = new SaveOptions { Format = ImageXFormat.Tiff }; save.Tiff.MultiPage = true; using (ImageX image = ImageX.FromFile(lifetime, fileNameOrStream, load)) { int offset = 0; int pages = ImageX.NumPages(lifetime, fileNameOrStream); for (int i = 0; i < pages; i++) { image.Page = i + 1; save.Tiff.Compression = image.ImageXData.Compression; var pageStamp = ".." // Get your stamp StampImage(lifetime, pageStamp, image); save.Tiff.UseIFDOffset = offset > 0; save.Tiff.IFDOffset = offset; image.Save(outputFileName, save); offset = save.Tiff.IFDOffset; } } } }
public void ConvertTIFtoMultiPage(FileInfo mCaminhoOrigem, FileInfo mCaminhoDestino, string mTipo) { try { using (ImagXpress _imageX10 = new ImagXpress()) { _imageX10.Licensing.UnlockRuntime(1908225079, 373669040, 1341647942, 30454); ImageX image = ImageX.FromFile(_imageX10, mCaminhoOrigem.FullName); try { SaveOptions so = new SaveOptions(); so.Format = ImageXFormat.Tiff; if (mTipo.ToUpper() == "PDF") { so.Format = ImageXFormat.Pdf; } so.Tiff.MultiPage = true; so.Pdf.MultiPage = true; if (image.BitsPerPixel != 1) { so.Tiff.Compression = Compression.Jpeg; so.Pdf.Compression = Compression.Jpeg; } else { so.Tiff.Compression = Compression.Group4; so.Pdf.Compression = Compression.Group4; } image.Save(mCaminhoDestino.FullName, so); } catch { throw; } finally { image.Dispose(); } } } catch (Exception exp) { throw new Exception("Erro ao processar imagem:\t" + exp.Message + Environment.NewLine + exp.StackTrace); } }