Appended operation names to filenames
This commit is contained in:
@@ -6,7 +6,7 @@ export type ExtractPagesParamsType = {
|
||||
file: PdfFile;
|
||||
pageIndexes: string | number[];
|
||||
}
|
||||
export async function extractPages(params: ExtractPagesParamsType) {
|
||||
export async function extractPages(params: ExtractPagesParamsType): Promise<PdfFile> {
|
||||
const { file, pageIndexes } = params;
|
||||
const pdfLibDocument = await file.pdfLibDocument;
|
||||
|
||||
@@ -16,5 +16,7 @@ export async function extractPages(params: ExtractPagesParamsType) {
|
||||
indexes = parsePageIndexSpecification(indexes, pdfLibDocument.getPageCount());
|
||||
}
|
||||
|
||||
return getPages(file, indexes);
|
||||
const newFile = await getPages(file, indexes);
|
||||
newFile.filename += "_extractedPages"
|
||||
return newFile;
|
||||
}
|
||||
|
||||
@@ -14,5 +14,8 @@ export async function removeBlankPages(params: RemoveBlankPagesParamsType) {
|
||||
const emptyPages = await detectEmptyPages(file, whiteThreashold);
|
||||
console.debug("Empty Pages: ", emptyPages);
|
||||
const pagesToKeep = invertSelection(emptyPages, pageCount.getPageCount())
|
||||
return getPages(file, pagesToKeep);
|
||||
|
||||
const newFile = await getPages(file, pagesToKeep);
|
||||
newFile.filename += "_removedBlanks"
|
||||
return newFile;
|
||||
}
|
||||
@@ -18,5 +18,8 @@ export async function sortPagesWithPreset(params: SortPagesWithPresetParamsType)
|
||||
const sortFunction = sorts[sortPreset];
|
||||
const pageCount = pdfLibDocument.getPageCount();
|
||||
const sortIndexes = sortFunction(pageCount);
|
||||
return getPages(file, sortIndexes);
|
||||
|
||||
const newFile = await getPages(file, sortIndexes);
|
||||
newFile.filename += "_sortedPages"
|
||||
return newFile;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user