본문 바로가기

반응형

전체 글

(114)
[Ubuntu] MariaDB 일일 백업을 수행 셸 스크립트 Ubuntu에서 MariaDB 데이터베이스의 일일 백업을 수행하는 데 사용할 수 있는 셸 스크립트. #!/bin/bash # Set the date for the backup file date=`date +%Y-%m-%d` # Set the database username and password db_user= db_pass= # Set the name of the database to backup db_name= # Set the path to the backup directory backup_dir= # Create the backup file name backup_file=$backup_dir/$db_name-$date.sql.gz # Use the mysqldump utility to backup..
[JAVA] PDF파일 이미지 변환 [PDF to IMG] import java.awt.image.BufferedImage; import java.io.IOException; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.util.PDFImageWriter; public class Pdftoimg { public static void main(String[] args) { extractPagesAsImage("redpdf.pdf", 300, ""); } /** * PDF파일 이미지 출력 * @param sourceFile 대상 PDF파일 경로 및 파일 * @param resolution 출력 해상도 * @param password 문서 비밀번호 * @return */ public st..
[jQuery] justGage 차트 Customize style body { text-align: center; } #g1, #g2, #g3, #g4, #g5, #g6 { width:200px; height:160px; display: inline-block; margin: 1em; } var g1, g2, g3, g4, g5, g6; window.onload = function(){ var g1 = new JustGage({ id: "g1", value: getRandomInt(0, 100), ..
[SpringBoot] Apache PDFBox 이용한 PDF to Image 변환처리 1. 다음 종속성을 pom.xml 파일에 추가합니다. org.apache.pdfbox pdfbox 2.0.20 2. Spring Boot 애플리케이션에서 변환을 처리할 REST을 생성합니다. import java.awt.image.BufferedImage; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.List; import javax.imageio.ImageIO; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.rendering.ImageType; import org.apache.pdfbox.rendering.PDFRender..
[Svelte + Springboot] Svelte에서 파일다운로드 구현 1. Svelte 구성 요소에 다운로드를 트리거하는 버튼을 만듭니다. Download File 2. 파일에 대한 요청을 서버에 보내는 함수를 만듭니다. async function downloadFile() { const response = await fetch("/api/download"); const blob = await response.blob(); const link = document.createElement("a"); link.href = URL.createObjectURL(blob); link.download = "file.txt"; link.click(); } 3. Spring Boot 애플리케이션에서 REST을 생성하여 파일을 반환합니다. import org.springframework...
[Svelte + Springboot] Svelte에서 파일업로드 구현 Html javascript import { createEventDispatcher } from "svelte"; const dispatch = createEventDispatcher(); async function uploadFile() { const formData = new FormData(); formData.append("file", file); const response = await fetch("/api/upload", { method: "POST", body: formData }); const data = await response.json(); dispatch("upload-success", data); } Spring Boot 애플리케이션에서 파일을 수신할 REST을 생성합니다. imp..
[SpringBoot] MP4 파일을 M3U8 파일로 변환 import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; @RestController public class ConvertController { @PostMapping("/convert") pu..
[React + Spring Boot ] Spring Boot 백엔드를 사용하여 React 앱에서 파일 다운로드를 구현하는 방법 React component import React from 'react'; const FileDownloader = () => { const handleDownload = async () => { try { const response = await fetch('http://localhost:8080/download'); const blob = await response.blob(); const link = document.createElement('a'); link.href = URL.createObjectURL(blob); link.download = 'file.pdf'; link.click(); } catch (error) { console.error(error); } }; return ( Down..

반응형