import { Paragraph, TextRun, ImageRun } from 'docx'; import type { UnifiedRenderResult } from '../types/index'; import type { ImageBufferResult, DOCXImageType } from '../types/docx'; interface ImageDimensions { width: number; height: number; } interface Renderer { render(type: string, content: string, options?: Record): Promise<{ base64: string; width: number; height: number; }>; } type FetchImageAsBufferFunction = (url: string) => Promise; /** * Calculate appropriate image dimensions for DOCX to fit within page constraints * Maximum width: 6 inches (page width with 1 inch margins on letter size) * Maximum height: 9.5 inches (page height with 1 inch margins on letter size) * @param originalWidth - Original image width in pixels * @param originalHeight - Original image height in pixels * @returns {width: number, height: number} in pixels */ export declare function calculateImageDimensions(originalWidth: number, originalHeight: number): ImageDimensions; /** * Convert unified plugin render result to DOCX elements * @param renderResult - Unified render result from plugin.renderToCommon() * @param pluginType - Plugin type for alt text * @returns DOCX Paragraph or ImageRun */ export declare function convertPluginResultToDOCX(renderResult: UnifiedRenderResult, pluginType?: string): Paragraph | TextRun | ImageRun; /** * Get image dimensions from buffer * @param buffer - Image buffer * @param contentType - Image content type * @returns Promise with width and height */ export declare function getImageDimensions(buffer: Uint8Array, contentType: string): Promise; /** * Determine image type from content type or URL * @param contentType - Image content type * @param url - Image URL * @returns Image type for docx */ export declare function determineImageType(contentType: string | null, url: string): DOCXImageType; /** * Check if URL or content type indicates an SVG image * @param url - Image URL * @param contentType - Content type (optional) * @returns True if SVG */ export declare function isSvgImage(url: string, contentType?: string | null): boolean; /** * Convert SVG content to PNG using renderer * @param svgContent - SVG content string * @param renderer - Renderer instance with render() method * @returns Promise with buffer, width, and height */ export declare function convertSvgToPng(svgContent: string, renderer: Renderer): Promise<{ buffer: Uint8Array; width: number; height: number; }>; /** * Get SVG content from URL or data URL * @param url - SVG URL or data URL * @param fetchImageAsBuffer - Function to fetch image as buffer * @returns SVG content string */ export declare function getSvgContent(url: string, fetchImageAsBuffer: FetchImageAsBufferFunction): Promise; export {};