diff --git a/frontend/src/core/components/tools/getPdfInfo/sections/OtherSection.tsx b/frontend/src/core/components/tools/getPdfInfo/sections/OtherSection.tsx index e7eb8d8b3..3bc515a1a 100644 --- a/frontend/src/core/components/tools/getPdfInfo/sections/OtherSection.tsx +++ b/frontend/src/core/components/tools/getPdfInfo/sections/OtherSection.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { Accordion, Stack, Text } from '@mantine/core'; import { useTranslation } from 'react-i18next'; -import type { PdfOtherInfo } from '@app/types/getPdfInfo'; +import type { PdfOtherInfo, PdfAttachmentInfo, PdfEmbeddedFileInfo } from '@app/types/getPdfInfo'; import SectionBlock from '@app/components/tools/getPdfInfo/shared/SectionBlock'; import ScrollableCodeBlock from '@app/components/tools/getPdfInfo/shared/ScrollableCodeBlock'; import { pdfInfoAccordionStyles } from '@app/components/tools/getPdfInfo/shared/accordionStyles'; @@ -11,6 +11,42 @@ interface OtherSectionProps { other?: PdfOtherInfo | null; } +const renderAttachmentsList = (attachments: PdfAttachmentInfo[] | undefined, emptyText: string) => { + if (!attachments || attachments.length === 0) return {emptyText}; + return ( + + {attachments.map((attachment, idx) => ( +
+ + {attachment.Name || 'Unnamed attachment'} + {attachment.Description && ` - ${attachment.Description}`} + {attachment.FileSize != null && ` (${attachment.FileSize} bytes)`} + +
+ ))} +
+ ); +}; + +const renderEmbeddedFilesList = (embeddedFiles: PdfEmbeddedFileInfo[] | undefined, emptyText: string) => { + if (!embeddedFiles || embeddedFiles.length === 0) return {emptyText}; + return ( + + {embeddedFiles.map((file, idx) => ( +
+ + {file.Name || 'Unnamed file'} + {file.FileSize != null && ` (${file.FileSize} bytes)`} + {file.MimeType && ` - ${file.MimeType}`} + {file.CreationDate && ` - Created: ${file.CreationDate}`} + {file.ModificationDate && ` - Modified: ${file.ModificationDate}`} + +
+ ))} +
+ ); +}; + const renderList = (arr: unknown[] | undefined, emptyText: string) => { if (!arr || arr.length === 0) return {emptyText}; return ( @@ -37,11 +73,11 @@ const OtherSection: React.FC = ({ anchorId, other }) => { {t('getPdfInfo.other.attachments', 'Attachments')} - {renderList(other?.Attachments, noneDetected)} + {renderAttachmentsList(other?.Attachments, noneDetected)} {t('getPdfInfo.other.embeddedFiles', 'Embedded Files')} - {renderList(other?.EmbeddedFiles, noneDetected)} + {renderEmbeddedFilesList(other?.EmbeddedFiles, noneDetected)} {t('getPdfInfo.other.javaScript', 'JavaScript')} diff --git a/frontend/src/core/components/tools/getPdfInfo/sections/PerPageSection.tsx b/frontend/src/core/components/tools/getPdfInfo/sections/PerPageSection.tsx index 4fd257cce..36bd7bf1c 100644 --- a/frontend/src/core/components/tools/getPdfInfo/sections/PerPageSection.tsx +++ b/frontend/src/core/components/tools/getPdfInfo/sections/PerPageSection.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { Accordion, Stack, Text } from '@mantine/core'; import { useTranslation } from 'react-i18next'; -import type { PdfPerPageInfo, PdfPageInfo, PdfFontInfo } from '@app/types/getPdfInfo'; +import type { PdfPerPageInfo, PdfPageInfo, PdfFontInfo, PdfImageInfo } from '@app/types/getPdfInfo'; import SectionBlock from '@app/components/tools/getPdfInfo/shared/SectionBlock'; import KeyValueList from '@app/components/tools/getPdfInfo/shared/KeyValueList'; import { pdfInfoAccordionStyles } from '@app/components/tools/getPdfInfo/shared/accordionStyles'; @@ -11,6 +11,23 @@ interface PerPageSectionProps { perPage?: PdfPerPageInfo | null; } +const renderImagesList = (images: PdfImageInfo[] | undefined, emptyText: string) => { + if (!images || images.length === 0) return {emptyText}; + return ( + + {images.map((image, idx) => ( +
+ + {image.Name ? `${image.Name} ` : 'Image '} + ({image.Width}×{image.Height}px + {image.ColorSpace ? `, ${image.ColorSpace}` : ''}) + +
+ ))} +
+ ); +}; + const renderList = (arr: unknown[] | undefined, emptyText: string) => { if (!arr || arr.length === 0) return {emptyText}; return ( @@ -84,7 +101,7 @@ const PerPageSection: React.FC = ({ anchorId, perPage }) => )} {t('getPdfInfo.perPage.images', 'Images')} - {renderList(pageInfo?.Images, noneDetected)} + {renderImagesList(pageInfo?.Images, noneDetected)} {t('getPdfInfo.perPage.links', 'Links')} diff --git a/frontend/src/core/types/getPdfInfo.ts b/frontend/src/core/types/getPdfInfo.ts index f489cd99a..20442cebc 100644 --- a/frontend/src/core/types/getPdfInfo.ts +++ b/frontend/src/core/types/getPdfInfo.ts @@ -160,12 +160,16 @@ export interface PdfPerPageInfo { export interface PdfEmbeddedFileInfo { Name?: string; FileSize?: number; + MimeType?: string; + CreationDate?: string; + ModificationDate?: string; } /** Attachment info */ export interface PdfAttachmentInfo { Name?: string; Description?: string; + FileSize?: number; } /** JavaScript info */