Пример #1
0
		void CreatePDFFile( IEnumerable<ScannedImageViewModel> items, string filename )
		{
			try
			{
				// Save document
				var Document = new PdfDocument( PaperType.A4, false, UnitOfMeasure.cm, filename );

				// add to pdf file all images from collection
				foreach ( ScannedImageViewModel scan in items )
				{
					var page = new PdfPage( Document, PaperType.A4, scan.Image.Landscape );
					var contents = new PdfContents( page );
					var image = new PdfImage( Document, scan.Image.Source, 0, PdfQuality );
					contents.DrawFullPageImage( image, scan.Image.Landscape );
				}
				Document.CreateFile();
			}
			catch ( IOException )
			{
				// localization dictionary
				var dictionary = Application.Current.Resources.MergedDictionaries[ 0 ];
				Notify = new Notify( (string) dictionary[ "er_CantCreateFile" ], Notify.Type.Warning );
			}
			catch ( Exception ex )
			{
				Notify = new Notify( ex.Message, Notify.Type.Warning );
			}
		}