From 6eb18a2d11cf04fe07b1c9ac282357f40a5f3bec Mon Sep 17 00:00:00 2001 From: wp_xyz Date: Fri, 8 Sep 2023 12:02:50 +0200 Subject: [PATCH] fpvectorial: Extend fpvtextwritetest2 to optionally use pdfwriter. --- .../fpvtextwritetest2/fpvtextwritetest2.lpi | 7 +------ .../fpvtextwritetest2/fpvtextwritetest2.pas | 15 +++++++++++---- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/components/fpvectorial/examples/fpvtextwritetest2/fpvtextwritetest2.lpi b/components/fpvectorial/examples/fpvtextwritetest2/fpvtextwritetest2.lpi index d348dbb823..8386b0adf1 100644 --- a/components/fpvectorial/examples/fpvtextwritetest2/fpvtextwritetest2.lpi +++ b/components/fpvectorial/examples/fpvtextwritetest2/fpvtextwritetest2.lpi @@ -35,15 +35,11 @@ - + - - - - @@ -54,7 +50,6 @@ - diff --git a/components/fpvectorial/examples/fpvtextwritetest2/fpvtextwritetest2.pas b/components/fpvectorial/examples/fpvtextwritetest2/fpvtextwritetest2.pas index f1f8833807..9e15e0f06f 100644 --- a/components/fpvectorial/examples/fpvtextwritetest2/fpvtextwritetest2.pas +++ b/components/fpvectorial/examples/fpvtextwritetest2/fpvtextwritetest2.pas @@ -9,11 +9,11 @@ License: Public Domain Program fpvtextwritetest2; {$mode objfpc}{$H+} +{.$define pdf_test} Uses fpvectorial, - odtvectorialwriter, - docxvectorialwriter, + odtvectorialwriter, docxvectorialwriter, {$ifdef pdf_test}pdfvectorialwriter,{$endif} fpvutils, SysUtils, FPImage; @@ -153,6 +153,7 @@ Begin CurParagraph.AddText('Lazarus ').Style := BoldTextStyle; CurParagraph.AddText('features:'); + {$ifndef pdf_test} // Simple List List := Page.AddList(); List.Style := ListParaStyle; @@ -171,12 +172,12 @@ Begin List.AddParagraph('Text resource manager for internationalization'); List.AddParagraph('Automatic code formatting'); List.AddParagraph('The ability to create custom components'); + {$endif} // Empty line CurParagraph := Page.AddParagraph(); CurParagraph.Style := Vec.StyleTextBody; - // Second page sequence Page := Vec.AddTextPageSequence(); Page.Height := 210; // Switched to enforce Landscape @@ -192,7 +193,6 @@ Begin CurParagraph.Style := Vec.StyleHeading2; CurParagraph.AddText('Testing Strings'); - // Test for XML tags CurParagraph := Page.AddParagraph(); CurParagraph.Style := Vec.StyleTextBody; @@ -243,6 +243,7 @@ Begin CurText := CurParagraph.AddText('Testing Lists'); // Indented numbered List + {$ifndef pdf_test} List := Page.AddList(); List.Style := ListParaStyle; List.ListStyle := Vec.StyleNumberList; @@ -282,6 +283,7 @@ Begin SubList.AddParagraph('Bullet Level 2, Item 1 (new SubList added to same upper List)'); SubList.AddParagraph('Bullet Level 2, Item 2 (new SubList added to same upper List)'); SubList.AddParagraph('Bullet Level 2, Item 3 (new SubList added to same upper List)'); + {$endif} // Third page sequence Page := Vec.AddTextPageSequence(); @@ -499,6 +501,11 @@ Begin Vec.WriteToFile('text_output_odt', vfODT); WriteLn('Native odt writer: '+Format('%.1f msec', [24*60*60*1000*(Now-dtTime)])); + {$ifdef pdf_test} + dtTime := Now; + Vec.WriteToFile('text_output_pdf', vfPDF); + WriteLn('Native pdf writer: '+Format('%.1f msec', [24*60*60*1000*(Now-dtTime)])); + {$endif} Finally Vec.Free;