# Copyright (c) 2025-2026 Gigasoft, Inc. All rights reserved. === ProEssentials Printing (knowledge rev 4) & Export === ProEssentials provides programmatic printing and image export through PeFunction methods and PeUserInterface.Allow/Dialog properties. SIMPLE PRINTING: PeFunction.PrintGraph(parentHandle, titleString, orientation) Shows print dialog, prints the chart. Orientation via DefOrientation enum. After printing, ALWAYS call PeFunction.ResetImage(0, 0) to restore screen. CUSTOM PRINTING (multi-chart per page): Use PrintGraphEx for precise layout control with a PrintDocument. 1. Create PrintDocument, handle PrintPage event 2. In PrintPage: get Graphics hDC from e.Graphics 3. Call PeFunction.PrintGraphEx(hDC, x, y, width, height, ...) per chart 4. After all printing: PeFunction.ResetImage(0, 0) Query: pe_query.py function "PrintGraphEx" IMAGE EXPORT: PeFunction.Image provides export to various formats: Methods on PeFunction.Image: PngToStream, JpgToStream, etc. Call with desired width/height in pixels. After export: PeFunction.ResetImage(0, 0) to restore screen rendering. DPI CONTROL: ExportImageDpi controls the resolution for export operations. PrintDpi affects printer output resolution. For high-quality print: set DPI before printing, reset after. EXPORT DIALOGS: PeUserInterface.Allow.Exporting -- let users export via right-click menu. PeUserInterface.Menu.ExportDialog -- show export dialog programmatically. EMF EXPORT: EmfType and EmfDC properties control Enhanced Metafile output. Use for vector graphics (scalable, editable in Illustrator/Visio). PRINT STYLE: PrintStyleControl -- adjust line weights and sizes for print vs. screen. Typically print needs heavier lines than screen display. CRITICAL PATTERN -- ALWAYS RESET: ANY printing or export operation temporarily modifies the chart's rendering target. You MUST call PeFunction.ResetImage(0, 0) afterward or the on-screen chart will not render correctly. Known anomaly: HObject documentation references this pattern. The HObject property (PeSpecial.HObject) provides the Win32 handle needed for advanced DLL-level printing operations. KEY: pe_query.py function "PrintGraph" pe_query.py search "export image" pe_query.py recipe "printing"