Skip to content

Commit

Permalink
Merge pull request #7 from vinayakjaas/documentation
Browse files Browse the repository at this point in the history
Documentation Codebase
  • Loading branch information
rks-031 authored Jul 14, 2024
2 parents f5410e3 + 6132f74 commit 6b24aa3
Show file tree
Hide file tree
Showing 23 changed files with 319 additions and 623 deletions.
12 changes: 0 additions & 12 deletions Pdf_Library/Documentation/blog/2019-05-28-first-blog-post.md

This file was deleted.

44 changes: 0 additions & 44 deletions Pdf_Library/Documentation/blog/2019-05-29-long-blog-post.md

This file was deleted.

20 changes: 0 additions & 20 deletions Pdf_Library/Documentation/blog/2021-08-01-mdx-blog-post.mdx

This file was deleted.

Binary file not shown.
25 changes: 0 additions & 25 deletions Pdf_Library/Documentation/blog/2021-08-26-welcome/index.md

This file was deleted.

17 changes: 0 additions & 17 deletions Pdf_Library/Documentation/blog/authors.yml

This file was deleted.

16 changes: 0 additions & 16 deletions Pdf_Library/Documentation/blog/tags.yml

This file was deleted.

50 changes: 20 additions & 30 deletions Pdf_Library/Documentation/docs/intro.md
Original file line number Diff line number Diff line change
@@ -1,47 +1,37 @@
---
sidebar_position: 1
---
# Introduction

# Tutorial Intro
## PDFViewer UI

Let's discover **Docusaurus in less than 5 minutes**.
PDFViewer UI is a comprehensive library that empowers users to choose and open PDF files through a user-friendly interface. The library is designed to seamlessly integrate with React applications, providing a smooth experience for rendering and viewing PDFs. With a focus on flexibility, the PDFViewer UI allows PDFs to be fetched from various sources, including user uploads and cloud databases, and offers robust functionality for displaying and managing PDF documents.

## Getting Started

Get started by **creating a new site**.
## PDF Database Renderer Frontend

Or **try Docusaurus immediately** with **[docusaurus.new](https://docusaurus.new)**.
The PDFDatabase Renderer Frontend is built using React and leverages the `react-pdf` library to handle PDF rendering. It offers a clean and intuitive interface for users to upload and view PDF files, with options to show or hide the PDF as needed.

### What you'll need
- **Choose a PDF file UI**: Users can select and upload PDF files using an easy-to-use upload form.
- **Open and view PDF files**: Once uploaded, PDFs are rendered directly on the UI for immediate viewing.
- **Toggle visibility**: Users can show or hide the rendered PDF using a dedicated button, providing control over the display.

- [Node.js](https://nodejs.org/en/download/) version 18.0 or above:
- When installing Node.js, you are recommended to check all checkboxes related to dependencies.
## PDF Database Renderer Backend

## Generate a new site
The PDF Database Renderer Backend is a robust Node.js application designed to store and manage PDFs in a MongoDB database. It provides secure and efficient handling of file uploads and retrievals, ensuring that PDF data is stored and accessed seamlessly.

Generate a new Docusaurus site using the **classic template**.
- **Server-side implementation**: Comprehensive server-side code to handle the PDF rendering backend.
- **MongoDB integration**: Configured to use MongoDB as the primary database for storing PDF files.
- **File handling with Multer**: Utilizes Multer for managing multipart/form-data, facilitating smooth file uploads.
- **API endpoints for PDF retrieval**: Offers API endpoints to retrieve stored PDFs, making it easy to integrate with frontend applications.
- **Error handling and validation**: Ensures robust error handling and validation mechanisms for file uploads, maintaining data integrity.

The classic template will automatically be added to your project after you run the command:
## PDF Rendering Library

```bash
npm init docusaurus@latest my-website classic
```
The PDF Rendering Library is a versatile tool designed to render PDFs from diverse sources, including user uploads, MongoDB, and educational platforms like SCORM Cloud. It provides a consistent interface to simplify the integration of PDF functionalities into various applications.

You can type this command into Command Prompt, Powershell, Terminal, or any other integrated terminal of your code editor.
- **Render course materials and assessments**: Capable of displaying course-related PDFs and assessments stored in SCORM Cloud.
- **Display and manage MongoDB PDFs**: Facilitates the rendering and management of PDFs stored in MongoDB databases.
- **User upload functionality**: Allows users to upload their PDF documents, which can then be viewed and downloaded through the interface.

The command also installs all necessary dependencies you need to run Docusaurus.

## Start your site

Run the development server:

```bash
cd my-website
npm run start
```

The `cd` command changes the directory you're working with. In order to work with your newly created Docusaurus site, you'll need to navigate the terminal there.

The `npm run start` command builds your website locally and serves it through a development server, ready for you to view at http://localhost:3000/.

Open `docs/intro.md` (this page) and edit some lines: the site **reloads automatically** and displays your changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"label": "Tutorial - Basics",
"label": "Pdf Library",
"position": 2,
"link": {
"type": "generated-index",
"description": "5 minutes to learn the most important Docusaurus concepts."
"description": "Pdf Library Introduction "
}
}
23 changes: 0 additions & 23 deletions Pdf_Library/Documentation/docs/tutorial-basics/congratulations.md

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,80 @@
sidebar_position: 3
---

# Create a Blog Post
# PDF Database Renderer Backend

Docusaurus creates a **page for each blog post**, but also a **blog index page**, a **tag system**, an **RSS** feed...
## Introduction

## Create your first Post
PDF Database Renderer is a backend application that stores PDFs in a MongoDB database and provides API endpoints to retrieve these PDFs. The application is built using Node.js, Express, MongoDB, and Multer for handling file uploads.

Create a file at `blog/2021-02-28-greetings.md`:
## Features

```md title="blog/2021-02-28-greetings.md"
---
slug: greetings
title: Greetings!
authors:
- name: Joel Marcey
title: Co-creator of Docusaurus 1
url: https://github.com/JoelMarcey
image_url: https://github.com/JoelMarcey.png
- name: Sébastien Lorber
title: Docusaurus maintainer
url: https://sebastienlorber.com
image_url: https://github.com/slorber.png
tags: [greetings]
---
- Implement server-side code for PDF Database Renderer.
- Configure MongoDB as the database.
- Set up Multer to handle multipart/form-data.
- Create API endpoints for PDF retrieval.
- Integrate PDF processing and storage with MongoDB.
- Ensure error handling and validation for file uploads.

## Prerequisites

- Node.js and npm installed.
- MongoDB installed and running.

## Installation

1. Clone the repository:

```bash
git clone PROJECT_REPO_LINK
cd pdf-database-renderer
```

2. Install the dependencies:

```bash
npm install
```

3. Create a `.env` file in the root directory and add your MongoDB URI:

```env
MONGO_URI=your_mongodb_uri
```

## Usage

1. Start the server:

```bash
npm run dev
```

2. The server will run on `http://localhost:5000`.

## API Endpoints

### Upload PDF

- **URL**: `/upload`
- **Method**: `POST`
- **Description**: Upload a PDF file.
- **Headers**:
- `Content-Type`: `multipart/form-data`
- **Body**:
- `file`: The PDF file to upload.
- **Response**:
- `200 OK`: If the PDF is uploaded successfully.
- `400 Bad Request`: If there's an error in the file upload.
## Dependencies
Congratulations, you have made your first post!
- **express**: Fast, unopinionated, minimalist web framework for Node.js.
- **mongoose**: MongoDB object modeling tool.
- **multer**: Node.js middleware for handling multipart/form-data.
- **nodemon**: Utility that monitors for any changes in your source and automatically restarts your server.
Feel free to play around and edit this post as much as you like.
```
## Error Handling and Validation
A new blog post is now available at [http://localhost:3000/blog/greetings](http://localhost:3000/blog/greetings).
- Proper error handling is implemented for file uploads, database operations, and invalid requests.
- Validation is done to ensure that only PDF files are uploaded.
Loading

0 comments on commit 6b24aa3

Please sign in to comment.