@@ -110,36 +110,29 @@ export class SplitPdfHook
110110 const file = formData . get ( PARTITION_FORM_FILES_KEY ) as File | null ;
111111
112112 if ( ! splitPdfPage ) {
113- console . info ( "Partitioning without split." )
114113 return request ;
115114 }
116115
117- console . info ( "Preparing to split document for partition." )
118116 if ( ! this . client ) {
119117 console . warn ( "HTTP client not accessible! Partitioning without split." ) ;
120118 return request ;
121119 }
122120
123121 const [ error , pdf , totalPages ] = await loadPdf ( file ) ;
124122 if ( file === null || pdf === null || error ) {
125- console . info ( "Partitioning without split." )
126123 return request ;
127124 }
128125
129126 const [ pageRangeStart , pageRangeEnd ] = getSplitPdfPageRange ( formData , totalPages ) ;
130127 const pagesCount = pageRangeEnd - pageRangeStart + 1 ;
131128
132129 const startingPageNumber = getStartingPageNumber ( formData ) ;
133- console . info ( "Starting page number set to %d" , startingPageNumber ) ;
134130
135131 const concurrencyLevel = getSplitPdfConcurrencyLevel ( formData ) ;
136- console . info ( "Concurrency level set to %d" , concurrencyLevel )
137132
138133 this . allowFailed = getSplitPdfAllowFailed ( formData ) ;
139- console . info ( "Allow failed set to %s" , this . allowFailed )
140134
141135 const splitSize = await getOptimalSplitSize ( pagesCount , concurrencyLevel ) ;
142- console . info ( "Determined optimal split size of %d pages." , splitSize )
143136
144137 // If user wants a specific page range, we need to call splitPdf,
145138 // even if this page count is too small to be split normally
@@ -148,26 +141,11 @@ export class SplitPdfHook
148141 // Otherwise, if there are not enough pages, return the original request without splitting
149142 if ( ! isPageRangeRequested ) {
150143 if ( splitSize >= pagesCount || pagesCount < MIN_PAGES_PER_THREAD ) {
151- console . info (
152- "Document has too few pages (%d) to be split efficiently. Partitioning without split." ,
153- pagesCount ,
154- )
155144 return request ;
156145 }
157146 }
158147
159148 const splits = await splitPdf ( pdf , splitSize , pageRangeStart , pageRangeEnd ) ;
160- const numberOfSplits = splits . length
161- console . info (
162- "Document split into %d, %d-paged sets." ,
163- numberOfSplits ,
164- splitSize ,
165- )
166- console . info (
167- "Partitioning %d, %d-paged sets." ,
168- numberOfSplits ,
169- splitSize ,
170- )
171149
172150 const oneSecond = 1000 ;
173151 const oneMinute = 1000 * 60 ;
@@ -181,12 +159,6 @@ export class SplitPdfHook
181159 for ( const { content, startPage } of splits ) {
182160 // Both startPage and startingPageNumber are 1-based, so we need to subtract 1
183161 const firstPageNumber = startPage + startingPageNumber - 1 ;
184- console . info (
185- "Partitioning set #%d (pages %d-%d)." ,
186- setIndex ,
187- firstPageNumber ,
188- Math . min ( firstPageNumber + splitSize - 1 , pagesCount ) ,
189- ) ;
190162
191163 const body = await prepareRequestBody (
192164 formData ,
@@ -261,8 +233,7 @@ export class SplitPdfHook
261233 concurrencyLevel
262234 ) ;
263235
264- const dummyRequest = new Request ( "https://no-op/" ) ;
265- return dummyRequest ;
236+ return new Request ( "https://no-op/" ) ;
266237 }
267238
268239 /**
0 commit comments