Skip to content

#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere

refactor(convert)!: remove PostScript vector conversion endpoints (#8735)

brios6aa6d0177440
diff --git a/app/common/src/main/java/stirling/software/SPDF/config/EndpointConfiguration.java b/app/common/src/main/java/stirling/software/SPDF/config/EndpointConfiguration.java
index 8de7cac0e3..d6bb0c6e85 100644
--- a/app/common/src/main/java/stirling/software/SPDF/config/EndpointConfiguration.java
+++ b/app/common/src/main/java/stirling/software/SPDF/config/EndpointConfiguration.java
@@ -386,8 +386,6 @@ public class EndpointConfiguration {
addEndpointToGroup("Convert", "pdf-to-epub");
addEndpointToGroup("Convert", "ebook-to-pdf");
// Backend-only endpoints (not in frontend tool registry)
- addEndpointToGroup("Convert", "pdf-to-vector");
- addEndpointToGroup("Convert", "vector-to-pdf");
addEndpointToGroup("Convert", "pdf-to-video");
addEndpointToGroup("Convert", "cbz-to-pdf");
addEndpointToGroup("Convert", "pdf-to-cbz");
@@ -585,8 +583,6 @@ public class EndpointConfiguration {
addEndpointToGroup("Ghostscript", "crop");
addEndpointToGroup("Ghostscript", "replace-invert-pdf");
addEndpointToGroup("Ghostscript", "scanner-effect");
- addEndpointToGroup("Ghostscript", "pdf-to-vector");
- addEndpointToGroup("Ghostscript", "vector-to-pdf");
/* ImageMagick */
addEndpointToGroup("ImageMagick", "compress-pdf");
diff --git a/app/common/src/main/java/stirling/software/common/model/tool/ToolFormat.java b/app/common/src/main/java/stirling/software/common/model/tool/ToolFormat.java
index e7a9a13f5d..58b55cf02b 100644
--- a/app/common/src/main/java/stirling/software/common/model/tool/ToolFormat.java
+++ b/app/common/src/main/java/stirling/software/common/model/tool/ToolFormat.java
@@ -18,9 +18,9 @@ public enum ToolFormat {
PDF("pdf"),
PDF_ENCRYPTED("pdf"),
- // Vector formats are folded in: the extension set has always included svg/eps, and splitting
+ // Vector formats are folded in: the extension set has always included svg/ai, and splitting
// them out would make chains that run fine today report as broken.
- IMAGE("png", "jpg", "jpeg", "gif", "webp", "bmp", "tif", "tiff", "svg", "psd", "ai", "eps"),
+ IMAGE("png", "jpg", "jpeg", "gif", "webp", "bmp", "tif", "tiff", "svg", "psd", "ai"),
/**
* An archive that is itself the deliverable. Multiple results use {@link ToolArity} instead.
@@ -39,10 +39,6 @@ public enum ToolFormat {
JAVASCRIPT("js", "jsx"),
EBOOK("epub", "mobi", "azw3", "fb2", "txt", "docx"),
EMAIL("eml", "msg"),
- POSTSCRIPT("ps", "eps"),
-
- PCL("pcl", "pxl"),
- XPS("xps", "oxps"),
VIDEO("mp4", "webm", "avi", "mov", "mkv"),
CBZ("cbz"),
diff --git a/app/common/src/test/java/stirling/software/common/service/InternalApiClientTest.java b/app/common/src/test/java/stirling/software/common/service/InternalApiClientTest.java
index 6bb98d0268..77b82f0eff 100644
--- a/app/common/src/test/java/stirling/software/common/service/InternalApiClientTest.java
+++ b/app/common/src/test/java/stirling/software/common/service/InternalApiClientTest.java
@@ -362,7 +362,7 @@ class InternalApiClientTest {
InternalApiClient mockedClient = newClient();
assertThrows(
UncheckedIOException.class,
- () -> mockedClient.post("/api/v1/convert/vector/pdf", body));
+ () -> mockedClient.post("/api/v1/convert/pdf/word", body));
verify(tempFile).close();
} finally {
diff --git a/app/core/src/main/java/stirling/software/SPDF/controller/api/MergeController.java b/app/core/src/main/java/stirling/software/SPDF/controller/api/MergeController.java
index b945085b7c..346366bd38 100644
--- a/app/core/src/main/java/stirling/software/SPDF/controller/api/MergeController.java
+++ b/app/core/src/main/java/stirling/software/SPDF/controller/api/MergeController.java
@@ -233,7 +233,7 @@ public class MergeController {
@StandardPdfResponse
@ToolIO(
accepts = {ToolFormat.PDF, ToolFormat.IMAGE},
- // The installed ImageIO readers cover these; ToolFormat.IMAGE's ai/eps have none.
+ // The installed ImageIO readers cover these; ToolFormat.IMAGE's ai has none.
inputExtensions = {
"pdf", "png", "jpg", "jpeg", "gif", "bmp", "tif", "tiff", "webp", "svg", "psd"
},
diff --git a/app/core/src/main/java/stirling/software/SPDF/controller/api/converters/PdfVectorExportController.java b/app/core/src/main/java/stirling/software/SPDF/controller/api/converters/PdfVectorExportController.java
deleted file mode 100644
index 36372fee83..0000000000
--- a/app/core/src/main/java/stirling/software/SPDF/controller/api/converters/PdfVectorExportController.java
+++ /dev/null
@@ -1,279 +0,0 @@
-package stirling.software.SPDF.controller.api.converters;
-
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.StandardCopyOption;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Locale;
-import java.util.Set;
-
-import org.apache.commons.io.FilenameUtils;
-import org.springframework.core.io.Resource;
-import org.springframework.http.MediaType;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.ModelAttribute;
-
-import io.swagger.v3.oas.annotations.Operation;
-
-import jakarta.validation.Valid;
-
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-
-import stirling.software.SPDF.config.EndpointConfiguration;
-import stirling.software.SPDF.model.api.converters.PdfVectorExportRequest;
-import stirling.software.common.annotations.AutoJobPostMapping;
-import stirling.software.common.annotations.api.ConvertApi;
-import stirling.software.common.enumeration.ResourceWeight;
-import stirling.software.common.model.tool.ToolArity;
-import stirling.software.common.model.tool.ToolFormat;
-import stirling.software.common.model.tool.ToolIO;
-import stirling.software.common.model.tool.ToolIOCase;
-import stirling.software.common.model.tool.ToolIOWhen;
-import stirling.software.common.util.ExceptionUtils;
-import stirling.software.common.util.GeneralUtils;
-import stirling.software.common.util.ProcessExecutor;
-import stirling.software.common.util.ProcessExecutor.ProcessExecutorResult;
-import stirling.software.common.util.TempFile;
-import stirling.software.common.util.TempFileManager;
-import stirling.software.common.util.WebResponseUtils;
-
-@ConvertApi
-@Slf4j
-@RequiredArgsConstructor
-public class PdfVectorExportController {
-
- private static final Set<String> GHOSTSCRIPT_INPUTS =
- Set.of("ps", "eps", "epsf"); // PCL/PXL/XPS require GhostPDL (gpcl6/gxps)
-
- private final TempFileManager tempFileManager;
- private final EndpointConfiguration endpointConfiguration;
-
- @AutoJobPostMapping(
- consumes = MediaType.MULTIPART_FORM_DATA_VALUE,
- value = "/vector/pdf",
- resourceWeight = ResourceWeight.MEDIUM_WEIGHT)
- @ToolIO(accepts = ToolFormat.POSTSCRIPT, produces = ToolFormat.PDF)
- @Operation(
- summary = "Convert PostScript (PS, EPS) to PDF",
- description =
- "Converts PS, EPS and EPSF with Ghostscript; outputFormat is ignored."
- + " XPS and PCL are not supported.")
- public ResponseEntity<Resource> convertGhostscriptInputsToPdf(
- @Valid @ModelAttribute PdfVectorExportRequest request) throws Exception {
-
- String originalName =
- request.getFileInput() != null
- ? request.getFileInput().getOriginalFilename()
- : null;
- String extension =
- originalName != null
- ? FilenameUtils.getExtension(originalName).toLowerCase(Locale.ROOT)
- : "";
-
- TempFile outputTemp = tempFileManager.createManagedTempFile(".pdf");
- try (TempFile inputTemp =
- new TempFile(tempFileManager, extension.isEmpty() ? "" : "." + extension)) {
-
- request.getFileInput().transferTo(inputTemp.getFile());
-
- if (GHOSTSCRIPT_INPUTS.contains(extension)) {
- boolean prepress = request.getPrepress() != null && request.getPrepress();
- runGhostscriptToPdf(inputTemp.getPath(), outputTemp.getPath(), prepress);
- } else if ("pdf".equals(extension)) {
- Files.copy(
- inputTemp.getPath(),
- outputTemp.getPath(),
- StandardCopyOption.REPLACE_EXISTING);
- } else {
- throw ExceptionUtils.createIllegalArgumentException(
- "error.invalidFormat",
- "Unsupported Ghostscript input format {0}",
- extension);
- }
- } catch (Exception e) {
- outputTemp.close();
- throw e;
- }
-
- String outputName = GeneralUtils.generateFilename(originalName, ".pdf");
- return WebResponseUtils.pdfFileToWebResponse(outputTemp, outputName);
- }
-
- @AutoJobPostMapping(
- consumes = MediaType.MULTIPART_FORM_DATA_VALUE,
- value = "/pdf/vector",
- resourceWeight = ResourceWeight.MEDIUM_WEIGHT)
- // One case per non-default value of outputFormat; the base covers the default, eps.
- @ToolIO(
- produces = ToolFormat.IMAGE,
- cases = {
- @ToolIOCase(
- when = @ToolIOWhen(param = "outputFormat", matches = "ps"),
- produces = ToolFormat.POSTSCRIPT,
- arity = ToolArity.SISO),
- @ToolIOCase(
- when = @ToolIOWhen(param = "outputFormat", matches = "pcl"),
- produces = ToolFormat.PCL,
- arity = ToolArity.SISO),
- @ToolIOCase(
- when = @ToolIOWhen(param = "outputFormat", matches = "xps"),
- produces = ToolFormat.XPS,
- arity = ToolArity.SISO)
- })
- @Operation(
- summary = "Convert PDF to vector format",
- description = "Converts PDF to Ghostscript vector formats (EPS, PS, PCL, or XPS).")
- public ResponseEntity<Resource> convertPdfToVector(
- @Valid @ModelAttribute PdfVectorExportRequest request) throws Exception {
-
- String originalName =
- request.getFileInput() != null
- ? request.getFileInput().getOriginalFilename()
- : null;
-
- String outputFormat = request.getOutputFormat();
- if (outputFormat == null || outputFormat.isEmpty()) {
- outputFormat = "eps";
- }
- outputFormat = outputFormat.toLowerCase(Locale.ROOT);
-
- TempFile outputTemp = tempFileManager.createManagedTempFile("." + outputFormat);
- try (TempFile inputTemp = new TempFile(tempFileManager, ".pdf")) {
-
- request.getFileInput().transferTo(inputTemp.getFile());
-
- runGhostscriptPdfToVector(inputTemp.getPath(), outputTemp.getPath(), outputFormat);
- } catch (Exception e) {
- outputTemp.close();
- throw e;
- }
-
- String outputName = GeneralUtils.generateFilename(originalName, "." + outputFormat);
-
- MediaType mediaType;
- switch (outputFormat.toLowerCase(Locale.ROOT)) {
- case "eps":
- case "ps":
- mediaType = MediaType.parseMediaType("application/postscript");
- break;
- case "pcl":
- mediaType = MediaType.parseMediaType("application/vnd.hp-PCL");
- break;
- case "xps":
- mediaType = MediaType.parseMediaType("application/vnd.ms-xpsdocument");
- break;
- default:
- mediaType = MediaType.APPLICATION_OCTET_STREAM;
- }
-
- return WebResponseUtils.fileToWebResponse(outputTemp, outputName, mediaType);
- }
-
- private void runGhostscriptPdfToVector(Path inputPath, Path outputPath, String outputFormat)
- throws IOException, InterruptedException {
- if (!endpointConfiguration.isGroupEnabled("Ghostscript")) {
- throw ExceptionUtils.createGhostscriptConversionException(outputFormat);
- }
-
- List<String> command = new ArrayList<>();
- command.add("gs");
-
- // Set device based on output format
- String device =
- switch (outputFormat.toLowerCase(Locale.ROOT)) {
- case "eps" -> "eps2write";
- case "ps" -> "ps2write";
- case "pcl" -> "pxlcolor"; // PCL XL color
- case "xps" -> "xpswrite";
- default ->
- throw ExceptionUtils.createIllegalArgumentException(
- "error.invalidFormat",
- "Unsupported output format: {0}",
- outputFormat);
- };
-
- command.add("-sDEVICE=" + device);
- command.add("-dNOPAUSE");
- command.add("-dBATCH");
- command.add("-dSAFER");
- command.add("-sOutputFile=" + outputPath.toAbsolutePath());
- command.add(inputPath.toAbsolutePath().toString());
-
- log.debug("Executing Ghostscript command: {}", String.join(" ", command));
-
- ProcessExecutorResult result =
- ProcessExecutor.getInstance(ProcessExecutor.Processes.GHOSTSCRIPT)
- .runCommandWithOutputHandling(command);
-
- ExceptionUtils.GhostscriptException criticalError =
- ExceptionUtils.detectGhostscriptCriticalError(result.getMessages());
- if (criticalError != null) {
- log.error(
- "Ghostscript PDF to {} conversion detected critical error: {}. Command: {}",
- outputFormat.toUpperCase(),
- criticalError.getMessage(),
- String.join(" ", command));
- throw criticalError;
- }
-
- if (result.getRc() != 0) {
- log.error(
- "Ghostscript PDF to {} conversion failed with rc={} and messages={}. Command: {}",
- outputFormat.toUpperCase(),
- result.getRc(),
- result.getMessages(),
- String.join(" ", command));
- throw ExceptionUtils.createGhostscriptConversionException(outputFormat);
- }
- }
-
- private void runGhostscriptToPdf(Path inputPath, Path outputPath, boolean prepress)
- throws IOException, InterruptedException {
- if (!endpointConfiguration.isGroupEnabled("Ghostscript")) {
- throw ExceptionUtils.createGhostscriptConversionException("pdfwrite");
- }
-
- List<String> command = new ArrayList<>();
- command.add("gs");
- command.add("-sDEVICE=pdfwrite");
- command.add("-dNOPAUSE");
- command.add("-dBATCH");
- command.add("-dSAFER");
- command.add("-dCompatibilityLevel=1.4");
-
- if (prepress) {
- command.add("-dPDFSETTINGS=/prepress");
- }
-
- command.add("-sOutputFile=" + outputPath.toAbsolutePath());
- command.add(inputPath.toAbsolutePath().toString());
-
- log.debug("Executing Ghostscript PostScript-to-PDF command: {}", String.join(" ", command));
-
- ProcessExecutorResult result =
- ProcessExecutor.getInstance(ProcessExecutor.Processes.GHOSTSCRIPT)
- .runCommandWithOutputHandling(command);
-
- ExceptionUtils.GhostscriptException criticalError =
- ExceptionUtils.detectGhostscriptCriticalError(result.getMessages());
- if (criticalError != null) {
- log.error(
- "Ghostscript PostScript-to-PDF conversion detected critical error: {}. Command: {}",
- criticalError.getMessage(),
- String.join(" ", command));
- throw criticalError;
- }
-
- if (result.getRc() != 0) {
- log.error(
- "Ghostscript PostScript-to-PDF conversion failed with rc={} and messages={}. Command: {}",
- result.getRc(),
- result.getMessages(),
- String.join(" ", command));
- throw ExceptionUtils.createGhostscriptConversionException("pdfwrite");
- }
- }
-}
diff --git a/app/core/src/main/java/stirling/software/SPDF/model/api/converters/PdfVectorExportRequest.java b/app/core/src/main/java/stirling/software/SPDF/model/api/converters/PdfVectorExportRequest.java
deleted file mode 100644
index 97c79bd021..0000000000
--- a/app/core/src/main/java/stirling/software/SPDF/model/api/converters/PdfVectorExportRequest.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package stirling.software.SPDF.model.api.converters;
-
-import io.swagger.v3.oas.annotations.media.Schema;
-
-import jakarta.validation.constraints.Pattern;
-
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-import stirling.software.common.model.api.PDFFile;
-
-@Data
-@EqualsAndHashCode(callSuper = true)
-public class PdfVectorExportRequest extends PDFFile {
-
- @Schema(
- description = "Target vector format extension",
- allowableValues = {"eps", "ps", "pcl", "xps"},
- defaultValue = "eps")
- @Pattern(regexp = "(?i)(eps|ps|pcl|xps)")
- private String outputFormat = "eps";
-
- @Schema(
- description = "Apply Ghostscript prepress settings",
- requiredMode = Schema.RequiredMode.REQUIRED,
- allowableValues = {"true", "false"},
- defaultValue = "false")
- private Boolean prepress = false;
-}
diff --git a/app/core/src/test/java/stirling/software/SPDF/config/ToolIODeclarationCoverageTest.java b/app/core/src/test/java/stirling/software/SPDF/config/ToolIODeclarationCoverageTest.java
index 5cbdf3b8eb..e3bd918268 100644
--- a/app/core/src/test/java/stirling/software/SPDF/config/ToolIODeclarationCoverageTest.java
+++ b/app/core/src/test/java/stirling/software/SPDF/config/ToolIODeclarationCoverageTest.java
@@ -222,33 +222,6 @@ class ToolIODeclarationCoverageTest {
assertTrue(spec("/api/v1/convert/markdown/pdf").acceptsFormat(ToolFormat.MARKDOWN));
}
- @Test
- void vectorExportDeclaresEveryOutputFormat() {
- // Every value the request permits must resolve to what it actually emits. "eps" is the
- // default and is an image extension; the other three are not, and would otherwise fall
- // through to IMAGE and pass a chain that fails at run time.
- ToolIOSpec spec = spec("/api/v1/convert/pdf/vector");
- assertEquals(ToolFormat.IMAGE, spec.resolveOutput(Map.of("outputFormat", "eps")).format());
- assertEquals(
- ToolFormat.POSTSCRIPT, spec.resolveOutput(Map.of("outputFormat", "ps")).format());
- assertEquals(ToolFormat.PCL, spec.resolveOutput(Map.of("outputFormat", "pcl")).format());
- assertEquals(ToolFormat.XPS, spec.resolveOutput(Map.of("outputFormat", "xps")).format());
- // The request pattern accepts any casing, so the declaration must too.
- assertEquals(
- ToolFormat.POSTSCRIPT, spec.resolveOutput(Map.of("outputFormat", "PS")).format());
- }
-
- @Test
- void everyVectorOutputFormatHasACase() {
- // Guards the list above against a new allowableValue being added without a declaration.
- Set<String> declared =
- spec("/api/v1/convert/pdf/vector").cases().stream()
- .flatMap(rule -> rule.when().stream())
- .flatMap(when -> when.matches().stream())
- .collect(java.util.stream.Collectors.toSet());
- assertEquals(Set.of("ps", "pcl", "xps"), declared);
- }
-
@Test
void anAbsentParameterResolvesToItsRequestModelDefault() {
// A pipeline step often omits a parameter a case branches on. The default is read from the
diff --git a/app/core/src/test/java/stirling/software/SPDF/controller/api/converters/PdfVectorExportControllerMoreTest.java b/app/core/src/test/java/stirling/software/SPDF/controller/api/converters/PdfVectorExportControllerMoreTest.java
deleted file mode 100644
index 7bcd853821..0000000000
--- a/app/core/src/test/java/stirling/software/SPDF/controller/api/converters/PdfVectorExportControllerMoreTest.java
+++ /dev/null
@@ -1,261 +0,0 @@
-package stirling.software.SPDF.controller.api.converters;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.jupiter.api.Assertions.assertThrows;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.anyString;
-import static org.mockito.Mockito.lenient;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.reset;
-import static org.mockito.Mockito.when;
-
-import java.lang.reflect.Field;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.DisplayName;
-import org.junit.jupiter.api.Nested;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.junit.jupiter.MockitoExtension;
-import org.springframework.core.io.Resource;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.MediaType;
-import org.springframework.http.ResponseEntity;
-import org.springframework.mock.web.MockMultipartFile;
-
-import stirling.software.SPDF.config.EndpointConfiguration;
-import stirling.software.SPDF.model.api.converters.PdfVectorExportRequest;
-import stirling.software.common.model.ApplicationProperties;
-import stirling.software.common.util.ProcessExecutor;
-import stirling.software.common.util.ProcessExecutor.ProcessExecutorResult;
-import stirling.software.common.util.TempFileManager;
-import stirling.software.common.util.TempFileRegistry;
-
-/**
- * Gap coverage for {@link PdfVectorExportController#convertPdfToVector} and the Ghostscript
- * PDF-to-vector helper, complementing PdfVectorExportControllerTest (which only covers the
- * PostScript-to-PDF endpoint).
- */
-@ExtendWith(MockitoExtension.class)
-@DisplayName("PdfVectorExportController convertPdfToVector")
-class PdfVectorExportControllerMoreTest {
-
- private final List<Path> tempPaths = new ArrayList<>();
-
- @Mock private TempFileManager tempFileManager;
- @Mock private EndpointConfiguration endpointConfiguration;
- @Mock private ProcessExecutor ghostscriptExecutor;
- @InjectMocks private PdfVectorExportController controller;
-
- // Real manager used only to mint genuine TempFile instances for the mock to hand back.
- private final TempFileManager realTempFileManager =
- new TempFileManager(new TempFileRegistry(), new ApplicationProperties());
-
- private Map<ProcessExecutor.Processes, ProcessExecutor> originalExecutors;
-
- @BeforeEach
- void setup() throws Exception {
- // Return a real TempFile so no Mockito when() runs re-entrantly inside the thenAnswer.
- lenient()
- .when(tempFileManager.createManagedTempFile(anyString()))
- .thenAnswer(inv -> realTempFileManager.createManagedTempFile(inv.getArgument(0)));
- lenient()
- .when(tempFileManager.createTempFile(any()))
- .thenAnswer(
- invocation -> {
- String suffix = invocation.<String>getArgument(0);
- Path path =
- Files.createTempFile("vec_in", suffix == null ? "" : suffix);
- tempPaths.add(path);
- return path.toFile();
- });
-
- Field instancesField = ProcessExecutor.class.getDeclaredField("instances");
- instancesField.setAccessible(true);
- @SuppressWarnings("unchecked")
- Map<ProcessExecutor.Processes, ProcessExecutor> instances =
- (Map<ProcessExecutor.Processes, ProcessExecutor>) instancesField.get(null);
- originalExecutors = Map.copyOf(instances);
- instances.clear();
- instances.put(ProcessExecutor.Processes.GHOSTSCRIPT, ghostscriptExecutor);
- }
-
- @AfterEach
- void tearDown() throws Exception {
- Field instancesField = ProcessExecutor.class.getDeclaredField("instances");
- instancesField.setAccessible(true);
- @SuppressWarnings("unchecked")
- Map<ProcessExecutor.Processes, ProcessExecutor> instances =
- (Map<ProcessExecutor.Processes, ProcessExecutor>) instancesField.get(null);
- instances.clear();
- if (originalExecutors != null) {
- instances.putAll(originalExecutors);
- }
- reset(ghostscriptExecutor, tempFileManager, endpointConfiguration);
- for (Path path : tempPaths) {
- Files.deleteIfExists(path);
- }
- tempPaths.clear();
- }
-
- private ProcessExecutorResult okResult() {
- ProcessExecutorResult result = mock(ProcessExecutorResult.class);
- lenient().when(result.getRc()).thenReturn(0);
- lenient().when(result.getMessages()).thenReturn("");
- return result;
- }
-
- private static PdfVectorExportRequest request(String outputFormat) {
- MockMultipartFile file =
- new MockMultipartFile(
- "fileInput", "in.pdf", MediaType.APPLICATION_PDF_VALUE, new byte[] {1});
- PdfVectorExportRequest request = new PdfVectorExportRequest();
- request.setFileInput(file);
- request.setOutputFormat(outputFormat);
- return request;
- }
-
- @Nested
- @DisplayName("media types per output format")
- class MediaTypes {
-
- @Test
- @DisplayName("eps output yields application/postscript")
- void epsContentType() throws Exception {
- when(endpointConfiguration.isGroupEnabled("Ghostscript")).thenReturn(true);
- ProcessExecutorResult ok = okResult();
- when(ghostscriptExecutor.runCommandWithOutputHandling(any())).thenReturn(ok);
-
- ResponseEntity<Resource> response = controller.convertPdfToVector(request("eps"));
-
- assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK);
- assertThat(response.getHeaders().getContentType())
- .isEqualTo(MediaType.parseMediaType("application/postscript"));
- }
-
- @Test
- @DisplayName("ps output yields application/postscript")
- void psContentType() throws Exception {
- when(endpointConfiguration.isGroupEnabled("Ghostscript")).thenReturn(true);
- ProcessExecutorResult ok = okResult();
- when(ghostscriptExecutor.runCommandWithOutputHandling(any())).thenReturn(ok);
-
- ResponseEntity<Resource> response = controller.convertPdfToVector(request("ps"));
-
- assertThat(response.getHeaders().getContentType())
- .isEqualTo(MediaType.parseMediaType("application/postscript"));
- }
-
- @Test
- @DisplayName("pcl output yields the HP-PCL media type")
- void pclContentType() throws Exception {
- when(endpointConfiguration.isGroupEnabled("Ghostscript")).thenReturn(true);
- ProcessExecutorResult ok = okResult();
- when(ghostscriptExecutor.runCommandWithOutputHandling(any())).thenReturn(ok);
-
- ResponseEntity<Resource> response = controller.convertPdfToVector(request("pcl"));
-
- assertThat(response.getHeaders().getContentType())
- .isEqualTo(MediaType.parseMediaType("application/vnd.hp-PCL"));
- }
-
- @Test
- @DisplayName("xps output yields the MS XPS media type")
- void xpsContentType() throws Exception {
- when(endpointConfiguration.isGroupEnabled("Ghostscript")).thenReturn(true);
- ProcessExecutorResult ok = okResult();
- when(ghostscriptExecutor.runCommandWithOutputHandling(any())).thenReturn(ok);
-
- ResponseEntity<Resource> response = controller.convertPdfToVector(request("xps"));
-
- assertThat(response.getHeaders().getContentType())
- .isEqualTo(MediaType.parseMediaType("application/vnd.ms-xpsdocument"));
- }
-
- @Test
- @DisplayName("null output format defaults to eps")
- void nullOutputFormatDefaultsToEps() throws Exception {
- when(endpointConfiguration.isGroupEnabled("Ghostscript")).thenReturn(true);
- ProcessExecutorResult ok = okResult();
- when(ghostscriptExecutor.runCommandWithOutputHandling(any())).thenReturn(ok);
-
- ResponseEntity<Resource> response = controller.convertPdfToVector(request(null));
-
- assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK);
- assertThat(response.getHeaders().getContentType())
- .isEqualTo(MediaType.parseMediaType("application/postscript"));
- }
-
- @Test
- @DisplayName("uppercase output format is normalized to lowercase")
- void uppercaseFormatNormalized() throws Exception {
- when(endpointConfiguration.isGroupEnabled("Ghostscript")).thenReturn(true);
- ProcessExecutorResult ok = okResult();
- when(ghostscriptExecutor.runCommandWithOutputHandling(any())).thenReturn(ok);
-
- ResponseEntity<Resource> response = controller.convertPdfToVector(request("EPS"));
-
- assertThat(response.getHeaders().getContentType())
- .isEqualTo(MediaType.parseMediaType("application/postscript"));
- }
- }
-
- @Nested
- @DisplayName("failure paths")
- class Failures {
-
- @Test
- @DisplayName("disabled Ghostscript group throws a conversion exception")
- void ghostscriptDisabledThrows() {
- when(endpointConfiguration.isGroupEnabled("Ghostscript")).thenReturn(false);
-
- assertThrows(Exception.class, () -> controller.convertPdfToVector(request("eps")));
- }
-
- @Test
- @DisplayName("non-zero Ghostscript return code throws a conversion exception")
- void nonZeroReturnCodeThrows() {
- when(endpointConfiguration.isGroupEnabled("Ghostscript")).thenReturn(true);
- ProcessExecutorResult bad = mock(ProcessExecutorResult.class);
- lenient().when(bad.getRc()).thenReturn(1);
- lenient().when(bad.getMessages()).thenReturn("some non-critical failure");
- try {
- when(ghostscriptExecutor.runCommandWithOutputHandling(any())).thenReturn(bad);
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
-
- assertThrows(Exception.class, () -> controller.convertPdfToVector(request("eps")));
- }
-
- @Test
- @DisplayName("an unsupported output format is rejected before any device mapping")
- void unsupportedFormatThrows() {
- // "svg" is not in the validated set and falls through to the device-switch default.
- when(endpointConfiguration.isGroupEnabled("Ghostscript")).thenReturn(true);
-
- assertThrows(Exception.class, () -> controller.convertPdfToVector(request("svg")));
- }
- }
-
- @Test
- @DisplayName("Ghostscript runs the configured command for a successful conversion")
- void runsGhostscriptCommand() throws Exception {
- when(endpointConfiguration.isGroupEnabled("Ghostscript")).thenReturn(true);
- ProcessExecutorResult ok = okResult();
- when(ghostscriptExecutor.runCommandWithOutputHandling(any())).thenReturn(ok);
-
- ResponseEntity<Resource> response = controller.convertPdfToVector(request("eps"));
-
- assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK);
- org.mockito.Mockito.verify(ghostscriptExecutor).runCommandWithOutputHandling(any());
- }
-}
diff --git a/app/core/src/test/java/stirling/software/SPDF/controller/api/converters/PdfVectorExportControllerTest.java b/app/core/src/test/java/stirling/software/SPDF/controller/api/converters/PdfVectorExportControllerTest.java
deleted file mode 100644
index af43dd10a4..0000000000
--- a/app/core/src/test/java/stirling/software/SPDF/controller/api/converters/PdfVectorExportControllerTest.java
+++ /dev/null
@@ -1,166 +0,0 @@
-package stirling.software.SPDF.controller.api.converters;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.jupiter.api.Assertions.assertThrows;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.anyString;
-import static org.mockito.Mockito.lenient;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.reset;
-import static org.mockito.Mockito.when;
-
-import java.io.File;
-import java.lang.reflect.Field;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.junit.jupiter.MockitoExtension;
-import org.springframework.core.io.Resource;
-import org.springframework.http.MediaType;
-import org.springframework.http.ResponseEntity;
-import org.springframework.mock.web.MockMultipartFile;
-
-import stirling.software.SPDF.config.EndpointConfiguration;
-import stirling.software.SPDF.model.api.converters.PdfVectorExportRequest;
-import stirling.software.common.util.ProcessExecutor;
-import stirling.software.common.util.ProcessExecutor.ProcessExecutorResult;
-import stirling.software.common.util.TempFile;
-import stirling.software.common.util.TempFileManager;
-
-@ExtendWith(MockitoExtension.class)
-class PdfVectorExportControllerTest {
-
- private final List<Path> tempPaths = new ArrayList<>();
- @Mock private TempFileManager tempFileManager;
- @Mock private EndpointConfiguration endpointConfiguration;
- @Mock private ProcessExecutor ghostscriptExecutor;
- @InjectMocks private PdfVectorExportController controller;
- private Map<ProcessExecutor.Processes, ProcessExecutor> originalExecutors;
-
- @BeforeEach
- void setup() throws Exception {
- lenient()
- .when(tempFileManager.createManagedTempFile(anyString()))
- .thenAnswer(
- inv -> {
- File f =
- Files.createTempFile("test", inv.<String>getArgument(0))
- .toFile();
- TempFile tf = mock(TempFile.class);
- lenient().when(tf.getFile()).thenReturn(f);
- lenient().when(tf.getPath()).thenReturn(f.toPath());
- return tf;
- });
- when(tempFileManager.createTempFile(any()))
- .thenAnswer(
- invocation -> {
- String suffix = invocation.<String>getArgument(0);
- Path path =
- Files.createTempFile(
- "vector_test", suffix == null ? "" : suffix);
- tempPaths.add(path);
- return path.toFile();
- });
-
- Field instancesField = ProcessExecutor.class.getDeclaredField("instances");
- instancesField.setAccessible(true);
- @SuppressWarnings("unchecked")
- Map<ProcessExecutor.Processes, ProcessExecutor> instances =
- (Map<ProcessExecutor.Processes, ProcessExecutor>) instancesField.get(null);
-
- originalExecutors = Map.copyOf(instances);
- instances.clear();
- instances.put(ProcessExecutor.Processes.GHOSTSCRIPT, ghostscriptExecutor);
- }
-
- @AfterEach
- void tearDown() throws Exception {
- Field instancesField = ProcessExecutor.class.getDeclaredField("instances");
- instancesField.setAccessible(true);
- @SuppressWarnings("unchecked")
- Map<ProcessExecutor.Processes, ProcessExecutor> instances =
- (Map<ProcessExecutor.Processes, ProcessExecutor>) instancesField.get(null);
- instances.clear();
- if (originalExecutors != null) {
- instances.putAll(originalExecutors);
- }
- reset(ghostscriptExecutor, tempFileManager, endpointConfiguration);
- for (Path path : tempPaths) {
- Files.deleteIfExists(path);
- }
- tempPaths.clear();
- }
-
- private ProcessExecutorResult mockResult(int rc) {
- ProcessExecutorResult result = mock(ProcessExecutorResult.class);
- lenient().when(result.getRc()).thenReturn(rc);
- lenient().when(result.getMessages()).thenReturn("");
- return result;
- }
-
- @Test
- void convertGhostscript_psToPdf_success() throws Exception {
- when(endpointConfiguration.isGroupEnabled("Ghostscript")).thenReturn(true);
- ProcessExecutorResult result = mockResult(0);
- when(ghostscriptExecutor.runCommandWithOutputHandling(any())).thenReturn(result);
-
- MockMultipartFile file =
- new MockMultipartFile(
- "fileInput",
- "sample.ps",
- MediaType.APPLICATION_OCTET_STREAM_VALUE,
- new byte[] {1});
- PdfVectorExportRequest request = new PdfVectorExportRequest();
- request.setFileInput(file);
-
- ResponseEntity<Resource> response = controller.convertGhostscriptInputsToPdf(request);
-
- assertThat(response.getStatusCode()).isEqualTo(org.springframework.http.HttpStatus.OK);
- assertThat(response.getHeaders().getContentType()).isEqualTo(MediaType.APPLICATION_PDF);
- }
-
- @Test
- void convertGhostscript_pdfPassThrough_success() throws Exception {
- when(endpointConfiguration.isGroupEnabled("Ghostscript")).thenReturn(false);
-
- byte[] content = {1};
- MockMultipartFile file =
- new MockMultipartFile(
- "fileInput", "input.pdf", MediaType.APPLICATION_PDF_VALUE, content);
- PdfVectorExportRequest request = new PdfVectorExportRequest();
- request.setFileInput(file);
-
- ResponseEntity<Resource> response = controller.convertGhostscriptInputsToPdf(request);
-
- assertThat(response.getStatusCode()).isEqualTo(org.springframework.http.HttpStatus.OK);
- assertThat(response.getHeaders().getContentType()).isEqualTo(MediaType.APPLICATION_PDF);
- java.io.ByteArrayOutputStream baosVerify = new java.io.ByteArrayOutputStream();
- try (java.io.InputStream __in = response.getBody().getInputStream()) {
- __in.transferTo(baosVerify);
- }
- assertThat(baosVerify.toByteArray()).contains(content);
- }
-
- @Test
- void convertGhostscript_unsupportedFormatThrows() {
- when(endpointConfiguration.isGroupEnabled("Ghostscript")).thenReturn(false);
- MockMultipartFile file =
- new MockMultipartFile(
- "fileInput", "vector.svg", MediaType.APPLICATION_XML_VALUE, new byte[] {1});
- PdfVectorExportRequest request = new PdfVectorExportRequest();
- request.setFileInput(file);
-
- assertThrows(
- IllegalArgumentException.class,
- () -> controller.convertGhostscriptInputsToPdf(request));
- }
-}
diff --git a/app/core/src/test/java/stirling/software/SPDF/model/api/converters/PdfVectorExportRequestTest.java b/app/core/src/test/java/stirling/software/SPDF/model/api/converters/PdfVectorExportRequestTest.java
deleted file mode 100644
index 0dbdaf99e9..0000000000
--- a/app/core/src/test/java/stirling/software/SPDF/model/api/converters/PdfVectorExportRequestTest.java
+++ /dev/null
@@ -1,84 +0,0 @@
-package stirling.software.SPDF.model.api.converters;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-import org.junit.jupiter.api.DisplayName;
-import org.junit.jupiter.api.Nested;
-import org.junit.jupiter.api.Test;
-
-@DisplayName("PdfVectorExportRequest")
-class PdfVectorExportRequestTest {
-
- @Nested
- @DisplayName("defaults")
- class Defaults {
-
- @Test
- @DisplayName("outputFormat defaults to eps and prepress to false")
- void defaultValues() {
- PdfVectorExportRequest req = new PdfVectorExportRequest();
-
- assertThat(req.getOutputFormat()).isEqualTo("eps");
- assertThat(req.getPrepress()).isFalse();
- }
- }
-
- @Nested
- @DisplayName("accessors")
- class Accessors {
-
- @Test
- @DisplayName("setters round trip every field")
- void setters() {
- PdfVectorExportRequest req = new PdfVectorExportRequest();
- req.setOutputFormat("xps");
- req.setPrepress(Boolean.TRUE);
-
- assertThat(req.getOutputFormat()).isEqualTo("xps");
- assertThat(req.getPrepress()).isTrue();
- }
- }
-
- @Nested
- @DisplayName("equals/hashCode/toString")
- class Equality {
-
- @Test
- @DisplayName("fresh instances are equal despite callSuper")
- void equalInstances() {
- PdfVectorExportRequest a = new PdfVectorExportRequest();
- PdfVectorExportRequest b = new PdfVectorExportRequest();
-
- assertThat(a).isEqualTo(b).hasSameHashCodeAs(b);
- }
-
- @Test
- @DisplayName("differing outputFormat breaks equality")
- void notEqualFormat() {
- PdfVectorExportRequest a = new PdfVectorExportRequest();
- PdfVectorExportRequest b = new PdfVectorExportRequest();
- b.setOutputFormat("ps");
-
- assertThat(a).isNotEqualTo(b).isNotEqualTo(null).isNotEqualTo("string");
- }
-
- @Test
- @DisplayName("differing prepress breaks equality")
- void notEqualPrepress() {
- PdfVectorExportRequest a = new PdfVectorExportRequest();
- PdfVectorExportRequest b = new PdfVectorExportRequest();
- b.setPrepress(Boolean.TRUE);
-
- assertThat(a).isNotEqualTo(b);
- }
-
- @Test
- @DisplayName("toString contains a representative field value")
- void toStringContent() {
- PdfVectorExportRequest req = new PdfVectorExportRequest();
- req.setOutputFormat("pcl");
-
- assertThat(req.toString()).isNotNull().contains("outputFormat=pcl");
- }
- }
-}
diff --git a/engine/src/stirling/models/tool_io.py b/engine/src/stirling/models/tool_io.py
index 583a47bbf9..2228849410 100644
--- a/engine/src/stirling/models/tool_io.py
+++ b/engine/src/stirling/models/tool_io.py
@@ -33,9 +33,6 @@ class ToolFormat(StrEnum):
JAVASCRIPT = "JAVASCRIPT"
EBOOK = "EBOOK"
EMAIL = "EMAIL"
- POSTSCRIPT = "POSTSCRIPT"
- PCL = "PCL"
- XPS = "XPS"
VIDEO = "VIDEO"
CBZ = "CBZ"
CBR = "CBR"
@@ -127,28 +124,6 @@ TOOL_IO: dict[ToolEndpoint, ToolIOSpec] = {
],
),
ToolEndpoint.PDF_TO_UA: ToolIOSpec(accepts=[ToolFormat.PDF], produces=ToolFormat.PDF, arity=ToolArity.SISO),
- ToolEndpoint.PDF_TO_VECTOR: ToolIOSpec(
- accepts=[ToolFormat.PDF],
- produces=ToolFormat.IMAGE,
- arity=ToolArity.SISO,
- cases=[
- ToolIOCase(
- when=[ToolIOWhen(param="outputFormat", matches=["ps"], default="eps")],
- produces=ToolFormat.POSTSCRIPT,
- arity=ToolArity.SISO,
- ),
- ToolIOCase(
- when=[ToolIOWhen(param="outputFormat", matches=["pcl"], default="eps")],
- produces=ToolFormat.PCL,
- arity=ToolArity.SISO,
- ),
- ToolIOCase(
- when=[ToolIOWhen(param="outputFormat", matches=["xps"], default="eps")],
- produces=ToolFormat.XPS,
- arity=ToolArity.SISO,
- ),
- ],
- ),
ToolEndpoint.PDF_TO_WORD: ToolIOSpec(accepts=[ToolFormat.PDF], produces=ToolFormat.WORD, arity=ToolArity.SISO),
ToolEndpoint.PDF_TO_XLSX: ToolIOSpec(accepts=[ToolFormat.PDF], produces=ToolFormat.EXCEL, arity=ToolArity.SISO),
ToolEndpoint.PDF_TO_XML: ToolIOSpec(accepts=[ToolFormat.PDF], produces=ToolFormat.XML, arity=ToolArity.SISO),
@@ -165,9 +140,6 @@ TOOL_IO: dict[ToolEndpoint, ToolIOSpec] = {
],
),
ToolEndpoint.URL_TO_PDF: ToolIOSpec(accepts=[ToolFormat.NONE], produces=ToolFormat.PDF, arity=ToolArity.SISO),
- ToolEndpoint.VECTOR_TO_PDF: ToolIOSpec(
- accepts=[ToolFormat.POSTSCRIPT], produces=ToolFormat.PDF, arity=ToolArity.SISO
- ),
ToolEndpoint.BOOKLET_IMPOSITION: ToolIOSpec(
accepts=[ToolFormat.PDF], produces=ToolFormat.PDF, arity=ToolArity.SISO
),
diff --git a/engine/src/stirling/models/tool_models.py b/engine/src/stirling/models/tool_models.py
index 43a71de524..ba785a7b46 100644
--- a/engine/src/stirling/models/tool_models.py
+++ b/engine/src/stirling/models/tool_models.py
@@ -1197,35 +1197,6 @@ class PdfToUaParams(ApiModel):
class OutputFormat4(StrEnum):
- """
- Target vector format extension
- """
-
- eps = "eps"
- ps = "ps"
- pcl = "pcl"
- xps = "xps"
-
-
-class Prepress(Enum):
- """
- Apply Ghostscript prepress settings
- """
-
- boolean_true = True
- boolean_false = False
-
-
-class PdfToVectorParams(ApiModel):
- """
- Converts PDF to Ghostscript vector formats (EPS, PS, PCL, or XPS). Input:PDF Output:IMAGE Type:SISO
- """
-
- output_format: OutputFormat4 = Field(OutputFormat4.eps, description="Target vector format extension")
- prepress: Prepress = Field(Prepress.boolean_false, description="Apply Ghostscript prepress settings")
-
-
-class OutputFormat5(StrEnum):
"""
The output Word document format
"""
@@ -1240,7 +1211,7 @@ class PdfToWordParams(ApiModel):
This endpoint converts a given PDF file to a Word document format. Input:PDF Output:WORD Type:SISO
"""
- output_format: OutputFormat5 = Field(..., description="The output Word document format")
+ output_format: OutputFormat4 = Field(..., description="The output Word document format")
use_stirling_office_convert: bool | None = None
@@ -1815,26 +1786,6 @@ class UrlToPdfParams(ApiModel):
url_input: str = Field(..., description="The input URL to be converted to a PDF file")
-class OutputFormat6(StrEnum):
- """
- Target vector format extension
- """
-
- eps = "eps"
- ps = "ps"
- pcl = "pcl"
- xps = "xps"
-
-
-class VectorToPdfParams(ApiModel):
- """
- Converts PS, EPS and EPSF with Ghostscript; outputFormat is ignored. XPS and PCL are not supported. Input:POSTSCRIPT Output:PDF Type:SISO
- """
-
- output_format: OutputFormat6 = Field(OutputFormat6.eps, description="Target vector format extension")
- prepress: Prepress = Field(Prepress.boolean_false, description="Apply Ghostscript prepress settings")
-
-
class AutoRotatePdfParams(ApiModel):
"""
Detects each page's orientation (embedded-text direction first, Tesseract OSD for scanned pages) and sets the page rotation so the content displays upright. With dryRun=true, returns a JSON per-page report instead of the PDF. With pageRotations set (a JSON list such as [{"pageNumber":3,"rotation":90}]), applies only those clockwise turns without running detection. Input:PDF Output:PDF Type:SISO
@@ -1934,13 +1885,11 @@ class Model(
| PdfToPresentationParams
| PdfToTextParams
| PdfToUaParams
- | PdfToVectorParams
| PdfToWordParams
| PdfToXlsxParams
| PdfToXmlParams
| SvgToPdfParams
| UrlToPdfParams
- | VectorToPdfParams
| BookletImpositionParams
| CropParams
| EditTableOfContentsParams
@@ -2013,13 +1962,11 @@ class Model(
| PdfToPresentationParams
| PdfToTextParams
| PdfToUaParams
- | PdfToVectorParams
| PdfToWordParams
| PdfToXlsxParams
| PdfToXmlParams
| SvgToPdfParams
| UrlToPdfParams
- | VectorToPdfParams
| BookletImpositionParams
| CropParams
| EditTableOfContentsParams
@@ -2093,13 +2040,11 @@ type ParamToolModel = (
| PdfToPresentationParams
| PdfToTextParams
| PdfToUaParams
- | PdfToVectorParams
| PdfToWordParams
| PdfToXlsxParams
| PdfToXmlParams
| SvgToPdfParams
| UrlToPdfParams
- | VectorToPdfParams
| BookletImpositionParams
| CropParams
| EditTableOfContentsParams
@@ -2174,13 +2119,11 @@ class ToolEndpoint(StrEnum):
PDF_TO_PRESENTATION = "/api/v1/convert/pdf/presentation"
PDF_TO_TEXT = "/api/v1/convert/pdf/text"
PDF_TO_UA = "/api/v1/convert/pdf/ua"
- PDF_TO_VECTOR = "/api/v1/convert/pdf/vector"
PDF_TO_WORD = "/api/v1/convert/pdf/word"
PDF_TO_XLSX = "/api/v1/convert/pdf/xlsx"
PDF_TO_XML = "/api/v1/convert/pdf/xml"
SVG_TO_PDF = "/api/v1/convert/svg/pdf"
URL_TO_PDF = "/api/v1/convert/url/pdf"
- VECTOR_TO_PDF = "/api/v1/convert/vector/pdf"
BOOKLET_IMPOSITION = "/api/v1/general/booklet-imposition"
CROP = "/api/v1/general/crop"
EDIT_TABLE_OF_CONTENTS = "/api/v1/general/edit-table-of-contents"
@@ -2253,13 +2196,11 @@ OPERATIONS: dict[ToolEndpoint, ParamToolModelType] = {
ToolEndpoint.PDF_TO_PRESENTATION: PdfToPresentationParams,
ToolEndpoint.PDF_TO_TEXT: PdfToTextParams,
ToolEndpoint.PDF_TO_UA: PdfToUaParams,
- ToolEndpoint.PDF_TO_VECTOR: PdfToVectorParams,
ToolEndpoint.PDF_TO_WORD: PdfToWordParams,
ToolEndpoint.PDF_TO_XLSX: PdfToXlsxParams,
ToolEndpoint.PDF_TO_XML: PdfToXmlParams,
ToolEndpoint.SVG_TO_PDF: SvgToPdfParams,
ToolEndpoint.URL_TO_PDF: UrlToPdfParams,
- ToolEndpoint.VECTOR_TO_PDF: VectorToPdfParams,
ToolEndpoint.BOOKLET_IMPOSITION: BookletImpositionParams,
ToolEndpoint.CROP: CropParams,
ToolEndpoint.EDIT_TABLE_OF_CONTENTS: EditTableOfContentsParams,
diff --git a/frontend/src/editor/core/types/toolApiTypes.ts b/frontend/src/editor/core/types/toolApiTypes.ts
index 21c7cf0be9..02ffb4c51f 100644
--- a/frontend/src/editor/core/types/toolApiTypes.ts
+++ b/frontend/src/editor/core/types/toolApiTypes.ts
@@ -1026,16 +1026,6 @@ export interface PdfToWordRequest {
outputFormat: "doc" | "docx" | "odt";
useStirlingOfficeConvert?: boolean;
}
-export interface PdfVectorExportRequest {
- /**
- * Target vector format extension
- */
- outputFormat?: "eps" | "ps" | "pcl" | "xps";
- /**
- * Apply Ghostscript prepress settings
- */
- prepress?: true | false;
-}
export interface Pkcs11CertificatesRequest {
libraryPath?: string;
pin?: string;
@@ -1595,13 +1585,11 @@ export type ToolEndpoint =
| "/api/v1/convert/pdf/presentation"
| "/api/v1/convert/pdf/text"
| "/api/v1/convert/pdf/ua"
- | "/api/v1/convert/pdf/vector"
| "/api/v1/convert/pdf/word"
| "/api/v1/convert/pdf/xlsx"
| "/api/v1/convert/pdf/xml"
| "/api/v1/convert/svg/pdf"
| "/api/v1/convert/url/pdf"
- | "/api/v1/convert/vector/pdf"
| "/api/v1/docparse/ingest"
| "/api/v1/filter/filter-contains-image"
| "/api/v1/filter/filter-contains-text"
@@ -1701,13 +1689,11 @@ export interface ToolApiParams {
"/api/v1/convert/pdf/presentation": PdfToPresentationRequest;
"/api/v1/convert/pdf/text": PdfToTextOrRTFRequest;
"/api/v1/convert/pdf/ua": PdfToPdfUaRequest;
- "/api/v1/convert/pdf/vector": PdfVectorExportRequest;
"/api/v1/convert/pdf/word": PdfToWordRequest;
"/api/v1/convert/pdf/xlsx": PDFWithPageNums;
"/api/v1/convert/pdf/xml": ConvertPdfXmlRequest;
"/api/v1/convert/svg/pdf": SvgToPdfRequest;
"/api/v1/convert/url/pdf": UrlToPdfRequest;
- "/api/v1/convert/vector/pdf": PdfVectorExportRequest;
"/api/v1/docparse/ingest": IngestApiRequest;
"/api/v1/filter/filter-contains-image": PDFWithPageNums;
"/api/v1/filter/filter-contains-text": ContainsTextRequest;
@@ -1808,13 +1794,11 @@ export const TOOL_ENDPOINTS = [
"/api/v1/convert/pdf/presentation",
"/api/v1/convert/pdf/text",
"/api/v1/convert/pdf/ua",
- "/api/v1/convert/pdf/vector",
"/api/v1/convert/pdf/word",
"/api/v1/convert/pdf/xlsx",
"/api/v1/convert/pdf/xml",
"/api/v1/convert/svg/pdf",
"/api/v1/convert/url/pdf",
- "/api/v1/convert/vector/pdf",
"/api/v1/docparse/ingest",
"/api/v1/filter/filter-contains-image",
"/api/v1/filter/filter-contains-text",
diff --git a/frontend/src/editor/core/types/toolIO.ts b/frontend/src/editor/core/types/toolIO.ts
index 74e452b80e..ba9c1bce70 100644
--- a/frontend/src/editor/core/types/toolIO.ts
+++ b/frontend/src/editor/core/types/toolIO.ts
@@ -28,9 +28,6 @@ export type ToolFormat =
| "JAVASCRIPT"
| "EBOOK"
| "EMAIL"
- | "POSTSCRIPT"
- | "PCL"
- | "XPS"
| "VIDEO"
| "CBZ"
| "CBR"
@@ -55,9 +52,6 @@ export const TOOL_FORMATS = [
"JAVASCRIPT",
"EBOOK",
"EMAIL",
- "POSTSCRIPT",
- "PCL",
- "XPS",
"VIDEO",
"CBZ",
"CBR",
@@ -81,7 +75,6 @@ export const TOOL_FORMAT_EXTENSIONS = {
"svg",
"psd",
"ai",
- "eps",
],
ZIP: ["zip", "rar", "7z", "tar", "gz", "bz2", "xz", "lz", "lzma", "z"],
WORD: ["doc", "docx", "odt", "rtf"],
@@ -96,9 +89,6 @@ export const TOOL_FORMAT_EXTENSIONS = {
JAVASCRIPT: ["js", "jsx"],
EBOOK: ["epub", "mobi", "azw3", "fb2", "txt", "docx"],
EMAIL: ["eml", "msg"],
- POSTSCRIPT: ["ps", "eps"],
- PCL: ["pcl", "pxl"],
- XPS: ["xps", "oxps"],
VIDEO: ["mp4", "webm", "avi", "mov", "mkv"],
CBZ: ["cbz"],
CBR: ["cbr"],
@@ -305,28 +295,6 @@ export const TOOL_IO: ToolIOTable = {
produces: "PDF",
arity: "SISO",
},
- "/api/v1/convert/pdf/vector": {
- accepts: ["PDF"],
- produces: "IMAGE",
- arity: "SISO",
- cases: [
- {
- when: [{ param: "outputFormat", matches: ["ps"], default: "eps" }],
- produces: "POSTSCRIPT",
- arity: "SISO",
- },
- {
- when: [{ param: "outputFormat", matches: ["pcl"], default: "eps" }],
- produces: "PCL",
- arity: "SISO",
- },
- {
- when: [{ param: "outputFormat", matches: ["xps"], default: "eps" }],
- produces: "XPS",
- arity: "SISO",
- },
- ],
- },
"/api/v1/convert/pdf/word": {
accepts: ["PDF"],
produces: "WORD",
@@ -366,11 +334,6 @@ export const TOOL_IO: ToolIOTable = {
produces: "PDF",
arity: "SISO",
},
- "/api/v1/convert/vector/pdf": {
- accepts: ["POSTSCRIPT"],
- produces: "PDF",
- arity: "SISO",
- },
"/api/v1/docparse/ingest": {
accepts: ["PDF"],
produces: "PDF",
diff --git a/testing/cucumber/features/convert_new.feature b/testing/cucumber/features/convert_new.feature
index 595f6df5c1..e440d7b3c6 100644
--- a/testing/cucumber/features/convert_new.feature
+++ b/testing/cucumber/features/convert_new.feature
@@ -1,29 +1,6 @@
@convert
Feature: Convert API Validation (additional endpoints)
- @ghostscript @positive
- Scenario Outline: Convert PDF to vector format
- Given I generate a PDF file as "fileInput"
- And the pdf contains 1 pages with random text
- And the request data includes
- | parameter | value |
- | outputFormat | <format> |
- When I send the API request to the endpoint "/api/v1/convert/pdf/vector"
- Then the response status code should be 200
- And the response file should have size greater than 0
- And the response file should have extension "<extension>"
-
- @pdf-to-eps
- Examples:
- | format | extension |
- | eps | .eps |
-
- Examples:
- | format | extension |
- | ps | .ps |
- | pcl | .pcl |
- | xps | .xps |
-
@image @positive @pdf-to-cbz
Scenario: Convert PDF to CBZ with default DPI
Given I generate a PDF file as "fileInput"
diff --git a/testing/cucumber/features/convert_nightly.feature b/testing/cucumber/features/convert_nightly.feature
index f45b82f0f5..687cbe5920 100644
--- a/testing/cucumber/features/convert_nightly.feature
+++ b/testing/cucumber/features/convert_nightly.feature
@@ -22,14 +22,6 @@ Feature: Heavy conversion endpoints
Then the response status code should be 204
- @vector @negative
- Scenario: vector conversion rejects an input format Ghostscript cannot read
- Given I generate an SVG file as "fileInput"
- When I send the API request to the endpoint "/api/v1/convert/vector/pdf"
- Then the response status code should be 400
- And the response JSON error should contain "Unsupported"
-
-
@ebook @positive
Scenario: An EPUB produced by Stirling converts back to PDF
Given I generate a PDF file as "fileInput"