節點幫助

toastify npm(如何為開發者工作)

發佈 2024年9月29日
分享:

介紹

在現代網頁開發中,提供及時的反饋給用戶對於流暢的用戶體驗至關重要。 Toast 通知是一種有效的訊息傳遞方式,能在不打擾使用者工作流程的情況下提供訊息。 這 React-toastify 該程式包因其簡單性和靈活性而成為在 React 應用程式中實現 toast 通知的熱門選擇。 我們也將調查 IronPDF NPM 套件用於生成、編輯和管理 PDF 文件。 本文將引導您完成整合的過程 React-toastifyIronPDF 將其引入到您的 React 專案中。

什麼是 Toastify?

React-toastify 是一个 NPM 包,允许您将可自定义的提示通知添加到您的 React 应用程序中,且设置非常简便。它提供多种功能,包括不同的通知类型、自动关闭功能、自定义样式、剩余时间显示等。

toastify npm(開發者如何運作):圖 1 - 使用 React-Toastify 套件的不同風格和自訂化的提示通知。

安裝

要開始使用 react-toastify,您需要透過 NPM 或 Yarn 安裝套件。 在您的專案根目錄中執行以下命令:

npm install react-toastify
npm install react-toastify
'INSTANT VB TODO TASK: The following line uses invalid syntax:
'npm install react-toastify
VB   C#

yarn add react-toastify
yarn add react-toastify
'INSTANT VB TODO TASK: The following line uses invalid syntax:
'yarn add react-toastify
VB   C#

基本用法

安裝套件後,您可以在您的 React 應用程式中開始使用 react-toastify。 以下是一個簡單的代碼示例,展示如何整合和使用 react-toastify。

1. 匯入 Toastify 組件

首先,您需要從 react-toastify 導入必要的組件:

import React from 'react';
import { ToastContainer, toast } from 'react-toastify';
import 'react-toastify/dist/ReactToastify.css';
import React from 'react';
import { ToastContainer, toast } from 'react-toastify';
import 'react-toastify/dist/ReactToastify.css';
'INSTANT VB TODO TASK: The following line uses invalid syntax:
'import React from 'react'; import { ToastContainer, toast } from 'react-toastify'; import 'react-toastify/dist/ReactToastify.css';
VB   C#

2. 配置 Toastify

接下來,將 ToastContainer 元件添加到您的應用程式中。

function App() {
  return (
    <div>  // react component rendered inside
      <ToastContainer />
    </div>
  );
}
function App() {
  return (
    <div>  // react component rendered inside
      <ToastContainer />
    </div>
  );
}
Private Function App() As [function]
'INSTANT VB WARNING: Instant VB cannot determine whether both operands of this division are integer types - if they are then you should use the VB integer division operator:
  Return ((Of div) <ToastContainer /> </div>)
End Function
VB   C#

3. 觸發吐司通知

您可以使用 toast 函數觸發通知提示。 以下是顯示成功消息的程式碼範例:

function notify() {
  toast.success("Success! This is a success message.", {
    position: toast.POSITION.TOP_RIGHT
  });
}
function App() {
  return (
    <div>
      <button onClick={notify}>Show Toast</button>
      <ToastContainer /> // react component inside
    </div>
  );
}
function notify() {
  toast.success("Success! This is a success message.", {
    position: toast.POSITION.TOP_RIGHT
  });
}
function App() {
  return (
    <div>
      <button onClick={notify}>Show Toast</button>
      <ToastContainer /> // react component inside
    </div>
  );
}
Private Function notify() As [function]
  toast.success("Success! This is a success message.", { position:= toast.POSITION.TOP_RIGHT })
End Function
Private Function App() As [function]
'INSTANT VB TODO TASK: The following line contains an assignment within expression that was not extracted by Instant VB:
'ORIGINAL LINE: return (<div> <button onClick={notify}> Show Toast</button> <ToastContainer /> </div>);
'INSTANT VB WARNING: Instant VB cannot determine whether both operands of this division are integer types - if they are then you should use the VB integer division operator:
  Return ((Of div) <button onClick={AddressOf notify}> Show Toast</button> <ToastContainer /> </div>)
End Function
VB   C#

進階功能

OnOpenOnClose 鉤子

React-toastify 提供多種進階功能,讓您可以使用 onOpenonClose 鉤子來自訂吐司的行為和外觀。

import React from 'react';
import { ToastContainer, toast } from 'react-toastify';
import 'react-toastify/dist/ReactToastify.css';
function App() {
  const notify = () => {
    toast("Hello there", {
      onOpen: () => window.alert('Called when I open'),
      onClose: () => window.alert('Called when I close')
    });
  };
  return (
    <div>
      <button onClick={notify}>Notify</button>
      <ToastContainer />
    </div>
  );
}
export default App;
import React from 'react';
import { ToastContainer, toast } from 'react-toastify';
import 'react-toastify/dist/ReactToastify.css';
function App() {
  const notify = () => {
    toast("Hello there", {
      onOpen: () => window.alert('Called when I open'),
      onClose: () => window.alert('Called when I close')
    });
  };
  return (
    <div>
      <button onClick={notify}>Notify</button>
      <ToastContainer />
    </div>
  );
}
export default App;
'INSTANT VB TODO TASK: The following line uses invalid syntax:
'import React from 'react'; import { ToastContainer, toast } from 'react-toastify'; import 'react-toastify/dist/ReactToastify.css'; @function App() { const notify = () => { toast("Hello there", { onOpen: () => window.alert('Called @when I open'), onClose: () => window.alert('Called @when I close') }); }; Return(<div> <button onClick={notify}> Notify</button> <ToastContainer /> </div>); } export default App;
VB   C#

在此範例中:

  • 當 toast 開啟時,onOpen 鉤子會觸發,然後我們顯示一個警告。
  • 當通知關閉時,onClose 鉤子會觸發,然後顯示另一個警告。

自訂位置

您可以使用 position 選項在螢幕上不同位置顯示提示框:

toast.info("Information message", {
  position:"top-right"
});
toast.info("Information message", {
  position:"top-right"
});
toast.info("Information message", { position:="top-right" })
VB   C#

自動關閉持續時間

您可以使用 autoClose 選項設置吐司顯示的持續時間:

toast.warn("Warning message", {
  autoClose: 5000 // Auto close after 5 seconds
});
toast.warn("Warning message", {
  autoClose: 5000 // Auto close after 5 seconds
});
toast.warn("Warning message", { autoClose:= 5000 })
VB   C#

自訂樣式

可以使用 className 和 style 選項對提示訊息進行自定義樣式設定:

toast.error("Error message", {
  className: 'custom-toast',
  style: { background: 'red', color: 'white' }
});
toast.error("Error message", {
  className: 'custom-toast',
  style: { background: 'red', color: 'white' }
});
toast.error("Error message", { className: 'custom-toast', style: { background: 'red', color: 'white' } });
VB   C#

關閉通知訊息

可以使用 toast.dismiss 方法以程式方式關閉通知:

const toastId = toast("This toast can be dismissed");
function dismissToast() {
  toast.dismiss(toastId);
}
const toastId = toast("This toast can be dismissed");
function dismissToast() {
  toast.dismiss(toastId);
}
Private const toastId = toast("This toast can be dismissed")
Private Function dismissToast() As [function]
  toast.dismiss(toastId)
End Function
VB   C#

以下是一個完整的範例,展示如何使用各種 react-toastify 的功能:

import React from 'react';
import { ToastContainer, toast } from 'react-toastify';
import 'react-toastify/dist/ReactToastify.css';
function App() {
  const notify = () => {
    toast.success("Success! This is a success message.", {
      position:"top-right"  // success notification
    });
    toast.info("Information message", {
      position:"bottom-left"  // info will be displayed with progress bar
    });
    toast.warn("Warning message", {
      autoClose: 5000 // close or pause toast messages
    });
    toast.error("Error message", {
      className: 'custom-toast',
      style: { background: 'red', color: 'white' }
    });
  };
  return (
    <div>
      <button onClick={notify}>Show Toasts</button>
      <ToastContainer />
    </div>
  );
}
export default App;
import React from 'react';
import { ToastContainer, toast } from 'react-toastify';
import 'react-toastify/dist/ReactToastify.css';
function App() {
  const notify = () => {
    toast.success("Success! This is a success message.", {
      position:"top-right"  // success notification
    });
    toast.info("Information message", {
      position:"bottom-left"  // info will be displayed with progress bar
    });
    toast.warn("Warning message", {
      autoClose: 5000 // close or pause toast messages
    });
    toast.error("Error message", {
      className: 'custom-toast',
      style: { background: 'red', color: 'white' }
    });
  };
  return (
    <div>
      <button onClick={notify}>Show Toasts</button>
      <ToastContainer />
    </div>
  );
}
export default App;
'INSTANT VB TODO TASK: The following line uses invalid syntax:
'import React from 'react'; import { ToastContainer, toast } from 'react-toastify'; import 'react-toastify/dist/ReactToastify.css'; @function App() { const notify = () => { toast.success("Success! This is a success message.", { position:"top-right" }); toast.info("Information message", { position:"bottom-left" }); toast.warn("Warning message", { autoClose: 5000 }); toast.@error("Error message", { className: 'custom-toast', style: { background: 'red', color: 'white' } }); }; Return(<div> <button onClick={notify}> Show Toasts</button> <ToastContainer /> </div>); } export default App;
VB   C#

輸出

toastify npm(開發人員如何使用):圖 2 - React-Toastify 應用程式在 localhost 埠:3000 上運行,並顯示成功、警告和錯誤消息的通知。

介紹 IronPDF

IronPDF 是一個強大的 C# PDF 庫,允許開發人員在他們的 .NET 專案中生成和編輯 PDF。 無論您需要從 HTML 創建 PDF、操作現有的 PDF,還是將網頁轉換為 PDF 格式,IronPDF 都能滿足您的需求。

toastify npm(對開發者的運作方式):圖3 - IronPDF for Node.js:Node.js PDF 函式庫

以下是一些主要功能和使用案例:

HTML 轉換為 PDF

IronPDF 可以將 HTML 頁面轉換為 PDF,無論是來自 URL、HTML 文件還是 HTML 字串。 您還可以將本地 HTML 文件或 HTML 字串轉換為 PDF。

2. 跨平台支持

IronPDF 可以在各種平台上無縫運行,包括:

  • .NET Core (8, 7, 6, 5, 和 3.1+)
  • .NET Standard (2.0+)
  • .NET Framework (4.6.2+)
  • 網頁 (Blazor 和 WebForms)
  • 桌面 (WPF & MAUI)
  • 控制台 (應用程序及庫)
  • Windows、Linux 和 macOS 環境。

3. 編輯和操作 PDF

IronPDF 允許您:

4. 自定義與格式化

您可以套用頁面模板、頁首、頁尾、頁碼和自定義邊距。 IronPDF 支援 UTF-8 字元編碼、基礎網址、資源編碼等。

5. 標準遵循

IronPDF 遵循多種 PDF 標準,包括 PDF 版本 (1.2 - 1.7), PDF/UA (PDF/UA-1),和 PDF/A (PDF/A-3b).

使用 IronPDF 和 Toastify NPM 套件生成 PDF 文件

安裝依賴項:首先,創建一個新的 Next.js 專案 (如果您還沒有) 使用以下命令:請參考 設置 頁面。

npx create-next-app@latest my-pdf-app --use-npm --example "https://github.com/vercel/next-learn/tree/main/basics/learn-starter"
npx create-next-app@latest my-pdf-app --use-npm --example "https://github.com/vercel/next-learn/tree/main/basics/learn-starter"
'INSTANT VB TODO TASK: The following line uses invalid syntax:
'npx create-@next-app@latest my-pdf-app --use-npm --example "https://github.com/vercel/next-learn/tree/main/basics/learn-starter"
VB   C#

接著,導航至您的專案目錄:

cd my-pdf-app
cd my-pdf-app
'INSTANT VB TODO TASK: The following line uses invalid syntax:
'cd my-pdf-app
VB   C#

安裝所需的軟體包:

npm install @ironsoftware/ironpdf
npm install react-toastify
npm install @ironsoftware/ironpdf
npm install react-toastify
'INSTANT VB TODO TASK: The following line uses invalid syntax:
'npm install @ironsoftware/ironpdf npm install react-toastify
VB   C#

創建 PDF:現在,讓我們來創建一個使用生成 PDF 的簡單示例。 IronPDF. 在您的 Next.js 組件中 (例如,pages/index.tsx),新增以下代碼:

import Head from 'next/head';
import styles from '../styles/Home.module.css';
import {ToastContainer, toast} from 'react-toastify';
import 'react-toastify/dist/ReactToastify.css';
import {useState} from "react";
export default function Home() {
    const [textInput, setTextInput] = useState('');
    const notify = () => {
        toast.success("Success! This is a success message.", {
            position: "top-right"
        });
        toast.info("Information message", {
            position: "bottom-left"
        });
        toast.warn("Warning message", {
            autoClose: 5000
        });
        toast.error("Error message", {
            className: 'custom-toast',
            style: {background: 'red', color: 'white'}
        });
    };
    const generatePdf = async () => {
        try {
            const response = await fetch('/api/pdf?url='+textInput);
            const blob = await response.blob();
            const url = window.URL.createObjectURL(new Blob([blob]));
            const link = document.createElement('a');
            link.href = url;
            link.setAttribute('download', 'example.pdf');
            document.body.appendChild(link);
            link.click();
            link.parentNode.removeChild(link);
        } catch (error) {
            console.error('Error generating PDF:', error);
        }
    };
    const handleChange = (event) => {
        setTextInput(event.target.value);
    }
    return (
        <div className={styles.container}>
            <Head>
                <title>Demo Toaster and Generate PDF From IronPDF</title>
                <link rel="icon" href="/favicon.ico"/>
            </Head>
            <main>
                <h1>Demo Toaster and Generate PDF From IronPDF</h1>
                <button style={{margin:20, padding:5}} onClick={notify}>Show Toasts</button>
                <p>
                    <span>Enter Url To Convert to PDF:</span>{" "}
                </p>
                <button style={{margin:20, padding:5}} onClick={generatePdf}>Generate PDF</button>
                <ToastContainer/>
            </main>          
            <style jsx>{`
                main {
                    padding: 5rem 0;
                    flex: 1;
                    display: flex;
                    flex-direction: column;
                    justify-content: center;
                    align-items: center;
                }
                footer {
                    width: 100%;
                    height: 100px;
                    border-top: 1px solid #eaeaea;
                    display: flex;
                    justify-content: center;
                    align-items: center;
                }
                footer img {
                    margin-left: 0.5rem;
                }
                footer a {
                    display: flex;
                    justify-content: center;
                    align-items: center;
                    text-decoration: none;
                    color: inherit;
                }
                code {
                    background: #fafafa;
                    border-radius: 5px;
                    padding: 0.75rem;
                    font-size: 1.1rem;
                    font-family: Menlo,
                    Monaco,
                    Lucida Console,
                    Liberation Mono,
                    DejaVu Sans Mono,
                    Bitstream Vera Sans Mono,
                    Courier New,
                    monospace;
                }
            `}</style>
            <style jsx global>{`
                html,
                body {
                    padding: 0;
                    margin: 0;
                    font-family: -apple-system,
                    BlinkMacSystemFont,
                    Segoe UI,
                    Roboto,
                    Oxygen,
                    Ubuntu,
                    Cantarell,
                    Fira Sans,
                    Droid Sans,
                    Helvetica Neue,
                    sans-serif;
                }
                * {
                    box-sizing: border-box;
                }
            `}</style>
        </div>
    );
}
import Head from 'next/head';
import styles from '../styles/Home.module.css';
import {ToastContainer, toast} from 'react-toastify';
import 'react-toastify/dist/ReactToastify.css';
import {useState} from "react";
export default function Home() {
    const [textInput, setTextInput] = useState('');
    const notify = () => {
        toast.success("Success! This is a success message.", {
            position: "top-right"
        });
        toast.info("Information message", {
            position: "bottom-left"
        });
        toast.warn("Warning message", {
            autoClose: 5000
        });
        toast.error("Error message", {
            className: 'custom-toast',
            style: {background: 'red', color: 'white'}
        });
    };
    const generatePdf = async () => {
        try {
            const response = await fetch('/api/pdf?url='+textInput);
            const blob = await response.blob();
            const url = window.URL.createObjectURL(new Blob([blob]));
            const link = document.createElement('a');
            link.href = url;
            link.setAttribute('download', 'example.pdf');
            document.body.appendChild(link);
            link.click();
            link.parentNode.removeChild(link);
        } catch (error) {
            console.error('Error generating PDF:', error);
        }
    };
    const handleChange = (event) => {
        setTextInput(event.target.value);
    }
    return (
        <div className={styles.container}>
            <Head>
                <title>Demo Toaster and Generate PDF From IronPDF</title>
                <link rel="icon" href="/favicon.ico"/>
            </Head>
            <main>
                <h1>Demo Toaster and Generate PDF From IronPDF</h1>
                <button style={{margin:20, padding:5}} onClick={notify}>Show Toasts</button>
                <p>
                    <span>Enter Url To Convert to PDF:</span>{" "}
                </p>
                <button style={{margin:20, padding:5}} onClick={generatePdf}>Generate PDF</button>
                <ToastContainer/>
            </main>          
            <style jsx>{`
                main {
                    padding: 5rem 0;
                    flex: 1;
                    display: flex;
                    flex-direction: column;
                    justify-content: center;
                    align-items: center;
                }
                footer {
                    width: 100%;
                    height: 100px;
                    border-top: 1px solid #eaeaea;
                    display: flex;
                    justify-content: center;
                    align-items: center;
                }
                footer img {
                    margin-left: 0.5rem;
                }
                footer a {
                    display: flex;
                    justify-content: center;
                    align-items: center;
                    text-decoration: none;
                    color: inherit;
                }
                code {
                    background: #fafafa;
                    border-radius: 5px;
                    padding: 0.75rem;
                    font-size: 1.1rem;
                    font-family: Menlo,
                    Monaco,
                    Lucida Console,
                    Liberation Mono,
                    DejaVu Sans Mono,
                    Bitstream Vera Sans Mono,
                    Courier New,
                    monospace;
                }
            `}</style>
            <style jsx global>{`
                html,
                body {
                    padding: 0;
                    margin: 0;
                    font-family: -apple-system,
                    BlinkMacSystemFont,
                    Segoe UI,
                    Roboto,
                    Oxygen,
                    Ubuntu,
                    Cantarell,
                    Fira Sans,
                    Droid Sans,
                    Helvetica Neue,
                    sans-serif;
                }
                * {
                    box-sizing: border-box;
                }
            `}</style>
        </div>
    );
}
'INSTANT VB TODO TASK: The following line uses invalid syntax:
'import Head from '@next/head'; import styles from '../styles/Home.@module.css'; import {ToastContainer, toast} from 'react-toastify'; import 'react-toastify/dist/ReactToastify.css'; import {useState} from "react"; export default @function Home() { const [textInput, setTextInput] = useState(''); const notify = () => { toast.success("Success! This is a success message.", { position: "top-right" }); toast.info("Information message", { position: "bottom-left" }); toast.warn("Warning message", { autoClose: 5000 }); toast.@error("Error message", { className: 'custom-toast', style: {background: 'red', color: 'white'} }); }; const generatePdf = async() => { try { const response = await fetch('/api/System.Nullable<pdf>url='+textInput); const blob = await response.blob(); const url = window.URL.createObjectURL(New Blob([blob])); const link = document.createElement("a"c); link.href = url; link.setAttribute('download', 'example.pdf'); document.body.appendChild(link); link.click(); link.parentNode.removeChild(link); } catch(@error) { console.@error('@Error generating PDF:', @error); } }; const handleChange = (event) => { setTextInput(event.target.value); } Return(<div className={styles.container}> <Head> <title> Demo Toaster @and Generate PDF From IronPDF</title> <link rel="icon" href="/favicon.ico"/> </Head> <main> <h1> Demo Toaster @and Generate PDF From IronPDF</h1> <button style={{margin:20, padding:5}} onClick={notify}> Show Toasts</button> <p> <span> Enter Url @To Convert @to PDF:</span>{" "} </p> <button style={{margin:20, padding:5}} onClick={generatePdf}> Generate PDF</button> <ToastContainer/> </main> <style jsx>{` main { padding: 5rem 0; flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; } footer { width: 100%; height: 100px; border-top: 1px solid #eaeaea; display: flex; justify-content: center; align-items: center; } footer img { margin-left: 0.5rem; } footer a { display: flex; justify-content: center; align-items: center; text-decoration: none; color: inherit; } code { background: #fafafa; border-radius: 5px; padding: 0.75rem; font-size: 1.1rem; font-family: Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier @New, monospace; } `}</style> <style jsx global>{` html, body { padding: 0; margin: 0; font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif; } * { box-sizing: border-box; } `}</style> </div>); }
VB   C#

由於 IronPDF 僅在 Node.js 上運行,接下來為應用程式添加一個 API,以便使用 Node.js 生成 PDF。

在 pages/api 資料夾中建立一個名為 pdf.js 的文件,並加入以下代碼。

// pages/api/pdf.js
import {IronPdfGlobalConfig, PdfDocument} from "@ironsoftware/ironpdf";
// Apply your IronPDF license key
IronPdfGlobalConfig.getConfig().licenseKey = "Add Your key here";
export default async function handler(req, res) {
    try {
        const url = req.query.url
        const pdf = await PdfDocument.fromUrl(url);
        const data = await pdf.saveAsBuffer();
        console.error('data PDF:', data);
        res.setHeader('Content-Type', 'application/pdf');
        res.setHeader('Content-Disposition', 'attachment; filename=awesomeIron.pdf');
        res.send(data);
    } catch (error) {
        console.error('Error generating PDF:', error);
        res.status(500).end();
    }
}
// pages/api/pdf.js
import {IronPdfGlobalConfig, PdfDocument} from "@ironsoftware/ironpdf";
// Apply your IronPDF license key
IronPdfGlobalConfig.getConfig().licenseKey = "Add Your key here";
export default async function handler(req, res) {
    try {
        const url = req.query.url
        const pdf = await PdfDocument.fromUrl(url);
        const data = await pdf.saveAsBuffer();
        console.error('data PDF:', data);
        res.setHeader('Content-Type', 'application/pdf');
        res.setHeader('Content-Disposition', 'attachment; filename=awesomeIron.pdf');
        res.send(data);
    } catch (error) {
        console.error('Error generating PDF:', error);
        res.status(500).end();
    }
}
' pages/api/pdf.js
import
If True Then
	IronPdfGlobalConfig, PdfDocument
End If
from "@ironsoftware/ironpdf"
' Apply your IronPDF license key
IronPdfGlobalConfig.getConfig().licenseKey = "Add Your key here"
'INSTANT VB TODO TASK: Local functions are not converted by Instant VB:
'export default async @function handler(req, res)
'{
'	try
'	{
'		const url = req.query.url const pdf = await PdfDocument.fromUrl(url);
'		const data = await pdf.saveAsBuffer();
'		console.@error('data PDF:', data);
'		res.setHeader('Content-Type', 'application/pdf');
'		res.setHeader('Content-Disposition', 'attachment; filename=awesomeIron.pdf');
'		res.send(data);
'	}
'	catch (@error)
'	{
'		console.@error('@Error generating PDF:', @error);
'		res.status(500).@end();
'	}
'}
VB   C#

注意:在上述代碼中添加您自己的授權密鑰

運行您的應用程式:啟動您的 Next.js 應用程式:

npm run dev
or
yarn dev
npm run dev
or
yarn dev
'INSTANT VB TODO TASK: The following line uses invalid syntax:
'npm run dev @or yarn dev
VB   C#

輸出

打開您的瀏覽器並瀏覽至 http://localhost:3000 以查看以下網站。

toastify npm(對開發人員的運作方式):圖 4 - React-Toastify 應用程式在本地主機端口:3000 上運行,顯示一個按鈕「顯示 Toasts」,以及一個「輸入 URL 以轉換為 PDF」的文字欄和「生成 PDF」按鈕。

現在點擊「顯示提示訊息」按鈕查看提示訊息

toastify npm (開發者如何使用)圖 5 - 點擊「顯示提示」按鈕後,應用程式會顯示成功、警告和錯誤訊息的提示通知。 此外,您可以使用文字欄位輸入想要轉換為 PDF 文件的網頁 URL,然後點擊「生成 PDF」按鈕。 這將使用 IronPDF 將指定的網頁轉換為 PDF。

現在輸入網站 URL 生成 PDF,然後點擊生成 PDF。 如下所示的名為 awesomeIron.pdf 的檔案將被下載。

toastify npm(開發者如何使用):圖 6 - 使用 IronPDF 將指定的 URL 轉換為 PDF 所生成的輸出 PDF

IronPDF 授權

IronPDF 頁面。

將授權密鑰放置在應用程式中,如下所示:

import {IronPdfGlobalConfig, PdfDocument} from "@ironsoftware/ironpdf";
// Apply your IronPDF license key
IronPdfGlobalConfig.getConfig().licenseKey = "Add Your key here";
import {IronPdfGlobalConfig, PdfDocument} from "@ironsoftware/ironpdf";
// Apply your IronPDF license key
IronPdfGlobalConfig.getConfig().licenseKey = "Add Your key here";
IRON VB CONVERTER ERROR developers@ironsoftware.com
VB   C#

結論

React-toastify 是一個功能強大且易於使用的函式庫,用於向您的 React 應用程式添加吐司通知。 透過其廣泛的功能和自訂選項,您可以以超級簡單且不具侵入性的方式提供即時回饋,提高用戶體驗。 另一方面 IronPDF 是目前支持最强的企業資料庫,由 IronSoftware 產生、編輯和管理 PDF 文件。 按照本文所述的步驟,您可以快速整合 React-toastifyIronPDF 進入您的專案並開始利用其功能。

如需有關開始使用 IronPDF 的更多資訊,請參考他們的 文檔 頁面 和 代碼範例.

< 上一頁
複製 npm(開發者如何運作)
下一個 >
Socket.io node.js(如何為開發者運作)

準備開始了嗎? 版本: 2024.9 剛剛發布

免費 npm 安裝 查看許可證 >