Skip to content

armgit / Filee

Public Imported from GitHub
0

Free, open-source file converter. Convert 263 formats offline by drag & drop — images, PDF, Word, Excel, PowerPoint, HWP/HWPX, video, audio, e-books and archives. No upload, no Office needed.

Merge remote-tracking branch 'origin/feature/pdf-compression' into HEAD

KnifeLemon3abc4bdad389
diff --cc README.ko.md
index 6a3d6ae4,17844567..01f2a94c
--- a/README.ko.md
+++ b/README.ko.md
@@@ -83,7 -83,7 +83,7 @@@
|---|---|
| **이미지**: JPG, PNG, WEBP, AVIF, TIFF, BMP, GIF, APNG, ICO, ICNS, JPEG XL, JPEG 2000, PSD/PSB, TGA, PPM, HEIC, QOI, DDS, PCX, MNG, CUR 등; GIMP XCF, 카메라 RAW(CR2, CR3, NEF, ARW, DNG 등), DICOM, OpenEXR, HDR은 읽기 | 위 형식끼리(HEIC⁵), PDF, SVG(벡터화), 크기 조정, 흑백 |
| **벡터**: SVG, SVGZ, EMF, WMF, AI · EPS, PS¹ · CDR, VSD, CGM, ODG, FODG² | PDF(벡터), PNG 등 이미지, SVG ↔ SVGZ, SVG → DXF/DWG, PDF → EPS/PS¹, SVG → EMF, WMF, ODG² |
- | **PDF** | DOCX, HWPX, TXT, PNG, JPG, TIFF, CBZ, PPTX(페이지마다 그림 한 장), SVG²; 합치기, 나누기, 페이지 범위 |
-| **PDF** | DOCX, HWPX, TXT, PNG, JPG, TIFF, CBZ, SVG²; 합치기, 나누기, 페이지 범위, 압축 (더 작은 PDF) |
++| **PDF** | DOCX, HWPX, TXT, PNG, JPG, TIFF, CBZ, PPTX(페이지마다 그림 한 장), SVG²; 합치기, 나누기, 페이지 범위, 압축 (더 작은 PDF) |
| **문서**: DOCX, DOCM, DOTX, EML, Outlook MSG · DOC, ODT, FODT, OTT, RTF, WPS, WPD, Pages, ClarisWorks, MacWrite, T602 등² | PDF, DOCX, HWPX, EPUB, TXT, HTML; MSG → EML · ODT, FODT, OTT² |
| **스프레드시트**: XLSX, XLSM, XLS, XLT, ODS, CSV, TSV · OTS, FODS, Numbers, ET² | PDF, XLSX, ODS, CSV, TSV, JSON, HWPX, HTML · XLT, OTS² |
| **프레젠테이션**: PPTX, PPTM, POTX, PPSX · PPT, ODP, OTP, FODP, Keynote² | PDF, PNG, JPG, DOCX, HWPX · OTP² |
diff --cc README.md
index 0547710b,f263d938..4d175151
--- a/README.md
+++ b/README.md
@@@ -83,7 -83,7 +83,7 @@@ Filee shows new releases in its menu an
|---|---|
| **Images**: JPG, PNG, WEBP, AVIF, TIFF, BMP, GIF, APNG, ICO, ICNS, JPEG XL, JPEG 2000, PSD/PSB, TGA, PPM, HEIC, QOI, DDS, PCX, MNG, CUR, …; GIMP XCF, camera RAW (CR2, CR3, NEF, ARW, DNG, …), DICOM, OpenEXR, HDR read | any of these (HEIC⁵), PDF, SVG (traced), resized, grayscale |
| **Vector**: SVG, SVGZ, EMF, WMF, AI · EPS, PS¹ · CDR, VSD, CGM, ODG, FODG² | PDF (vector), PNG and other images, SVG ↔ SVGZ, SVG → DXF/DWG, PDF → EPS/PS¹, SVG → EMF, WMF, ODG² |
- | **PDF** | DOCX, HWPX, TXT, PNG, JPG, TIFF, CBZ, PPTX (a picture of each page), SVG²; merge, split, page ranges |
-| **PDF** | DOCX, HWPX, TXT, PNG, JPG, TIFF, CBZ, SVG²; merge, split, page ranges, compress (smaller PDFs) |
++| **PDF** | DOCX, HWPX, TXT, PNG, JPG, TIFF, CBZ, PPTX (a picture of each page), SVG²; merge, split, page ranges, compress (smaller PDFs) |
| **Documents**: DOCX, DOCM, DOTX, EML, Outlook MSG · DOC, ODT, FODT, OTT, RTF, WPS, WPD, Pages, ClarisWorks, MacWrite, T602, …² | PDF, DOCX, HWPX, EPUB, TXT, HTML; MSG → EML · ODT, FODT, OTT² |
| **Spreadsheets**: XLSX, XLSM, XLS, XLT, ODS, CSV, TSV · OTS, FODS, Numbers, ET² | PDF, XLSX, ODS, CSV, TSV, JSON, HWPX, HTML · XLT, OTS² |
| **Presentations**: PPTX, PPTM, POTX, PPSX · PPT, ODP, OTP, FODP, Keynote² | PDF, PNG, JPG, DOCX, HWPX · OTP² |
diff --cc README.zh-CN.md
index c6fe1dce,5179c4eb..8cf5d8f0
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@@ -82,7 -82,7 +82,7 @@@
|---|---|
| **图片**:JPG、PNG、WEBP、AVIF、TIFF、BMP、GIF、APNG、ICO、ICNS、JPEG XL、JPEG 2000、PSD/PSB、TGA、PPM、HEIC、QOI、DDS、PCX、MNG、CUR 等;GIMP XCF、相机 RAW(CR2、CR3、NEF、ARW、DNG 等)、DICOM、OpenEXR、HDR 仅读取 | 上述格式互转(HEIC⁵)、PDF、SVG(描摹)、缩放、灰度 |
| **矢量图**:SVG、SVGZ、EMF、WMF、AI · EPS、PS¹ · CDR、VSD、CGM、ODG、FODG² | PDF(矢量)、PNG 等图片、SVG ↔ SVGZ、SVG → DXF/DWG、PDF → EPS/PS¹、SVG → EMF、WMF、ODG² |
- | **PDF** | DOCX、HWPX、TXT、PNG、JPG、TIFF、CBZ、PPTX(每页一张图片)、SVG²;合并、拆分、页码范围 |
-| **PDF** | DOCX、HWPX、TXT、PNG、JPG、TIFF、CBZ、SVG²;合并、拆分、页码范围、压缩(更小的 PDF) |
++| **PDF** | DOCX、HWPX、TXT、PNG、JPG、TIFF、CBZ、PPTX(每页一张图片)、SVG²;合并、拆分、页码范围、压缩(更小的 PDF) |
| **文档**:DOCX、DOCM、DOTX、EML、Outlook MSG · DOC、ODT、FODT、OTT、RTF、WPS、WPD、Pages、ClarisWorks、MacWrite、T602 等² | PDF、DOCX、HWPX、EPUB、TXT、HTML、MSG → EML · ODT、FODT、OTT² |
| **表格**:XLSX、XLSM、XLS、XLT、ODS、CSV、TSV · OTS、FODS、Numbers、ET² | PDF、XLSX、ODS、CSV、TSV、JSON、HWPX、HTML · XLT、OTS² |
| **演示文稿**:PPTX、PPTM、POTX、PPSX · PPT、ODP、OTP、FODP、Keynote² | PDF、PNG、JPG、DOCX、HWPX · OTP² |
diff --cc docs/ENGINES.md
index b8f356b2,d9ed1142..549d4cb9
--- a/docs/ENGINES.md
+++ b/docs/ENGINES.md
@@@ -29,8 -28,8 +29,8 @@@ Filee chooses engines automatically. Se
| Archives (7-Zip) | bundled with the installer (`engines/7zip`, ~2.5 MB) + built-in readers | ZIP, 7Z, RAR, TAR (+ GZ/BZ2/XZ/Z/7Z/LZ), CAB, ISO, DMG, … **→ folder, ZIP, 7Z, TAR, TAR.GZ/BZ2/XZ**; ALZ, EGG, lzip read in-process; "Compress into one archive" for any files |
| LibreOffice + H2Orestart + Java | **optional download** (~420 MB, 1.3 GB on disk) | older and rare formats only: DOC, XLS, PPT, RTF and OpenDocument → PDF and to each other, output as DOCX/ODT/ODS/ODP; HWP/HWPX → DOCX/ODT; read-only formats (see below) → PDF and their kind's editable formats; FODT, OpenDocument templates (OTT, OTS, OTP) and XLT out; SVG → EMF/WMF/ODG, a PDF page → SVG |
| Pandoc | **optional download** (~42 MB, 240 MB on disk) | Markdown ↔ DOCX/ODT/RTF, DOCX/ODT/HTML/RTF → Markdown, HTML ↔ DOCX/ODT, markup languages (reStructuredText, LaTeX, Org, AsciiDoc, Typst, MediaWiki, DocBook, Jupyter, Textile, man, OPML) ↔ Markdown/HTML/DOCX/ODT and each other (and → RTF, EPUB, TXT), Markdown and markup → PPTX slides |
- | Ghostscript | **optional download** (~20 MB, 31 MB on disk) | EPS/PS → PDF, PDF → EPS/PS, PostScript-based AI → PDF (images through PDF and PDFium) |
+ | Ghostscript | **optional download** (~20 MB, 31 MB on disk) | EPS/PS → PDF, PDF → EPS/PS, PostScript-based AI → PDF (images through PDF and PDFium); smaller PDFs when a preset asks for it |
-| FFmpeg | **optional download** (~100 MB, 272 MB on disk) | **all video and audio**: video ↔ video (H.264, HEVC, AV1), video → animated GIF / APNG or a still frame, audio and subtitle extraction, audio ↔ audio (also APE, WavPack, TTA, DSD, DTS, ALAC, …), GIF, APNG and photos → MP4/WEBM/MOV, images → HEIC |
+| FFmpeg | **optional download** (~100 MB, 272 MB on disk) | **all video and audio**: video ↔ video (H.264, HEVC, AV1), video → animated GIF / APNG, a still frame or every frame, audio and subtitle extraction, audio ↔ audio (also APE, WavPack, TTA, DSD, DTS, ALAC, …), GIF, APNG and photos → MP4/WEBM/MOV, images → HEIC |
| Calibre | **optional download** (~216 MB, 660 MB on disk) | rare e-book formats: LIT, LRF, CHM, PDB, PML, RB, SNB, TCR, OEB → EPUB; EPUB → MOBI, AZW3, LIT, LRF, PDB, PML, RB, SNB, TCR |
DOCX, XLSX, XLS, ODS and PPTX → PDF need neither Microsoft Office nor LibreOffice: they are read in-process, written as HWPX
@@@ -396,33 -374,49 +396,76 @@@ it. DOCX → DOCX is no edge; the Word
Password-protected PDFs fail with a clear message. Not converted: tables (their cells come out as paragraphs in
reading order), vector drawings on text pages, form fields and annotations other than links.
+## PDF → PPTX
+
+`Pdf/PdfSlidesConverter.cs` turns a PDF into a PowerPoint deck of pictures: every page is rendered (PDFium, as for
+PDF → images) and becomes one picture on its own slide. The slides look exactly like the PDF but are **not
+editable**: there are no text boxes to change, the PDF's layout is not rebuilt. PDF → DOCX is the editable route.
+
+- **Slide size** is the first page's own size (an A4 portrait PDF gives A4 portrait slides, a PDF exported from a
+ 16:9 deck gives 16:9 slides), within PowerPoint's limits of 1 to 56 inches a side. Every page, also one of another
+ size or orientation (pages turned in the PDF are shown turned), is fitted onto the slide without cropping and
+ centred on white.
+- **Resolution** is the preset's render DPI, at least 150 and at most 600; a page larger than 25 megapixels at that
+ resolution (a poster) is rendered at a lower one. The preset's page range picks the pages.
+- **Pictures** are JPEG at the preset's quality (90 by default, as the "PPTX (slides)" preset sets it). Pages are
+ rendered on white, as PDF viewers show them, so they have no transparency that would need PNG, and JPEG keeps a
+ long deck at a size that is easy to send (an A4 text page at 150 dpi is a few hundred KB).
+- **Speaker notes** hold the page's text, read like PDF → TXT (reading order, the invisible OCR layer of scans
+ included), so it can still be searched and copied. Pages without text get no notes; when PdfPig cannot read a PDF
+ that PDFium renders, the deck is written without notes.
+- The package (`Pdf/PictureDeckWriter.cs`) is written by hand: presentation, one slide master with a blank layout,
+ a theme, the slides with their pictures, a notes master and notes slides, and the document properties. The tests
+ validate it with the Open XML SDK and read it back with Filee's own PPTX reader.
+- The edge is `DirectOnly`: the route planner uses it only for a PDF converted to PPTX. A Word document or an image is
+ never turned into picture slides through PDF, and a picture deck is never a step towards ODP, PPSX or another
+ format (a test checks that every other pair of formats keeps its route).
+
+Password-protected PDFs fail with the same message as PDF → DOCX.
+
+ ## PDF compression
+
+ "Compress PDF" (and any PDF → PDF preset with *Compress* set, also with a page range or one file per page) makes a
+ PDF smaller while it stays a PDF, for e-mail attachments and upload limits. `Pdf/PdfCompressor.cs` does it with
+ PDFsharp and Magick.NET; nothing has to be installed.
+
+ | Level | Pictures scaled down to | JPEG quality |
+ |---|---|---|
+ | Smallest (`Screen`) | 72 dpi | 55 |
+ | Balanced (`Ebook`, the preset's) | 150 dpi | 65 |
+ | High quality (`Print`) | 300 dpi | 85 |
+
+ - **Pictures**: `Pdf/PdfPictureUses.cs` follows the content streams of the pages, of the forms they draw and of
+ annotation appearances (`q`/`Q`/`cm`/`Do`) to find the largest size each picture is drawn at. A picture drawn at more
+ than 1.5 × the level's resolution is scaled down to it (as Ghostscript does); a picture whose drawing can't be
+ followed is taken as large as the page holds it, so it is never scaled down too far. Photos are saved as JPEG at the
+ level's quality, pictures with up to 256 colours (charts, screenshots, logos) losslessly (Flate with PNG
+ prediction). A JPEG that keeps its size is encoded again only when that saves at least 10 %. A picture is replaced
+ only when the result is smaller.
+ - **Which pictures**: 8 bits per component, gray, RGB (also ICC-based and calibrated) and CMYK, stored as JPEG, Flate
+ (with or without PNG prediction), RunLength or uncompressed. CMYK JPEGs, 1-bit pictures and masks, indexed
+ (palette) pictures, spot colours, JPEG 2000, JBIG2, CCITT and pictures with a colour-key mask stay as they are.
+ - **Transparency**: a soft mask is scaled with its picture and kept lossless, so transparent parts stay transparent.
+ - **Duplicates**: a picture stored more than once with the same data (a logo embedded again on every page) is kept once.
+ - **Everything else**: every stream is deflated at the highest level when that's smaller; page thumbnails and other
+ applications' private data (`PieceInfo`, such as Illustrator's editing data) are removed, as are unused objects.
+ When the preset doesn't keep metadata, the XMP metadata of pages and pictures goes too. The document's own XMP is
+ written afresh from its document information by PDFsharp, as for every PDF it saves.
+ - **Unchanged**: text, fonts, vector drawings, links, bookmarks and form fields. The whole file is compressed as it
+ is; a page range or single pages are first copied into new PDFs, as without compression (which leaves bookmarks and
+ form fields behind), and so is a PDF locked only against changes.
+ - **Never bigger**: when nothing gets smaller (a PDF of text only, one compressed before), the PDF is written as it was
+ and the toast (and `filee convert`) says that it couldn't be made smaller. Password-protected PDFs fail with the same
+ message as the other PDF conversions.
+ - **Ghostscript** (optional, *Also try Ghostscript* in the preset): when it is installed, the PDF is also run through
+ `pdfwrite` with `-dPDFSETTINGS=/screen`, `/ebook` or `/printer` (the same 72, 150 and 300 dpi) and
+ `-dCompatibilityLevel=1.6`, and the smallest of the two results is kept; when Ghostscript fails, the built-in result
+ stands. It is off by default: Ghostscript rewrites the whole file (fonts are subset again, structure and form fields
+ may change), so it is the user's choice. It also writes object streams, which PDFsharp can't, and its JPEGs are
+ somewhat smaller at the Balanced level.
+ - **Not done**: object streams (PDFsharp writes none), font subsetting or removal of unused glyphs, converting
+ colour to gray, flattening transparency or form fields, recompressing JBIG2/CCITT scans.
+
## Office Open XML variants
`Office/OoxmlConverter.cs` converts between the variants of a family (Word, Excel, PowerPoint) by copying the
diff --cc src/Filee.App/Assets/i18n/en.json
index 25952658,1a502fbe..13a5e2f4
--- a/src/Filee.App/Assets/i18n/en.json
+++ b/src/Filee.App/Assets/i18n/en.json
@@@ -65,9 -58,8 +65,10 @@@
"error.unsupported_source": "This file type isn't supported",
"error.no_route": "No engine can do this conversion",
"error.cannot_turn": "Rotate and flip work on images only",
+ "error.too_many_frames": "Too many frames to save as pictures, raise \"Every Nth frame\"",
+ "error.not_enough_space": "Not enough free disk space for the pictures",
"error.conversion_failed": "The engine reported an error",
+ "notice.pdf_not_smaller": "Couldn't make it smaller, so it was copied as it is",
"engine.reason.not_installed": "Not installed",
"engine.reason.error": "Error while checking",
@@@ -137,8 -128,8 +138,9 @@@
"preset.flip_vertical.short": "Vertical",
"preset.merge_pdf": "Merge PDF",
"preset.split_pdf": "Split PDF",
+ "preset.compress_pdf": "Compress PDF",
"preset.long_image": "Long image",
+ "preset.pdf_slides": "PPTX (slides)",
"preset.extract": "Extract",
"preset.zip_all": "One ZIP",
"preset.extract_subtitles": "Extract subtitles",
diff --cc src/Filee.App/Assets/i18n/ko.json
index d618326e,04db8b59..14f920ca
--- a/src/Filee.App/Assets/i18n/ko.json
+++ b/src/Filee.App/Assets/i18n/ko.json
@@@ -65,9 -58,8 +65,10 @@@
"error.unsupported_source": "지원하지 않는 파일 형식이에요",
"error.no_route": "이 변환을 할 수 있는 엔진이 없어요",
"error.cannot_turn": "회전·반전은 이미지에만 할 수 있어요",
+ "error.too_many_frames": "프레임이 너무 많아요. 'N번째 프레임마다' 값을 늘려 주세요",
+ "error.not_enough_space": "이미지를 저장할 디스크 공간이 부족해요",
"error.conversion_failed": "엔진에서 오류가 발생했어요",
+ "notice.pdf_not_smaller": "더 작게 만들 수 없어서 그대로 복사했어요",
"engine.reason.not_installed": "설치되지 않음",
"engine.reason.error": "확인 중 오류",
@@@ -137,8 -128,8 +138,9 @@@
"preset.flip_vertical.short": "상하",
"preset.merge_pdf": "PDF 병합",
"preset.split_pdf": "PDF 분할",
+ "preset.compress_pdf": "PDF 압축",
"preset.long_image": "긴 이미지",
+ "preset.pdf_slides": "PPTX (슬라이드)",
"preset.extract": "압축 풀기",
"preset.zip_all": "ZIP 하나로",
"preset.extract_subtitles": "자막 추출",
diff --cc src/Filee.App/Assets/i18n/zh-CN.json
index 668f9ccf,63091853..1d885b09
--- a/src/Filee.App/Assets/i18n/zh-CN.json
+++ b/src/Filee.App/Assets/i18n/zh-CN.json
@@@ -65,9 -58,8 +65,10 @@@
"error.unsupported_source": "不支持此文件类型",
"error.no_route": "没有引擎可以完成此转换",
"error.cannot_turn": "只能旋转和翻转图片",
+ "error.too_many_frames": "帧数太多,请调大“每 N 帧”",
+ "error.not_enough_space": "磁盘空间不足,无法保存这些图片",
"error.conversion_failed": "转换引擎出错",
+ "notice.pdf_not_smaller": "无法再缩小,已原样复制",
"engine.reason.not_installed": "未安装",
"engine.reason.error": "检查时出错",
@@@ -137,8 -128,8 +138,9 @@@
"preset.flip_vertical.short": "垂直",
"preset.merge_pdf": "合并 PDF",
"preset.split_pdf": "拆分 PDF",
+ "preset.compress_pdf": "压缩 PDF",
"preset.long_image": "长图",
+ "preset.pdf_slides": "PPTX(幻灯片)",
"preset.extract": "解压",
"preset.zip_all": "打包成一个 ZIP",
"preset.extract_subtitles": "提取字幕",
diff --cc src/Filee.App/ViewModels/PresetEditorViewModel.cs
index 13816958,6f555339..f3c2423e
--- a/src/Filee.App/ViewModels/PresetEditorViewModel.cs
+++ b/src/Filee.App/ViewModels/PresetEditorViewModel.cs
@@@ -177,11 -163,11 +183,12 @@@ public sealed partial class PresetEdito
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(ShowImage), nameof(ShowTurnForPdf), nameof(ShowQuality), nameof(ShowTiff), nameof(ShowMultiPageTiff), nameof(ShowWebp), nameof(ShowIco),
nameof(ShowPdf), nameof(ShowPdfBuild), nameof(ShowDocument), nameof(ShowPdfSplit), nameof(ShowPdfCombine),
+ nameof(ShowPdfCompression), nameof(ShowPdfCompressionOptions),
nameof(ShowMedia), nameof(ShowMediaQuality), nameof(ShowMaxHeight), nameof(ShowAudioBitrate), nameof(ShowRemoveAudio),
- nameof(ShowAudioChannels), nameof(ShowWav), nameof(VideoCodecs), nameof(VideoCodecChoice), nameof(ShowVideoCodec),
+ nameof(ShowAudioChannels), nameof(ShowWav), nameof(VideoCodecs), nameof(VideoCodecChoice), nameof(ShowVideoCodec), nameof(ShowHardwareEncoding),
nameof(AudioCodecs), nameof(AudioCodecChoice), nameof(ShowAudioCodec),
- nameof(ShowArchive), nameof(ShowArchiveOptions), nameof(ShowExtractNote), nameof(ShowTrace))]
+ nameof(ShowArchive), nameof(ShowArchiveOptions), nameof(ShowExtractNote),
+ nameof(ShowSaveEveryFrame), nameof(ShowTrace))]
private Choice<string> _target;
private VideoCodec _videoCodecValue;
diff --cc src/Filee.Core/Conversion/IConverter.cs
index 6c1814f2,dc06561f..fbaee33f
--- a/src/Filee.Core/Conversion/IConverter.cs
+++ b/src/Filee.Core/Conversion/IConverter.cs
@@@ -83,9 -58,9 +83,12 @@@ public interface IOutputAllocato
/// <param name="Preset">Options chosen by the user.</param>
/// <param name="Output">Where to write results.</param>
/// <param name="WorkDirectory">Private scratch directory for this job; deleted afterwards.</param>
+/// <param name="FrameSequence">
+/// The step takes a <see cref="ConversionEdge.FrameSequence"/> edge: every frame of the video becomes a picture of
+/// format <paramref name="To"/> in one output folder.
+ /// <param name="Notice">
+ /// Records a note on a step that worked, as a localization key (e.g. <c>notice.pdf_not_smaller</c>): shown with the
+ /// file's result. Null when nobody listens.
/// </param>
public sealed record ConversionStep(
string InputPath,
@@@ -94,7 -69,7 +97,8 @@@
Preset Preset,
IOutputAllocator Output,
string WorkDirectory,
- bool FrameSequence = false);
++ bool FrameSequence = false,
+ Action<string>? Notice = null);
/// <summary>
/// A conversion engine (ImageMagick, LibreOffice, rhwp, ...).
diff --cc src/Filee.Core/Conversion/JobQueue.cs
index ce58d87e,5c1770f4..dbf0fbe7
--- a/src/Filee.Core/Conversion/JobQueue.cs
+++ b/src/Filee.Core/Conversion/JobQueue.cs
@@@ -380,7 -378,7 +380,8 @@@ public sealed class JobQueue : IAsyncDi
// Turned once, in step turnAt: every other step gets the preset without rotation and flip,
// also one before it whose engine applies image options but doesn't say it turns.
var preset = s == turnAt ? job.Preset : unturned;
- var stepInfo = new ConversionStep(input, step.From, step.To, preset, allocator, workDir, step.FrameSequence);
- var stepInfo = new ConversionStep(input, step.From, step.To, preset, allocator, workDir, key => file.NoticeKey = key);
++ var stepInfo = new ConversionStep(input, step.From, step.To, preset, allocator, workDir, step.FrameSequence,
++ key => file.NoticeKey = key);
outputs.AddRange(await step.Converter.ConvertAsync(stepInfo, progress, ct));
}
finally
diff --cc src/Filee.Core/Presets/BuiltInData.cs
index c5ef5e7e,7009291a..7ec96870
--- a/src/Filee.Core/Presets/BuiltInData.cs
+++ b/src/Filee.Core/Presets/BuiltInData.cs
@@@ -65,8 -65,7 +65,9 @@@ public static class BuiltInDat
Id = "pdf-split", NameKey = "preset.split_pdf", TargetFormat = "pdf",
Pdf = { SplitPages = true }, Output = { Location = OutputLocation.Subfolder, SubfolderName = "{name}" },
},
+ .. PdfCompressionPresets(),
+ .. PdfSlidesPresets(),
+ .. FramePresets(),
new() { Id = "to-docx", Name = "DOCX", TargetFormat = "docx" },
new() { Id = "to-hwpx", Name = "HWPX", TargetFormat = "hwpx" },
.. HwpPresets(),
@@@ -83,25 -82,19 +84,38 @@@
.. TracePresets(),
];
+ /// <summary>
+ /// "Compress PDF": pictures at 150 dpi, the rest compressed losslessly (added in settings schema 20). On no default
+ /// donut, the PDF donut is full: users add it in Settings → Toolbar.
+ /// </summary>
+ public static List<Preset> PdfCompressionPresets() =>
+ [
+ new()
+ {
+ Id = "compress-pdf", NameKey = "preset.compress_pdf", TargetFormat = "pdf",
+ Pdf = { Compression = PdfCompression.Ebook }, Output = { FileNamePattern = "{name}_compressed" },
+ },
+ ];
+
+ /// <summary>
+ /// PDF → PowerPoint with a picture of each page on its own slide (added in settings schema 18). JPEG at 90 like the
+ /// JPG preset; the render DPI is the PDF default (150), which the converter never goes below.
+ /// </summary>
+ public static List<Preset> PdfSlidesPresets() =>
+ [
+ new() { Id = "pdf-slides", NameKey = "preset.pdf_slides", TargetFormat = "pptx", Image = { Quality = 90 } },
+ ];
+
+ /// <summary>
+ /// Every frame of a video as PNG or JPG pictures in a folder (added in settings schema 19), on no donut: a long
+ /// video gives thousands of files, so users add them in Settings → Toolbar.
+ /// </summary>
+ public static List<Preset> FramePresets() =>
+ [
+ new() { Id = "extract-frames-png", NameKey = "preset.extract_frames_png", TargetFormat = "png", Media = { SaveEveryFrame = true } },
+ new() { Id = "extract-frames-jpg", NameKey = "preset.extract_frames_jpg", TargetFormat = "jpg", Media = { SaveEveryFrame = true } },
+ ];
+
/// <summary>Raster → SVG tracing, in colour and as black line art (added in settings schema 16).</summary>
public static List<Preset> TracePresets() =>
[
diff --cc src/Filee.Core/Settings/UserDataStore.cs
index 7a05f099,9d05dc10..6cf958d2
--- a/src/Filee.Core/Settings/UserDataStore.cs
+++ b/src/Filee.Core/Settings/UserDataStore.cs
@@@ -490,28 -480,28 +490,49 @@@ internal static class SettingsMigration
}
}
+ // v18: PDF → PPTX ("PPTX (slides)", a picture of each page per slide), on the PDF donut after DOCX. The default
+ // PDF donut is full: one the user never changed takes it in place of TIFF, as a new library has it; a donut
+ // the user changed gets it when it has room.
+ if (from < 18)
+ changed |= AddPdfSlides(presets, profiles);
+ // v19: "Extract frames" (every frame of a video as PNG or JPG pictures in a folder), on no donut, after "PPTX
+ // (slides)" or "Split PDF" as in a new library: a long video gives thousands of files, so users add them in
+ // Settings → Toolbar.
+ if (from < 19)
+ {
+ var at = presets.FindIndex(p => p.Id == "pdf-slides");
+ if (at < 0)
+ at = presets.FindIndex(p => p.Id == "pdf-split");
+ at = at < 0 ? presets.Count : at + 1;
+ foreach (var preset in BuiltInData.FramePresets())
+ {
+ if (presets.Any(p => p.Id == preset.Id))
+ continue;
+ presets.Insert(Math.Min(at++, presets.Count), preset);
+ changed = true;
+ }
+ }
+ // v20: "Compress PDF" (PDF → a smaller PDF), after "Split PDF" as in a new library, on no donut: the PDF donut
+ // is full. Present already but saved since by a Filee before 20 (back and forth between versions): that
+ // one dropped the compression level and left a preset that copies the pages, so the level is put back.
- // (Schema 18 and 19 belong to other changes: renumber when they land in a different order.)
+ if (from < 20)
+ {
+ foreach (var compress in BuiltInData.PdfCompressionPresets())
+ {
+ if (presets.FirstOrDefault(p => p.Id == compress.Id) is { } existing)
+ {
+ if (existing.Pdf.Compression == PdfCompression.None && existing.TargetFormat == compress.TargetFormat)
+ {
+ existing.Pdf.Compression = compress.Pdf.Compression;
+ changed = true;
+ }
+ continue;
+ }
+ var split = presets.FindIndex(p => p.Id == "pdf-split");
+ presets.Insert(split < 0 ? presets.Count : split + 1, compress);
+ changed = true;
+ }
+ }
return changed;
}