@@ -40,44 +40,55 @@ source product.
40
40
For more information, please contact iText Software Corp. at this
41
41
42
42
*/
43
+
43
44
using System ;
44
- using System . Collections . Generic ;
45
45
using System . Globalization ;
46
- using System . Linq ;
47
- using System . Text ;
48
46
using System . Threading ;
49
47
using iText . IO . Image ;
48
+ using iText . Kernel . Pdf ;
50
49
using iText . Layout . Element ;
50
+ using iText . Test ;
51
+ using NUnit . Framework ;
51
52
52
- namespace iText . Layout
53
- {
53
+ namespace iText . Layout {
54
54
// This test is present only in c#
55
55
// Also this test in only for windows OS
56
- class NetWorkPathTest
57
- {
56
+ public class NetWorkPathTest : ExtendedITextTest {
57
+
58
58
[ NUnit . Framework . Test ]
59
- public virtual void NetworkPathImageTest ( )
60
- {
61
- var fullImagePath = @"\\someVeryRandomWords\SomeVeryRandomName.img" ;
62
- string startOfMsg = null ;
59
+ public virtual void NetworkPathImageTest ( ) {
60
+ String fullImagePath = @"\\someVeryRandomWords\SomeVeryRandomName.img" ;
61
+ String startOfMsg = null ;
63
62
#if ! NETSTANDARD1_6
64
63
Thread . CurrentThread . CurrentCulture = CultureInfo . InvariantCulture ;
65
64
Thread . CurrentThread . CurrentUICulture = CultureInfo . InvariantCulture ;
66
65
#else
67
66
CultureInfo . CurrentCulture = CultureInfo . InvariantCulture ;
68
67
CultureInfo . CurrentUICulture = CultureInfo . InvariantCulture ;
69
68
#endif
70
- try
71
- {
69
+ try {
72
70
Image drawing = new Image ( ImageDataFactory . Create ( fullImagePath ) ) ;
73
- }
74
- catch ( Exception e )
75
- {
71
+ } catch ( Exception e ) {
76
72
if ( e . InnerException != null && e . InnerException . Message . Length > 18 )
77
73
startOfMsg = e . InnerException . Message . Substring ( 0 , 19 ) ;
78
74
}
79
75
NUnit . Framework . Assert . IsNotNull ( startOfMsg ) ;
80
76
NUnit . Framework . Assert . AreNotEqual ( "Could not find file" , startOfMsg ) ;
81
77
}
78
+
79
+ [ NUnit . Framework . Test ]
80
+ [ Ignore ( "Manual run only" ) ]
81
+ public virtual void NetworkPathImageTest02 ( ) {
82
+ // TODO This test can work only if shared folder exists on some local network computer.
83
+ // Suggested apporach is to create such folder on your computer and input corresponding names as variables values below.
84
+ String comupterNameAndSharedFolderPath = @"INSERT_YOUR_COMPUTER_NAME" ; // e.g. \\DESKTOP-ABCD3TQ\_inbox
85
+ String outPath = "INSERT_OUTPUT_PATH" ;
86
+
87
+ String fullImagePath = @"\\" + comupterNameAndSharedFolderPath + @"\img.jpg" ;
88
+ Image drawing = new Image ( ImageDataFactory . Create ( fullImagePath ) ) ;
89
+ Document doc = new Document ( new PdfDocument ( new PdfWriter ( outPath ) ) ) ;
90
+ doc . Add ( drawing . SetAutoScale ( true ) ) ;
91
+ doc . Close ( ) ;
92
+ }
82
93
}
83
- }
94
+ }
0 commit comments