Skip to content

Commit

Permalink
feat(chromium): simplify EmulatedMediaType
Browse files Browse the repository at this point in the history
cherfia committed Nov 4, 2023

Verified

This commit was signed with the committer’s verified signature.
duskmoon314 Campbell He
1 parent 496e966 commit f31adf4
Showing 5 changed files with 14 additions and 11 deletions.
6 changes: 4 additions & 2 deletions src/chromium/converters/html.converter.ts
Original file line number Diff line number Diff line change
@@ -4,11 +4,13 @@ import FormData from "form-data";

import { GotenbergUtils, PdfFormat } from "../../common";
import { IConverter } from "../interfaces/converter.interface";
import { PageProperties } from "../interfaces/converter.types";
import {
EmulatedMediaType,
PageProperties,
} from "../interfaces/converter.types";
import { ConverterUtils } from "../utils/converter.utils";
import { Converter } from "./converter";
import { ChromiumRoute } from "../../main.config";
import { EmulatedMediaType } from "../../common/constants";

export class HtmlConverter extends Converter implements IConverter {
constructor() {
6 changes: 4 additions & 2 deletions src/chromium/converters/markdown.converter.ts
Original file line number Diff line number Diff line change
@@ -4,11 +4,13 @@ import FormData from "form-data";

import { GotenbergUtils, PdfFormat } from "../../common";
import { IConverter } from "../interfaces/converter.interface";
import { PageProperties } from "../interfaces/converter.types";
import {
EmulatedMediaType,
PageProperties,
} from "../interfaces/converter.types";
import { ConverterUtils } from "../utils/converter.utils";
import { Converter } from "./converter";
import { ChromiumRoute } from "../../main.config";
import { EmulatedMediaType } from "../../common/constants";

export class MarkdownConverter extends Converter implements IConverter {
constructor() {
6 changes: 4 additions & 2 deletions src/chromium/converters/url.converter.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { EmulatedMediaType } from "./../../common/constants";
import { PathLike, constants, createReadStream, promises } from "fs";

import { URL } from "url";
@@ -7,7 +6,10 @@ import FormData from "form-data";

import { GotenbergUtils, PdfFormat } from "../../common";
import { IConverter } from "../interfaces/converter.interface";
import { PageProperties } from "../interfaces/converter.types";
import {
EmulatedMediaType,
PageProperties,
} from "../interfaces/converter.types";
import { ConverterUtils } from "../utils/converter.utils";
import { Converter } from "./converter";
import { ChromiumRoute } from "../../main.config";
2 changes: 2 additions & 0 deletions src/chromium/interfaces/converter.types.ts
Original file line number Diff line number Diff line change
@@ -19,3 +19,5 @@ export type PageProperties = {
scale?: number; // The scale of the page rendering (default 1.0)
nativePageRanges?: { from: number; to: number }; // Page ranges to print
};

export type EmulatedMediaType = "screen" | "print";
5 changes: 0 additions & 5 deletions src/common/constants.ts
Original file line number Diff line number Diff line change
@@ -3,8 +3,3 @@ export enum PdfFormat {
A_2b = "PDF/A-2b",
A_3b = "PDF/A-3b",
}

export enum EmulatedMediaType {
SCREEN = "screen",
PRINT = "print",
}

0 comments on commit f31adf4

Please sign in to comment.