-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: missing pdf to html endpoint (#1043)
* fix: missing pdf to html endpoint * refactor: remove unused variable --------- Co-authored-by: Anthony Stirling <77850077+Frooodle@users.noreply.github.com>
- Loading branch information
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
src/main/java/stirling/software/SPDF/controller/api/converters/ConvertPDFToHtml.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package stirling.software.SPDF.controller.api.converters; | ||
|
||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.ModelAttribute; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
import org.springframework.web.multipart.MultipartFile; | ||
|
||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
|
||
import stirling.software.SPDF.model.api.PDFFile; | ||
import stirling.software.SPDF.utils.PDFToFile; | ||
|
||
@RestController | ||
@Tag(name = "Convert", description = "Convert APIs") | ||
@RequestMapping("/api/v1/convert") | ||
public class ConvertPDFToHtml { | ||
|
||
@PostMapping(consumes = "multipart/form-data", value = "/pdf/html") | ||
@Operation( | ||
summary = "Convert PDF to HTML", | ||
description = | ||
"This endpoint converts a PDF file to HTML format. Input:PDF Output:HTML Type:SISO") | ||
public ResponseEntity<byte[]> processPdfToHTML(@ModelAttribute PDFFile request) | ||
throws Exception { | ||
MultipartFile inputFile = request.getFileInput(); | ||
PDFToFile pdfToFile = new PDFToFile(); | ||
return pdfToFile.processPdfToHtml(inputFile); | ||
} | ||
} |