Stirling-Tools / Stirling-PDF

#1 Locally hosted web application that allows you to perform various operations on PDF files
https://stirlingpdf.com
MIT License
45.68k stars 3.71k forks source link

customHTMLFiles explanation #1892

Open taohe009 opened 1 month ago

taohe009 commented 1 month ago
customHTMLFiles: false # enable to have files placed in /customFiles/templates override the existing template html files

Can you give me a detailed explanation of how to mount after this function is enabled? I failed to mount it and cannot customize it. How can I add other custom codes to the homepage?

Frooodle commented 1 month ago

I failed to mount it and cannot customize it. can you expand what you mean by this? try just do a docker mount on /customFiles as per our examples

taohe009 commented 1 month ago

I mean, how do I add ad code to the homepage, how do I modify the homepage? Please teach me how.

sbplat commented 1 month ago

Set it to true and place your HTML files in /customFiles/templates. You can view the default files here.

taohe009 commented 1 month ago

customHTMLFiles: false # enable to have files placed in /customFiles/templates override the existing template html files

I can never find where the files that are overridden in /customFiles/templates are? ?

Frooodle commented 1 month ago

Sbplat linked them in his above comment !

taohe009 commented 1 month ago

Sbplat 在他上面的评论中链接了他们!

I used docker exec -it stirling-pdf /bin/bash to enter the container. After entering the container, I couldn't find the homepage I wanted to modify. How can I modify the running container file?

Frooodle commented 1 month ago

Copy the files from link provide that you want to edit place them in customFiles/templates

taohe009 commented 1 month ago

docker-compose.yml Is it correct to change the file to the following?

services: stirling-pdf: image: frooodle/s-pdf:latest volumes:

Frooodle commented 1 month ago

/customFiles/templates on docker side

taohe009 commented 1 month ago

Does this work?

Frooodle commented 1 month ago

remote path MUST be /customFiles/templates

taohe009 commented 1 month ago

I am a newbie and I don't know how to use Docker before. I used to build websites with PHP or create HTML on WWW. Can you explain it in detail? Please, I don't know how to add code to the homepage of the website deployed by Docker, or modify the homepage, thank you.

taohe009 commented 1 month ago

version: '3.3' services: stirling-pdf: image: frooodle/s-pdf:latest ports:

Is this the correct setting?

Frooodle commented 1 month ago

sure that could work if in ./customFiles you have the templates folder copied from https://github.com/Stirling-Tools/Stirling-PDF/tree/main/src/main/resources/templates

taohe009 commented 1 month ago

image

Frooodle commented 1 month ago

nnow if you edit those files it should show on application (cant remember if it needs restart)

taohe009 commented 1 month ago

nnow if you edit those files it should show on application (cant remember if it needs restart)

Can I only change the home.html file for the home page?

taohe009 commented 1 month ago

Could you help me check if my steps are correct?

  1. Enter docker exec -it stirling-pdf /bin/bash

  2. Install Git using the package manager: apk update apk add git

  3. Clone a specific folder: Use the git clone command to clone a specific folder: git clone --depth 1 --filter=blob:none --sparse https://github.com/Stirling-Tools/Stirling-PDF.git cd Stirling-PDF git sparse-checkout init --cone git sparse-checkout set src/main/resources/templates

  4. Copy files: Copy the cloned files to the /customFiles/templates directory. cp -r src/main/resources/templates/* /customFiles/templates/

  5. Enter the directory: cd /customFiles/templates

  6. View the directory: ls /customFiles/templates

  7. Edit the file: nano /customFiles/templates/home.html

After editing, press Ctrl + X to exit the editor, press Y to save the changes, and press Enter to confirm the file name.

Frooodle commented 1 month ago

Seems correct

taohe009 commented 1 month ago

似乎是正确的 nano /customFiles/templates/home.html I changed the

https://stirlingpdf.info/s/clwzgtfw7000gltkmwz1n212m in home.html to my https://www.pdfgoto.com/. After restarting the container, I opened the website and the link was still: https://stirlingpdf.info/s/clwzgtfw7000gltkmwz1n212m

Nothing changed???

taohe009 commented 1 month ago

docker run -d \ -p 8080:8080 \ -v /location/of/ trainingData :/ usr /share/ tessdata

Please check if the command I run in this container is correct? Or is it like the following?

docker run -d \ -p 8080:8080 \ -v /location/of/ trainingData :/ usr /share/ tessdata

Like this? Or like this? :

docker run -d \ -p 8080:8080 \ -v /location/of/ trainingData :/ usr /share/ tessdata

Or like this :

docker run -d \ -p 8080:8080 \ -v /location/of/ trainingData :/ usr /share/ tessdata

taohe009 commented 1 month ago

Frooodle commented 1 month ago

-v ./trainingData :/usr/share/tessdata -v ./extraConfigs : /configs -v ./logs:/logs \ v ./customFiles:/customFiles