diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 279b0b4..53a0e44 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,18 +4,13 @@
-
-
-
-
-
-
+
+
-
-
-
-
-
+
+
+
+
@@ -115,54 +110,55 @@
- {
- "keyToString": {
- "ASKED_ADD_EXTERNAL_FILES": "true",
- "ASKED_SHARE_PROJECT_CONFIGURATION_FILES": "true",
- "Docker.Dockerfile build.executor": "Run",
- "Docker.Dockerfile.executor": "Run",
- "Playwright.Create transparent PNG.should make png color transparent.executor": "Run",
- "Playwright.JoinText Component.executor": "Run",
- "Playwright.JoinText Component.should merge text pieces with specified join character.executor": "Run",
- "RunOnceActivity.OpenProjectViewOnStart": "true",
- "RunOnceActivity.ShowReadmeOnStart": "true",
- "RunOnceActivity.git.unshallow": "true",
- "Vitest.compute function (1).executor": "Run",
- "Vitest.compute function.executor": "Run",
- "Vitest.mergeText.executor": "Run",
- "Vitest.mergeText.should merge lines and preserve blank lines when deleteBlankLines is false.executor": "Run",
- "Vitest.mergeText.should merge lines, preserve blank lines and trailing spaces when both deleteBlankLines and deleteTrailingSpaces are false.executor": "Run",
- "Vitest.removeDuplicateLines function.executor": "Run",
- "Vitest.removeDuplicateLines function.newlines option.executor": "Run",
- "Vitest.removeDuplicateLines function.newlines option.should filter newlines when newlines is set to filter.executor": "Run",
- "Vitest.replaceText function (regexp mode).should return the original text when passed an invalid regexp.executor": "Run",
- "Vitest.replaceText function.executor": "Run",
- "git-widget-placeholder": "main",
- "ignore.virus.scanning.warn.message": "true",
- "kotlin-language-version-configured": "true",
- "last_opened_file_path": "C:/Users/Ibrahima/IdeaProjects/omni-tools/src/pages/tools/list/duplicate/index.tsx",
- "node.js.detected.package.eslint": "true",
- "node.js.detected.package.tslint": "true",
- "node.js.selected.package.eslint": "(autodetect)",
- "node.js.selected.package.tslint": "(autodetect)",
- "nodejs_package_manager_path": "npm",
- "npm.build.executor": "Run",
- "npm.dev.executor": "Run",
- "npm.lint.executor": "Run",
- "npm.prebuild.executor": "Run",
- "npm.script:create:tool.executor": "Run",
- "npm.test.executor": "Run",
- "npm.test:e2e.executor": "Run",
- "npm.test:e2e:run.executor": "Run",
- "prettierjs.PrettierConfiguration.Package": "C:\\Users\\Ibrahima\\IdeaProjects\\omni-tools\\node_modules\\prettier",
- "project.structure.last.edited": "Problems",
- "project.structure.proportion": "0.0",
- "project.structure.side.proportion": "0.2",
- "settings.editor.selected.configurable": "refactai_advanced_settings",
- "ts.external.directory.path": "C:\\Users\\Ibrahima\\IdeaProjects\\omni-tools\\node_modules\\typescript\\lib",
- "vue.rearranger.settings.migration": "true"
+
+}]]>
+
-
@@ -188,7 +184,7 @@
-
+
@@ -202,6 +198,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -232,16 +241,6 @@
-
-
-
-
-
-
-
-
-
-
@@ -253,19 +252,19 @@
-
+
+
-
@@ -350,14 +349,6 @@
-
-
- 1740491274739
-
-
-
- 1740491274739
-
1740491737480
@@ -742,7 +733,15 @@
1742961898820
-
+
+
+ 1742967844908
+
+
+
+ 1742967844908
+
+
@@ -789,7 +788,6 @@
-
@@ -814,7 +812,8 @@
-
+
+
diff --git a/src/components/input/BaseFileInput.tsx b/src/components/input/BaseFileInput.tsx
index 94314f7..66c1241 100644
--- a/src/components/input/BaseFileInput.tsx
+++ b/src/components/input/BaseFileInput.tsx
@@ -14,7 +14,7 @@ import greyPattern from '@assets/grey-pattern.png';
interface BaseFileInputComponentProps extends BaseFileInputProps {
children: (props: { preview: string | undefined }) => ReactNode;
- type: 'image' | 'video' | 'audio';
+ type: 'image' | 'video' | 'audio' | 'pdf';
}
export default function BaseFileInput({
diff --git a/src/components/input/ToolPdfInput.tsx b/src/components/input/ToolPdfInput.tsx
new file mode 100644
index 0000000..f236283
--- /dev/null
+++ b/src/components/input/ToolPdfInput.tsx
@@ -0,0 +1,23 @@
+import React, { useRef } from 'react';
+import BaseFileInput from './BaseFileInput';
+import { BaseFileInputProps } from './file-input-utils';
+
+interface PdfFileInputProps extends BaseFileInputProps {}
+
+export default function ToolPdfInput({ ...props }: PdfFileInputProps) {
+ const pdfRef = useRef(null);
+
+ return (
+
+ {({ preview }) => (
+
+ )}
+
+ );
+}
diff --git a/src/components/result/ToolFileResult.tsx b/src/components/result/ToolFileResult.tsx
index 140cce3..315ed63 100644
--- a/src/components/result/ToolFileResult.tsx
+++ b/src/components/result/ToolFileResult.tsx
@@ -63,12 +63,14 @@ export default function ToolFileResult({
}
};
+ type SupportedFileType = 'image' | 'video' | 'audio' | 'pdf' | 'unknown';
// Determine the file type based on MIME type
- const getFileType = () => {
+ const getFileType = (): SupportedFileType => {
if (!value) return 'unknown';
if (value.type.startsWith('image/')) return 'image';
if (value.type.startsWith('video/')) return 'video';
if (value.type.startsWith('audio/')) return 'audio';
+ if (value.type.startsWith('application/pdf')) return 'pdf';
return 'unknown';
};
@@ -135,6 +137,14 @@ export default function ToolFileResult({
style={{ width: '100%', maxWidth: '500px' }}
/>
)}
+ {fileType === 'pdf' && (
+
+ )}
{fileType === 'unknown' && (
File processed successfully. Click download to save the
diff --git a/src/pages/tools/pdf/split-pdf/index.tsx b/src/pages/tools/pdf/split-pdf/index.tsx
index 32f772e..2682949 100644
--- a/src/pages/tools/pdf/split-pdf/index.tsx
+++ b/src/pages/tools/pdf/split-pdf/index.tsx
@@ -9,6 +9,7 @@ import { parsePageRanges, splitPdf } from './service';
import { CardExampleType } from '@components/examples/ToolExamples';
import { PDFDocument } from 'pdf-lib';
import { FormikProps } from 'formik';
+import ToolPdfInput from '@components/input/ToolPdfInput';
type InitialValuesType = {
pageRanges: string;
@@ -115,7 +116,7 @@ export default function SplitPdf({ title }: ToolComponentProps) {
compute={compute}
exampleCards={exampleCards}
inputComponent={
-