Integruj workflow PDFium VCL Component w aplikacjach Delphi i C++Builder albo workflow PDFium LCL Component w Lazarus/FPC, z komponentami źródłowymi do podglądu, renderowania, formularzy, drukowania, raportów preflight i walidacji zgodnej ze standardami.
Ten artykuł jest przeznaczony dla developers adding viewing aids for users who need contrast, color inversion, or reduced visual strain. Traktuje low-vision color filters and reading modes jako produkcyjną inżynierię dokumentów, a nie pojedyncze wywołanie komponentu.
Praktyczne ryzyko polega na tym, że display filters can help users read documents, but they can also mislead review workflows if the application does not explain that the source PDF is unchanged. Dlatego przepływ wymaga spisanego kontraktu, obserwowalnej diagnostyki i realistycznych plików regresyjnych.
Decyzje architektoniczne
Keep visual assistance separate from document editing. available modes such as high contrast, grayscale, inverted color, and warm background / whether filters apply to pages, thumbnails, selection highlights, and annotations
- available modes such as high contrast, grayscale, inverted color, and warm background
- whether filters apply to pages, thumbnails, selection highlights, and annotations
- preference persistence per user, per document, or per application profile
- screen capture, print, and export behavior while filters are active
Przebieg implementacji
Apply filters in the rendering pipeline. Poniższa kolejność zachowuje czytelność przepływu pracy dla zespołów Delphi i C++Builder.
- add filter selection to viewer state rather than PDF modification code
- render representative text, images, forms, and annotations through each mode
- keep selection colors and focus indicators visible under every filter
- show whether printing uses the original PDF appearance or the filtered view
- record mode settings when users report readability issues
Dowody walidacji
Usability evidence for low-vision modes. Zachowaj te pola wraz z wynikiem lub rekordem wsparcia.
- filter mode, contrast ratio spot checks, zoom level, and page rendering backend
- selection, annotation, form-field, and focus visibility under the active mode
- preference storage decision and reset path
- support screenshot that clearly labels filtered display state
A filter is a view, not a document change
Low-vision support should alter the rendered presentation without changing the PDF bytes. Users need predictable toggles, persistent preferences, clear print behavior, and fallback text when a document cannot be read visually.
Decision table for low-vision color filters and reading modes
A decision table keeps product ownership visible when the same workflow is reused by a desktop tool, service job, and support utility.
| Decision | Engineering reason | Evidence |
|---|---|---|
| available modes such as high contrast, grayscale, inverted color, and warm background | add filter selection to viewer state rather than PDF modification code | filter mode, contrast ratio spot checks, zoom level, and page rendering backend |
| whether filters apply to pages, thumbnails, selection highlights, and annotations | render representative text, images, forms, and annotations through each mode | selection, annotation, form-field, and focus visibility under the active mode |
| preference persistence per user, per document, or per application profile | keep selection colors and focus indicators visible under every filter | preference storage decision and reset path |
Notatki przeglądu inżynierskiego dla low-vision color filters and reading modes
Użyj tych notatek przeglądu, aby upewnić się, że funkcja wyszła poza demonstrację i da się ją obronić podczas wydania, wsparcia i eskalacji klienta.
- Decyzja: available modes such as high contrast, grayscale, inverted color, and warm background. Punkt nacisku implementacji: render representative text, images, forms, and annotations through each mode. Dowody akceptacji: preference storage decision and reset path. Wyzwalacz regresji: dark-mode application chrome should not reduce document focus visibility
- Decyzja: whether filters apply to pages, thumbnails, selection highlights, and annotations. Punkt nacisku implementacji: keep selection colors and focus indicators visible under every filter. Dowody akceptacji: support screenshot that clearly labels filtered display state. Wyzwalacz regresji: image-heavy PDFs may lose detail under aggressive contrast transforms
- Decyzja: preference persistence per user, per document, or per application profile. Punkt nacisku implementacji: show whether printing uses the original PDF appearance or the filtered view. Dowody akceptacji: filter mode, contrast ratio spot checks, zoom level, and page rendering backend. Wyzwalacz regresji: highlight colors can disappear if filters are applied after overlay painting
- Decyzja: screen capture, print, and export behavior while filters are active. Punkt nacisku implementacji: record mode settings when users report readability issues. Dowody akceptacji: selection, annotation, form-field, and focus visibility under the active mode. Wyzwalacz regresji: printing a filtered view may be desired for accessibility but wrong for legal review
Przypadki brzegowe
- image-heavy PDFs may lose detail under aggressive contrast transforms
- highlight colors can disappear if filters are applied after overlay painting
- printing a filtered view may be desired for accessibility but wrong for legal review
- dark-mode application chrome should not reduce document focus visibility
Delphi / C++Builder notes
PDFium Component should sit behind a small service boundary that receives files, streams, profiles, and credentials, then returns output paths, warnings, metrics, and validation status. Important terms include color filter, contrast, inversion, reading mode, render pipeline, accessibility.
Przykład kodu Delphi
Poniższy szkic Delphi pokazuje praktyczną granicę usługi dla tego tematu. Kontrole zasad, logowanie i walidację trzymaj poza wąskim blokiem wywołań produktu, aby przepływ pozostał testowalny.
procedure TPreviewForm.ApplyReadingTheme(const Theme: TReadingTheme);
begin
FCurrentTheme := Theme;
RenderCurrentPage;
ApplyBitmapColorMatrix(FPageBitmap, Theme.ColorMatrix);
PaintContrastCheckedBitmap(FPageBitmap);
LogAccessibilitySetting(Theme.Name);
end;
Lista produkcyjna
- Uruchom przepływ pracy na pustym pliku, zwykłym pliku klienta i pliku z najgorszego scenariusza
- Otwórz wygenerowany plik PDF w docelowej przeglądarce, walidatorze, drukarce lub aplikacji nadrzędnej
- Zaloguj wersję produktu, wersję profilu, hash wejścia, ścieżkę wyjścia, czas wykonania i liczbę ostrzeżeń
- Przechowuj hasła, certyfikaty, pliki tymczasowe i dane klienta zgodnie z jednoznacznymi zasadami retencji
- Dodaj dokument regresyjny, gdy plik klienta ujawni nowy przypadek brzegowy
Dokumentacja produktu
Dodatkowe przykłady kodu
// Engine-level: grayscale applied during rasterization
GrayA := Pdf.RenderPage(0, 0, W, H, ro0, [reGrayscale]);
// Post-process: render in color, convert the finished bitmap
GrayB := Pdf.RenderPage(0, 0, W, H);
GrayscalePdfBitmap(GrayB);// Affects the on-screen view only
PdfView.PageColor := $00D9EDF2; // warm paper tone behind page content
// RenderPage output ignores PageColor; pass the color explicitly
Bmp := Pdf.RenderPage(0, 0, W, H, ro0, [], $00D9EDF2);