|
ReportBuilder 자체 ppPDFDevice 대신 HotPDF를 PDF 백엔드로 사용하는 ReportBuilder 디바이스 클래스입니다. 이미 HotPDF를 사용하는 프로젝트에서 애플리케이션 전체의 PDF 백엔드를 하나로 통일하려는 경우를 위한 것입니다
Delphi declaration:
type
TppHotPDFDevice = class(TppGraphicsDevice)
public
class function DeviceName: String; override;
procedure StartJob; override;
procedure EndJob; override;
procedure CancelJob; override;
procedure SetOutputStream(AStream: TStream);
property FileName: string;
property Title, Author, Subject, Keywords: string;
property PDFVersion: TPDFVersType;
property PDFACompliance: string;
property PDFXCompliance: string;
property Compressed: Boolean;
property CompressionLevel: TPDFCompressionLevel;
property RenderMode: TppHotPDFRenderMode;
end;
Description
TppHotPDFDevice는 TppGraphicsDevice(TppCustomScreenDevice / TppImageDevice보다 한 단계 위)를 상속하므로, TppReport.PrinterDevice에 할당하거나 TppPublisher의 publisher 디바이스로 사용하면 ReportBuilder의 디바이스 체인에 그대로 들어갑니다. DeviceName은 'HotPDF'로 보고됩니다. ReportBuilder에서 디바이스 등록은 ppRptDeviceMap을 통해 하며 RegisterComponents를 쓰지 않기 때문에 IDE 컴포넌트 팔레트 항목은 없으며, 호출자가 TppHotPDFDevice를 직접 인스턴스화합니다
TppGraphicsDevice.ReceivePage로 들어오는 각 페이지는 임시 TMetafileCanvas(BeforeRenderPage에서 생성하고 AfterRenderPage에서 마무리)에 그려집니다. 이렇게 캡처한 TMetafile을 HotPDF의 자동 스케일링 임포터 ShowEnhancedMetafile에 넘깁니다
1. StartJob creates the THotPDF instance, sets metadata, and calls BeginDoc.
2. BeforeRenderPage가 TMetafile을 spWidth x spHeight 크기로 만들고 TMetafileCanvas도 함께 만든 뒤, 이를 상속된 Canvas로 설정합니다
3. RenderPage(상속)가 DrawCommands를 순회하며 GraphicsContext를 거쳐 메타파일 캔버스로 전달합니다
4. AfterRenderPage가 메타파일을 마무리(캔버스 해제)하고 mmWidth x mmHeight(PDF 포인트로 변환) 크기의 새 HotPDF 페이지를 추가한 뒤, ShowEnhancedMetafile로 메타파일을 재생하거나 RenderMode가 hprmNativeDrawCommands이면 지원되는 그리기 명령을 네이티브로 출력합니다
5. EndJob이 HotPDF.EndDoc을 호출하고, 출력이 Stream이면 내부적으로 기록한 임시 파일의 바이트를 복사합니다
Properties
FileName - target PDF path. Used unless SetOutputStream has installed a stream.
Title / Author / Subject / Keywords - 문서 메타데이터입니다. Title이 비어 있으면 디바이스는 FileName으로 대체하므로 PDF에는 항상 비어 있지 않은 제목이 들어갑니다
PDFVersion - 문서가 대상으로 삼을 PDF 규격 수준입니다. 기본값은 pdf17입니다
PDFACompliance와 PDFXCompliance - HotPDF의 표준 준수 게이트를 생성되는 리포트 PDF로 전달합니다. 준수 여부를 최종적으로 주장하기 전에, 필요한 ICC 프로파일, OutputIntent, 태깅, 프리프레스 자산은 호출자가 통상적인 HotPDF 워크플로로 직접 준비해야 합니다
Compressed - HotPDF 스트림 압축 사용 여부입니다(기본값 True). 진단용 PDF에서는 False로 설정합니다
CompressionLevel - FlateDecode level. Defaults to clDefault.
RenderMode - 기존 시각적 브리지 방식인 hprmPageMetafile이 기본값입니다. hprmNativeDrawCommands로 설정하면 지원되는 ReportBuilder 그리기 명령을 HotPDF의 텍스트, 벡터, 이미지, URI 링크 작업으로 직접 매핑합니다. 지원되지 않는 명령이 들어 있는 페이지는 자동으로 메타파일 브리지로 대체됩니다
SetOutputStream(AStream) - PDF 바이트를 디스크에 쓰는 대신 AStream으로 보냅니다. 리포트가 StartJob을 발생시키기 전에 호출하십시오
Typical workflow
Dev := TppHotPDFDevice.Create(nil);
try
Dev.FileName := 'Report.pdf';
Dev.Title := 'Monthly Statement';
Dev.PDFVersion := pdf17;
Dev.PDFACompliance := '3B';
Dev.RenderMode := hprmNativeDrawCommands;
ppReport1.DeviceType := 'HotPDF';
ppReport1.PrinterDevice := Dev;
ppReport1.Print;
finally
Dev.Free;
end;
Capabilities preserved
ReportBuilder 표준 draw-command 파이프라인이 렌더링한 벡터 및 래스터 페이지 콘텐츠와 GDI로 해석된 텍스트 문자열입니다. 기본 200 DPI 메타파일 캡처(상속된 PixelsPerInch로 설정 가능)는 파일이 지나치게 커지지 않으면서 인쇄 품질을 제공합니다. 네이티브 draw-command 모드는 페이지에 지원되는 명령만 있을 때 일반적인 텍스트, 도형, 선, 이미지, URI 하이퍼링크 명령을 HotPDF 페이지 작업으로 직접 매핑합니다
메타파일 브리지의 제한 사항
페이지를 enhanced 메타파일로 캡처하기 때문에, 구조 정보가 필요한 ReportBuilder 고유 PDF 기능(AcroForm 필드, named destination, 아웃라인)은 전달되지 않습니다. PDF/A 및 PDF/X 게이트 속성은 HotPDF로 전달되지만, OutputIntent 프로파일 같은 표준별 자산은 여전히 호출자의 책임입니다
네이티브 draw-command 모드는 현재 ReportBuilder의 일반적인 그리기 명령 집합을 다루며, 복잡한 커스텀 렌더러나 그라데이션처럼 지원되지 않는 명령이 들어 있는 페이지는 의도적으로 메타파일 브리지로 대체합니다. 페이지를 일부만 출력하는 대신 시각적 결과를 그대로 보존하기 위해서입니다
Packaging note
이 디바이스는 Lib\Addons\ReportBuilder\에 있으며 주 패키지 HotPDF*.dpk에 포함되지 않으므로, ReportBuilder 의존성은 디바이스를 직접 사용하는 프로젝트에만 추가됩니다. 스모크 테스트(smoke_pp_hotpdf.dpr)는 이 유닛과 같은 위치에 있습니다
See also: TfrxHotPDFExport, TQRHotPDFExportFilter, dxHotPDFExportReportLink, THPDFPage.ShowMetafile, Enhanced EMF/WMF Support
|