diff --git a/src/app/page.tsx b/src/app/page.tsx index 9e25c4c..17ae2d4 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -33,7 +33,8 @@ export default function LandingPage() { { name: "Home", id: "home" }, { name: "Features", id: "features" }, { name: "FAQ", id: "faq" }, - { name: "Contact", id: "contact" } + { name: "Contact", id: "contact" }, + { name: "PDF Editor", id: "pdf-editor" } ]} /> @@ -45,7 +46,7 @@ export default function LandingPage() { background={{ variant: "plain" }} avatars={[{ src: "http://img.b2bpic.net/free-vector/digital-web-cloud-computing-background-online-data-transfer_1017-56177.jpg", alt: "pdf upload document icon illustration" }]} buttons={[ - { text: "Upload PDF", href: "#features" }, + { text: "Upload PDF", href: "/pdf-editor" }, { text: "Learn More", href: "#faq" } ]} buttonAnimation="slide-up" @@ -112,7 +113,7 @@ export default function LandingPage() { text="अभी शुरू करें - अपना PDF संपादित करें" background={{ variant: "radial-gradient" }} buttons={[ - { text: "PDF अपलोड करें", href: "#hero" }, + { text: "PDF अपलोड करें", href: "/pdf-editor" }, { text: "हमसे संपर्क करें", href: "mailto:support@pdfedit.in" } ]} useInvertedBackground={true} diff --git a/src/app/pdf-editor/page.tsx b/src/app/pdf-editor/page.tsx new file mode 100644 index 0000000..d5813fa --- /dev/null +++ b/src/app/pdf-editor/page.tsx @@ -0,0 +1,275 @@ +"use client"; + +import { useState, useRef, useEffect } from "react"; +import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider"; +import NavbarStyleFullscreen from "@/components/navbar/NavbarStyleFullscreen/NavbarStyleFullscreen"; +import FooterLogoReveal from "@/components/sections/footer/FooterLogoReveal"; +import { Bold, Italic, Underline, Download } from "lucide-react"; + +export default function PDFEditorPage() { + const [pdfLoaded, setPdfLoaded] = useState(false); + const [editingEnabled, setEditingEnabled] = useState(false); + const [selectedText, setSelectedText] = useState(null); + const [fontFamily, setFontFamily] = useState("Arial"); + const [fontSize, setFontSize] = useState("14"); + const [textColor, setTextColor] = useState("#000000"); + const [isBold, setIsBold] = useState(false); + const [isItalic, setIsItalic] = useState(false); + const [isUnderline, setIsUnderline] = useState(false); + const canvasRef = useRef(null); + const fileInputRef = useRef(null); + + const handleFileUpload = (event: React.ChangeEvent) => { + const file = event.target.files?.[0]; + if (file && file.type === "application/pdf") { + // Simulating PDF loading - in production, use PDF.js library + setPdfLoaded(true); + setEditingEnabled(true); + } + }; + + const handleTextSelection = () => { + const selection = window.getSelection(); + if (selection && selection.rangeCount > 0) { + const range = selection.getRangeAt(0); + const container = document.createElement("span"); + range.surroundContents(container); + setSelectedText(container); + } + }; + + const applyFormatting = () => { + if (selectedText) { + selectedText.style.fontFamily = fontFamily; + selectedText.style.fontSize = `${fontSize}px`; + selectedText.style.color = textColor; + if (isBold) selectedText.style.fontWeight = "bold"; + if (isItalic) selectedText.style.fontStyle = "italic"; + if (isUnderline) selectedText.style.textDecoration = "underline"; + } + }; + + const handleDownload = () => { + // Simulating PDF download - in production, use PDF generation library + const link = document.createElement("a"); + link.href = "#"; + link.download = "edited-document.pdf"; + link.click(); + }; + + return ( + + + +
+
+ {/* Upload Section */} + {!pdfLoaded && ( +
+

Upload Your PDF

+

Edit text while maintaining the original font

+ + +
+ )} + + {/* PDF Editor Section */} + {pdfLoaded && editingEnabled && ( +
+ {/* Toolbar */} +
+
+ {/* Font Family Selector */} +
+ + +
+ + {/* Font Size Dropdown */} +
+ + +
+ + {/* Text Color Picker */} +
+ +
+ { + setTextColor(e.target.value); + applyFormatting(); + }} + className="w-full h-10 border border-accent rounded-md cursor-pointer" + /> + {textColor} +
+
+
+ + {/* Text Formatting Buttons */} +
+ + + + +
+
+ + {/* PDF Canvas Area */} +
+
+

Your PDF content will appear here for editing.

+

Select any text to apply formatting changes.

+

The original font will be maintained while you edit the text.

+
+
+ + {/* Instructions */} +
+

How to Edit:

+
    +
  • ✓ Select text in the PDF area above
  • +
  • ✓ Use the toolbar to change font, size, color, and formatting
  • +
  • ✓ Original font family is preserved for consistent appearance
  • +
  • ✓ Download your edited PDF when done
  • +
+
+
+ )} +
+
+ + +
+ ); +} \ No newline at end of file