File tree Expand file tree Collapse file tree
applications/Unity.GrantManager/src/Unity.GrantManager.Application/AI Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -131,24 +131,14 @@ private string ExtractTextFromPdfFile(string fileName, byte[] fileContent)
131131
132132 foreach ( var pageText in document . GetPages ( ) . Select ( page => page . Text ) )
133133 {
134- if ( builder . Length >= MaxExtractedTextLength )
134+ var limitReached = AppendWithLimit ( builder , pageText , MaxExtractedTextLength , Environment . NewLine ) ;
135+ if ( limitReached )
135136 {
136137 break ;
137138 }
138-
139- if ( ! string . IsNullOrWhiteSpace ( pageText ) )
140- {
141- builder . AppendLine ( pageText ) ;
142- }
143- }
144-
145- var text = builder . ToString ( ) ;
146- if ( text . Length > MaxExtractedTextLength )
147- {
148- text = text . Substring ( 0 , MaxExtractedTextLength ) ;
149139 }
150140
151- return text ;
141+ return builder . ToString ( ) ;
152142 }
153143 catch ( Exception ex )
154144 {
You can’t perform that action at this time.
0 commit comments