diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 9638f3a..3bf11df 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -27,14 +27,15 @@ jobs: - name: Build Docker image run: docker build -t vue-pdf-annotate . - - name: Deploy Docker container to GitHub Pages + - name: Run Docker container run: | - docker run -d -p 5173:5173 vuetify-project - docker cp $(docker ps -ql):/app/dist ./dist + docker run -d -p 5000:80 vue-pdf-annotate + sleep 10 # wait for the container to start + docker cp $(docker ps -ql):/usr/share/nginx/html ./dist docker stop $(docker ps -ql) - name: Deploy to GitHub Pages uses: peaceiris/actions-gh-pages@v3 with: - github_token: ${{ secrets.GH_TOKEN }} + github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./dist diff --git a/Dockerfile b/Dockerfile index ff0cbf8..64a4913 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ -# Use a Node.js base image -FROM node:18 +# Stage 1: Build the application +FROM node:18 as build # Set the working directory WORKDIR /app @@ -16,8 +16,17 @@ COPY . . # Build the application RUN npm run build -# Expose the port the app runs on -EXPOSE 5173 +# Stage 2: Serve the application with Nginx +FROM nginx:alpine -# Command to run the app -CMD ["npm", "run", "dev"] \ No newline at end of file +# Copy the build output to the Nginx html directory +COPY --from=build /app/dist /usr/share/nginx/html + +# Copy the Nginx configuration file +COPY nginx.conf /etc/nginx/nginx.conf + +# Expose the port +EXPOSE 80 + +# Start Nginx +CMD ["nginx", "-g", "daemon off;"] diff --git a/README.md b/README.md index ffbd635..f219d37 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,12 @@ Welcome to the PDF Annotator project! This project is built using Vue.js, PDF.js As someone who found the documentation of PDF.js insufficient and faced significant challenges in programmatically adding annotations to PDF documents using a dedicated backend and database, I decided to create this project. Working with the annotation layer of PDF.js was very challenging and almost impossible to accomplish this task. Therefore, I created this small project to showcase the easiest production-level solution ([pdfAnnotate](https://github.com/highkite/pdfAnnotate)) I found for programmatic annotation and demonstrate how you can easily integrate the prebuilt PDF.js viewer into your Vue project. +
+ +
+ ### Table of Contents 1. [Getting Started](#getting-started) @@ -66,65 +72,31 @@ The `pdfViewer.vue` component integrates the default/prebuilt PDF.js viewer usin Here's how simple integration with iframe works: -1. **Vue Template Structure** +1. **Integration of PDFjs in Vue component via `iframe`** ```html+ +
- Squiggly ++ +
- Underline ++ +
- Strikeout ++ +
- Square ++ +
- Oval ++ +
- and more ### Parameters Required @@ -160,114 +162,4 @@ for details and the rest of the documentation, I urge you to read their entire d * Note: one thing you need to be cautious is that pdfjs origin for a "rect" is top left, and pdfAnnotate origin is buttom left, so you need a simple conversion of "y" coordinates to create the list of your annotations. -### Script Setup - -```javascript - -``` - -By integrating `pdfAnnotate`, you can easily add programmatic annotations to your PDF documents. This library supports various annotation types, making it flexible and powerful for different use cases. - ---- - - - Thank you for using the PDF Annotator project! We hope this guide helps you get the most out of your PDF viewing and annotation capabilities. Happy coding! \ No newline at end of file diff --git a/index.html b/index.html index c157160..f284bc9 100644 --- a/index.html +++ b/index.html @@ -1,18 +1,3 @@ - - - @@ -25,11 +10,11 @@ integrity="sha512-iBBXm8fW90+nuLcSKlbmrPcLa0OT92xO1BIsZ+ywDWZCvqsWgccV3gFoRBv0z+8dLJgyAHIhR35VZc2oM/gI1w==" crossorigin="anonymous" /> -