mirror of
https://github.com/iib0011/omni-tools.git
synced 2025-12-29 16:16:02 +00:00
refactor: compress pdf
This commit is contained in:
@@ -1,9 +1,4 @@
|
||||
export async function _GSPS2PDF(
|
||||
dataStruct,
|
||||
responseCallback,
|
||||
progressCallback,
|
||||
statusUpdateCallback
|
||||
) {
|
||||
export async function compressWithGhostScript(dataStruct) {
|
||||
const worker = new Worker(
|
||||
new URL('./background-worker.js', import.meta.url),
|
||||
{ type: 'module' }
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { InitialValuesType } from './types';
|
||||
import { _GSPS2PDF } from '../../../../lib/worker-init';
|
||||
import { compressWithGhostScript } from '../../../../lib/worker-init';
|
||||
|
||||
/**
|
||||
* Compresses a PDF file using either Ghostscript WASM (preferred)
|
||||
@@ -19,7 +19,7 @@ export async function compressPdf(
|
||||
}
|
||||
|
||||
const dataObject = { psDataURL: URL.createObjectURL(pdfFile) };
|
||||
const compressedFileUrl: string = await _GSPS2PDF(dataObject);
|
||||
const compressedFileUrl: string = await compressWithGhostScript(dataObject);
|
||||
return await loadPDFData(compressedFileUrl, pdfFile.name);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user