File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -93,6 +93,21 @@ internal XPdfForm(Stream stream)
93
93
_externalDocument = PdfReader . Open ( stream ) ;
94
94
}
95
95
96
+ /// <summary>
97
+ /// Initializes a new instance of the <see cref="XPdfForm"/> class from a stream and password.
98
+ /// </summary>
99
+ /// <param name="stream">The stream.</param>
100
+ /// <param name="password">The password.</param>
101
+ internal XPdfForm ( Stream stream , string password ) {
102
+ // Create a dummy unique path
103
+ _path = "*" + Guid . NewGuid ( ) . ToString ( "B" ) ;
104
+
105
+ if ( PdfReader . TestPdfFile ( stream ) == 0 )
106
+ throw new ArgumentException ( "The specified stream has no valid PDF file header." , "stream" ) ;
107
+
108
+ _externalDocument = PdfReader . Open ( stream , password , PdfDocumentOpenMode . ReadOnly ) ;
109
+ }
110
+
96
111
/// <summary>
97
112
/// Creates an XPdfForm from a file.
98
113
/// </summary>
@@ -110,6 +125,13 @@ public static XPdfForm FromStream(Stream stream)
110
125
return new XPdfForm ( stream ) ;
111
126
}
112
127
128
+ /// <summary>
129
+ /// Creates an XPdfForm from a stream and a password.
130
+ /// </summary>
131
+ public static XPdfForm FromStream ( Stream stream , string password ) {
132
+ return new XPdfForm ( stream , password ) ;
133
+ }
134
+
113
135
/*
114
136
void Initialize()
115
137
{
You can’t perform that action at this time.
0 commit comments