mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2025-11-16 01:21:16 +01:00
[V2] feat(compress): add linearize option for faster web viewing
- Added a "Linearize PDF for faster web viewing" checkbox in CompressSettings - Extended compress parameters to include `linearize` as a boolean - Updated form data to append the `linearize` parameter - Added translation strings for linearize feature in English locale Signed-off-by: Balázs Szücs <bszucs1209@gmail.com>
This commit is contained in:
parent
5c9e590856
commit
74223d69ad
@ -3324,6 +3324,9 @@
|
||||
"grayscale": {
|
||||
"label": "Apply Grayscale for Compression"
|
||||
},
|
||||
"linearize": {
|
||||
"label": "Optimize PDF for faster web viewing"
|
||||
},
|
||||
"tooltip": {
|
||||
"header": {
|
||||
"title": "Compress Settings Overview"
|
||||
@ -3341,6 +3344,10 @@
|
||||
"grayscale": {
|
||||
"title": "Grayscale",
|
||||
"text": "Select this option to convert all images to black and white, which can significantly reduce file size especially for scanned PDFs or image-heavy documents."
|
||||
},
|
||||
"linearize": {
|
||||
"title": "Linearize",
|
||||
"text": "Optimize PDF for faster web viewing by rearranging the PDF structure so the first page can be displayed quickly in web browsers."
|
||||
}
|
||||
},
|
||||
"error": {
|
||||
|
||||
@ -129,6 +129,12 @@ const CompressSettings = ({ parameters, onParameterChange, disabled = false }: C
|
||||
disabled={disabled}
|
||||
label={t("compress.grayscale.label", "Apply Grayscale for compression")}
|
||||
/>
|
||||
<Checkbox
|
||||
checked={parameters.linearize}
|
||||
onChange={(event) => onParameterChange('linearize', event.currentTarget.checked)}
|
||||
disabled={disabled}
|
||||
label={t("compress.linearize.label", "Linearize PDF for faster web viewing")}
|
||||
/>
|
||||
</Stack>
|
||||
</Stack>
|
||||
);
|
||||
|
||||
@ -19,6 +19,7 @@ export const buildCompressFormData = (parameters: CompressParameters, file: File
|
||||
}
|
||||
|
||||
formData.append("grayscale", parameters.grayscale.toString());
|
||||
formData.append("linearize", parameters.linearize.toString());
|
||||
return formData;
|
||||
};
|
||||
|
||||
|
||||
@ -8,6 +8,7 @@ export interface CompressParameters extends BaseParameters {
|
||||
compressionMethod: 'quality' | 'filesize';
|
||||
fileSizeValue: string;
|
||||
fileSizeUnit: 'KB' | 'MB';
|
||||
linearize: boolean;
|
||||
}
|
||||
|
||||
export const defaultParameters: CompressParameters = {
|
||||
@ -17,6 +18,7 @@ export const defaultParameters: CompressParameters = {
|
||||
compressionMethod: 'quality',
|
||||
fileSizeValue: '',
|
||||
fileSizeUnit: 'MB',
|
||||
linearize: false,
|
||||
};
|
||||
|
||||
export type CompressParametersHook = BaseParametersHook<CompressParameters>;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user