source upload
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
program SynPdfFormCanvas;
|
||||
|
||||
{$APPTYPE CONSOLE}
|
||||
|
||||
uses
|
||||
{$I SynDprUses.inc} // use FastMM4 on older Delphi, or set FPC threads
|
||||
SysUtils,
|
||||
Math,
|
||||
DateUtils,
|
||||
SynCommons,
|
||||
SynPDF;
|
||||
|
||||
const
|
||||
PDFFactor: Single = 72.0 / 2.54;
|
||||
|
||||
var
|
||||
obPDF: TPdfDocument;
|
||||
obFormCanvas: TPdfFormWithCanvas;
|
||||
|
||||
begin
|
||||
obPDF := TPdfDocument.Create(false,0,false);
|
||||
obPDF.GeneratePDF15File := true;
|
||||
obPDF.DefaultPaperSize := psA4;
|
||||
obPDF.DefaultPageLandscape := false;
|
||||
obPDF.CompressionMethod := cmFlateDecode;
|
||||
|
||||
obFormCanvas := TPdfFormWithCanvas.Create(obPDF,Trunc(5.0*PDFFactor),Trunc(5.0*PDFFactor));
|
||||
obPDF.AddXObject('FORMOBJECT',obFormCanvas);
|
||||
|
||||
obFormCanvas.Canvas.SetTextRenderingMode(trFill);
|
||||
obFormCanvas.Canvas.SetFont('Arial',10.0,[]);
|
||||
|
||||
obFormCanvas.Canvas.SetLineWidth(0.01*PDFFactor);
|
||||
|
||||
obFormCanvas.Canvas.Rectangle(0.0*PDFFactor,0.0*PDFFactor,4.9*PDFFactor,4.9*PDFFactor);
|
||||
obFormCanvas.Canvas.Stroke;
|
||||
|
||||
obFormCanvas.Canvas.TextOut(1.0*PDFFactor,2.5*PDFFactor,'form text');
|
||||
|
||||
obFormCanvas.CloseCanvas;
|
||||
|
||||
obPDF.AddPage;
|
||||
|
||||
obPDF.Canvas.SetTextRenderingMode(trFill);
|
||||
obPDF.Canvas.SetFont('Arial',10.0,[]);
|
||||
|
||||
obPDF.Canvas.SetLineWidth(0.01*PDFFactor);
|
||||
|
||||
obPDF.Canvas.Rectangle(1.0*PDFFactor,1.0*PDFFactor,19.0*PDFFactor,27.9*PDFFactor);
|
||||
obPDF.Canvas.Stroke;
|
||||
|
||||
obPDF.Canvas.TextOut(2.0*PDFFactor,27.0*PDFFactor,'XObject form canvas sample');
|
||||
|
||||
obPDF.Canvas.DrawXObject(2.0*PDFFactor,5.0*PDFFactor,1.0,1.0,'FORMOBJECT');
|
||||
obPDF.Canvas.DrawXObject(10.0*PDFFactor,10.0*PDFFactor,1.0,0.5,'FORMOBJECT');
|
||||
obPDF.Canvas.DrawXObject(8.0*PDFFactor,15.0*PDFFactor,2.0,2.0,'FORMOBJECT');
|
||||
obPDF.Canvas.DrawXObject(2.0*PDFFactor,20.0*PDFFactor,0.5,1.0,'FORMOBJECT');
|
||||
|
||||
obPDF.SaveToFile(ChangeFileExt(ExeVersion.ProgramFileName,'.pdf'));
|
||||
|
||||
FreeAndNil(obPDF);
|
||||
end.
|
@@ -0,0 +1,133 @@
|
||||
program SynPdfLayers;
|
||||
|
||||
{$APPTYPE CONSOLE}
|
||||
|
||||
uses
|
||||
{$I SynDprUses.inc} // use FastMM4 on older Delphi, or set FPC threads
|
||||
SysUtils,
|
||||
Math,
|
||||
DateUtils,
|
||||
SynCommons,
|
||||
SynPDF;
|
||||
|
||||
const
|
||||
PDFFactor: Single = 72.0 / 2.54;
|
||||
|
||||
var
|
||||
obPDF: TPdfDocument;
|
||||
|
||||
obMainLayer1: TPdfOptionalContentGroup;
|
||||
obMainLayer2: TPdfOptionalContentGroup;
|
||||
obMainLayer3: TPdfOptionalContentGroup;
|
||||
|
||||
obSubLayer1: TPdfOptionalContentGroup;
|
||||
obSubLayer2: TPdfOptionalContentGroup;
|
||||
obSubLayer3: TPdfOptionalContentGroup;
|
||||
|
||||
obSubSubLayer1: TPdfOptionalContentGroup;
|
||||
obSubSubLayer2: TPdfOptionalContentGroup;
|
||||
|
||||
obRadioLayer1: TPdfOptionalContentGroup;
|
||||
obRadioLayer2: TPdfOptionalContentGroup;
|
||||
obRadioLayer3: TPdfOptionalContentGroup;
|
||||
|
||||
|
||||
begin
|
||||
obPDF := TPdfDocument.Create(false,0,false);
|
||||
obPDF.UseOptionalContent := true;
|
||||
obPDF.DefaultPaperSize := psA4;
|
||||
obPDF.DefaultPageLandscape := true;
|
||||
obPDF.CompressionMethod := cmFlateDecode;
|
||||
|
||||
obMainLayer1 := obPDF.CreateOptionalContentGroup(nil,'Main Layer 1',true);
|
||||
obMainLayer2 := obPDF.CreateOptionalContentGroup(nil,'Main Layer 2',true);
|
||||
obMainLayer3 := obPDF.CreateOptionalContentGroup(nil,'Main Layer 3',true);
|
||||
|
||||
obSubLayer1 := obPDF.CreateOptionalContentGroup(obMainLayer1,'Sub Layer 1',true);
|
||||
obSubLayer2 := obPDF.CreateOptionalContentGroup(obMainLayer1,'Sub Layer 2',true);
|
||||
obSubLayer3 := obPDF.CreateOptionalContentGroup(obMainLayer1,'Sub Layer 3',true);
|
||||
|
||||
obSubSubLayer1 := obPDF.CreateOptionalContentGroup(obSubLayer1,'Sub Sub Layer 1',false);
|
||||
obSubSubLayer2 := obPDF.CreateOptionalContentGroup(obSubLayer1,'Sub Sub Layer 2',false);
|
||||
|
||||
obRadioLayer1 := obPDF.CreateOptionalContentGroup(obMainLayer2,'Radio Layer 1',true);
|
||||
obRadioLayer2 := obPDF.CreateOptionalContentGroup(obMainLayer2,'Radio Layer 2',false);
|
||||
obRadioLayer3 := obPDF.CreateOptionalContentGroup(obMainLayer2,'Radio Layer 3',false);
|
||||
|
||||
// to use the main layers as radios uncomment following line and set only main layer 1 to visible (line 40ff)
|
||||
//obPDF.CreateOptionalContentRadioGroup([obMainLayer1,obMainLayer2,obMainLayer3]);
|
||||
|
||||
obPDF.CreateOptionalContentRadioGroup([obRadioLayer1,obRadioLayer2,obRadioLayer3]);
|
||||
|
||||
obPDF.AddPage;
|
||||
|
||||
obPDF.Canvas.SetTextRenderingMode(trFill);
|
||||
obPDF.Canvas.SetFont('Arial',10.0,[]);
|
||||
obPDF.Canvas.SetLineWidth(0.01*PDFFactor);
|
||||
|
||||
obPDF.Canvas.Rectangle(1.0*PDFFactor,1.0*PDFFactor,27.7*PDFFactor,19.0*PDFFactor);
|
||||
obPDF.Canvas.Stroke;
|
||||
|
||||
obPDF.Canvas.TextOut(2.0*PDFFactor,17.0*PDFFactor,'Main Layer 1:');
|
||||
|
||||
obPDF.Canvas.BeginMarkedContent(obMainLayer1);
|
||||
begin
|
||||
obPDF.Canvas.TextOut(10.0*PDFFactor,17.0*PDFFactor,'Text visible in Main Layer 1');
|
||||
|
||||
obPDF.Canvas.BeginMarkedContent(obSubLayer1);
|
||||
begin
|
||||
obPDF.Canvas.TextOut(10.0*PDFFactor,15.0*PDFFactor,'Text visible in Sub Layer 1');
|
||||
|
||||
obPDF.Canvas.BeginMarkedContent(obSubSubLayer1);
|
||||
obPDF.Canvas.TextOut(15.0*PDFFactor,15.0*PDFFactor,'Text visible in Sub Sub Layer 1');
|
||||
obPDF.Canvas.EndMarkedContent;
|
||||
|
||||
obPDF.Canvas.BeginMarkedContent(obSubSubLayer2);
|
||||
obPDF.Canvas.TextOut(22.0*PDFFactor,15.0*PDFFactor,'Text visible in Sub Sub Layer 2');
|
||||
obPDF.Canvas.EndMarkedContent;
|
||||
end;
|
||||
obPDF.Canvas.EndMarkedContent;
|
||||
|
||||
obPDF.Canvas.BeginMarkedContent(obSubLayer2);
|
||||
begin
|
||||
obPDF.Canvas.TextOut(10.0*PDFFactor,14.0*PDFFactor,'Text visible in Sub Layer 2');
|
||||
end;
|
||||
obPDF.Canvas.EndMarkedContent;
|
||||
|
||||
obPDF.Canvas.BeginMarkedContent(obSubLayer3);
|
||||
obPDF.Canvas.TextOut(10.0*PDFFactor,13.0*PDFFactor,'Text visible in Sub Layer 3');
|
||||
obPDF.Canvas.EndMarkedContent;
|
||||
end;
|
||||
obPDF.Canvas.EndMarkedContent;
|
||||
|
||||
|
||||
obPDF.Canvas.TextOut(2.0*PDFFactor,10.0*PDFFactor,'Main Layer 2:');
|
||||
|
||||
obPDF.Canvas.BeginMarkedContent(obMainLayer2);
|
||||
begin
|
||||
obPDF.Canvas.TextOut(10.0*PDFFactor,10.0*PDFFactor,'Text visible in Main Layer 2');
|
||||
|
||||
obPDF.Canvas.BeginMarkedContent(obRadioLayer1);
|
||||
obPDF.Canvas.TextOut(10.0*PDFFactor,8.0*PDFFactor,'Text visible in Radio Layer 1');
|
||||
obPDF.Canvas.EndMarkedContent;
|
||||
|
||||
obPDF.Canvas.BeginMarkedContent(obRadioLayer2);
|
||||
obPDF.Canvas.TextOut(10.0*PDFFactor,7.0*PDFFactor,'Text visible in Radio Layer 2');
|
||||
obPDF.Canvas.EndMarkedContent;
|
||||
|
||||
obPDF.Canvas.BeginMarkedContent(obRadioLayer3);
|
||||
obPDF.Canvas.TextOut(10.0*PDFFactor,6.0*PDFFactor,'Text visible in Radio Layer 3');
|
||||
obPDF.Canvas.EndMarkedContent;
|
||||
end;
|
||||
obPDF.Canvas.EndMarkedContent;
|
||||
|
||||
obPDF.Canvas.TextOut(2.0*PDFFactor,2.0*PDFFactor,'Main Layer 3:');
|
||||
|
||||
obPDF.Canvas.BeginMarkedContent(obMainLayer3);
|
||||
obPDF.Canvas.TextOut(10.0*PDFFactor,2.0*PDFFactor,'Text visible in Main Layer 3');
|
||||
obPDF.Canvas.EndMarkedContent;
|
||||
|
||||
obPDF.SaveToFile(ChangeFileExt(ExeVersion.ProgramFileName,'.pdf'));
|
||||
|
||||
FreeAndNil(obPDF);
|
||||
end.
|
@@ -0,0 +1,14 @@
|
||||
program TestSQLite3Pages;
|
||||
|
||||
uses
|
||||
{$I SynDprUses.inc} // use FastMM4 on older Delphi, or set FPC threads
|
||||
Forms,
|
||||
Unit1 in 'Unit1.pas' {Form1};
|
||||
|
||||
{$R *.res}
|
||||
|
||||
begin
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TForm1, Form1);
|
||||
Application.Run;
|
||||
end.
|
Binary file not shown.
@@ -0,0 +1,86 @@
|
||||
object Form1: TForm1
|
||||
Left = 258
|
||||
Top = 211
|
||||
Width = 338
|
||||
Height = 356
|
||||
Caption = ' SQLite3Pages Test'
|
||||
Color = clBtnFace
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
OldCreateOrder = False
|
||||
OnShow = FormShow
|
||||
PixelsPerInch = 96
|
||||
TextHeight = 13
|
||||
object lbl1: TLabel
|
||||
Left = 32
|
||||
Top = 16
|
||||
Width = 62
|
||||
Height = 13
|
||||
Caption = 'Enter a Title:'
|
||||
end
|
||||
object Label1: TLabel
|
||||
Left = 32
|
||||
Top = 80
|
||||
Width = 81
|
||||
Height = 13
|
||||
Caption = 'Enter some text:'
|
||||
end
|
||||
object edt1: TEdit
|
||||
Left = 32
|
||||
Top = 32
|
||||
Width = 233
|
||||
Height = 21
|
||||
TabOrder = 0
|
||||
Text = 'This is a Title from a field'
|
||||
end
|
||||
object mmo1: TMemo
|
||||
Left = 32
|
||||
Top = 96
|
||||
Width = 233
|
||||
Height = 153
|
||||
Lines.Strings = (
|
||||
|
||||
'In our Synopse SQLite3 framework there is a very easy Open Sourc' +
|
||||
'e reporting system.'
|
||||
''
|
||||
|
||||
'You create your report from code, then you can preview it on the' +
|
||||
' screen.'
|
||||
'You can then print or export the report as PDF.'
|
||||
''
|
||||
'Just right click on the report preview to see options.')
|
||||
ScrollBars = ssVertical
|
||||
TabOrder = 1
|
||||
WordWrap = False
|
||||
end
|
||||
object btn1: TButton
|
||||
Left = 32
|
||||
Top = 264
|
||||
Width = 113
|
||||
Height = 33
|
||||
Caption = 'Create Report'
|
||||
TabOrder = 2
|
||||
OnClick = btn1Click
|
||||
end
|
||||
object btn2: TButton
|
||||
Left = 152
|
||||
Top = 264
|
||||
Width = 113
|
||||
Height = 33
|
||||
Caption = 'Quit'
|
||||
TabOrder = 3
|
||||
OnClick = btn2Click
|
||||
end
|
||||
object Button1: TButton
|
||||
Left = 208
|
||||
Top = 56
|
||||
Width = 75
|
||||
Height = 25
|
||||
Caption = 'Button1'
|
||||
TabOrder = 4
|
||||
OnClick = Button1Click
|
||||
end
|
||||
end
|
@@ -0,0 +1,336 @@
|
||||
unit Unit1;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||||
Dialogs, StdCtrls, ShellApi, Printers,
|
||||
SynCommons, SynPdf, mORMotReport;
|
||||
|
||||
type
|
||||
TForm1 = class(TForm)
|
||||
edt1: TEdit;
|
||||
lbl1: TLabel;
|
||||
Label1: TLabel;
|
||||
mmo1: TMemo;
|
||||
btn1: TButton;
|
||||
btn2: TButton;
|
||||
Button1: TButton;
|
||||
procedure btn2Click(Sender: TObject);
|
||||
procedure btn1Click(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure Button1Click(Sender: TObject);
|
||||
private
|
||||
{ Private declarations }
|
||||
public
|
||||
{ Public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
Form1: TForm1;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.dfm}
|
||||
{$R vista.RES} // includes Win10 manifest - use .RES for linux cross-compilation
|
||||
|
||||
procedure TForm1.btn2Click(Sender: TObject);
|
||||
begin
|
||||
Close;
|
||||
end;
|
||||
|
||||
const
|
||||
UNICODE: array[0..5] of WideChar =
|
||||
(#27161,#28310,#33836,#22283,#30908,#0);
|
||||
procedure TForm1.btn1Click(Sender: TObject);
|
||||
var Bmp: TBitmap;
|
||||
U: RawUTF8;
|
||||
s: string;
|
||||
i: integer;
|
||||
{ R, Marg: TRect;
|
||||
iz: TSize;
|
||||
M: TMetaFile;}
|
||||
begin
|
||||
Bmp := TBitmap.Create;
|
||||
try
|
||||
Bmp.Width := ClientWidth;
|
||||
Bmp.Height := ClientHeight;
|
||||
PaintTo(Bmp.Canvas,0,0); // create some bitmap content
|
||||
with TGDIPages.Create(self) do
|
||||
try
|
||||
// the name of the report is taken from main Window's caption
|
||||
Caption := self.Caption;
|
||||
//Orientation := poLandscape;
|
||||
// now we add some content to the report
|
||||
BeginDoc;
|
||||
{
|
||||
M := TMetaFile.Create;
|
||||
M.LoadFromFile('emf1.emf');
|
||||
Siz := PaperSize;
|
||||
Marg := PageMargins;
|
||||
R.Left := Marg.Left;
|
||||
R.Right := Siz.cx-Marg.Right;
|
||||
R.Top := Marg.Top;
|
||||
R.Bottom := Siz.cy-Marg.Top;
|
||||
DrawMeta(R,M);
|
||||
M.Free;
|
||||
}
|
||||
|
||||
// header and footer
|
||||
Font.Name := 'Georgia';
|
||||
//Font.Name := 'Arial Unicode MS';
|
||||
Font.Size := 11;
|
||||
SaveLayout;
|
||||
Font.Style := [fsItalic,fsUnderline];
|
||||
TextAlign := taRight;
|
||||
AddTextToHeaderAt('http://synopse.info',RightMarginPos);
|
||||
Font.Style := [];
|
||||
AddLineToFooter(false);
|
||||
AddPagesToFooterAt(sPageN,RightMarginPos);
|
||||
RestoreSavedLayout;
|
||||
AddTextToHeader(ExeVersion.ProgramName);
|
||||
AddTextToFooter(DateTimeToStr(Now));
|
||||
AddLineToHeader(false);
|
||||
Font.Size := 12;
|
||||
ExportPDFForceJPEGCompression := 0;
|
||||
|
||||
{ // test
|
||||
WordWrapLeftCols := true;
|
||||
AddColumns([10,22,22,22,22]);
|
||||
AddColumnHeaders(['#','Two','Three','4','5'],true,true);
|
||||
for i := 1 to 50 do
|
||||
DrawTextAcrossCols([IntToStr(i),'Column '+IntToStr(i),
|
||||
'This is some big text which must be justified on multiple lines. Text "four" and "five" will be invisible in pdf...',
|
||||
'four','five']);
|
||||
EndDoc;
|
||||
ExportPDF('cells.pdf',True,True);}
|
||||
|
||||
// main content (automaticaly split on next pages)
|
||||
NewHalfLine;
|
||||
TextAlign := taJustified;
|
||||
U := RawUnicodeToUtf8(UNICODE,StrLenW(UNICODE));
|
||||
U := 'This is some big '+U+' text which must be justified on multiple lines. ';
|
||||
U := U+U+U+U;
|
||||
DrawTextU(U);
|
||||
NewLine;
|
||||
TextAlign := taLeft;
|
||||
DrawTitle(edt1.Text,true);
|
||||
for i := 1 to 10 do
|
||||
DrawText('This is some text '+IntToStr(i));
|
||||
NewLine;
|
||||
DrawBMP(Bmp,maxInt,50,'Some bitmap in the report');
|
||||
AddBookMark('bookmarkname');
|
||||
WordWrapLeftCols := true;
|
||||
AddColumns([10,20,50]);
|
||||
AddColumnHeaders(['#','Two','Three'],true,true);
|
||||
for i := 1 to 100 do
|
||||
DrawTextAcrossCols([IntToStr(i),'Column '+IntToStr(i),'Some text here. '+s]);
|
||||
NewLine;
|
||||
DrawBMP(Bmp,maxInt,50,'Some bitmap in the report (twice)');
|
||||
DrawTitle('This is your text',false,0,'','bookmarkname');
|
||||
DrawText(mmo1.Text);
|
||||
|
||||
EndDoc;
|
||||
ForceInternalAntiAliasedFontFallBack := true;
|
||||
ForceNoAntiAliased := true;
|
||||
//ForceInternalAntiAliased := false;
|
||||
ExportPDFAuthor := 'A.Bouchez';
|
||||
ExportPDFSubject := 'This is some sample file';
|
||||
// set optional PDF export options
|
||||
// ExportPDFForceJPEGCompression := 80;
|
||||
// ExportPDFEmbeddedTTF := true;
|
||||
// ExportPDFUseUniscribe := true;
|
||||
// ExportPDFA1 := true;
|
||||
//ExportPDF('test.pdf',true,true); close; exit;
|
||||
// show a preview form, and allow basic actions via corresponding buttons
|
||||
// ForceInternalAntiAliased := true;
|
||||
// ForceInternalAntiAliasedFontFallBack := true;
|
||||
ShowPreviewForm;
|
||||
|
||||
finally
|
||||
Free;
|
||||
end;
|
||||
finally
|
||||
Bmp.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
procedure TForm1.FormShow(Sender: TObject);
|
||||
var FN: TFileName;
|
||||
M: TMetaFile;
|
||||
i: integer;
|
||||
begin
|
||||
exit;
|
||||
//btn1Click(nil); Close; exit;
|
||||
//Button1Click(nil); Close; exit;
|
||||
with TPdfDocument.Create do
|
||||
try
|
||||
for i := 0 to 24 do begin
|
||||
AddPage;
|
||||
M := TMetaFile.Create;
|
||||
M.LoadFromFile(IntToStr(i)+'.emf');
|
||||
Canvas.RenderMetaFile(M,Canvas.Page.PageHeight/M.Height*1.3);
|
||||
M.Free;
|
||||
end;
|
||||
{ AddPage;
|
||||
with Canvas do
|
||||
begin
|
||||
SetFont('Arial',12,[fsBold]);
|
||||
TextOut(100,500,'Test');
|
||||
MoveTo(100,400);
|
||||
LineTo(500,500);
|
||||
Stroke;
|
||||
end; }
|
||||
FN := ChangeFileExt(ExeVersion.ProgramFileName,'.pdf');
|
||||
SaveToFile(FN);
|
||||
ShellExecute(Handle,nil,pointer(FN),nil,nil,SW_SHOWNORMAL);
|
||||
finally
|
||||
Free;
|
||||
end;
|
||||
Close;
|
||||
end;
|
||||
|
||||
procedure TForm1.Button1Click(Sender: TObject);
|
||||
var
|
||||
i, y: integer;
|
||||
TestImage: TBitmap;
|
||||
Stream: TStream;
|
||||
MF: TMetaFile;
|
||||
R: TRect;
|
||||
begin
|
||||
if false then
|
||||
with TGDIPages.Create(self) do
|
||||
try
|
||||
BeginDoc;
|
||||
MF := TMetafile.Create;
|
||||
MF.LoadFromFile('d:\download\Sample (1).emf');
|
||||
DrawGraphic(MF,0,PaperSize.cx-20);
|
||||
{ for y := 0 to 4 do
|
||||
begin
|
||||
|
||||
DrawTitle(edt1.Text, true);
|
||||
for i := 1 to 10 do
|
||||
DrawText('This is some text ' + IntToStr(i));
|
||||
NewLine;
|
||||
|
||||
TestImage := TBitmap.Create;
|
||||
try
|
||||
TestImage.Width := 500;
|
||||
TestImage.Height := 500;
|
||||
|
||||
TestImage.Canvas.Pen.Color := clRed;
|
||||
TestImage.Canvas.MoveTo(0, y * 80);
|
||||
TestImage.Canvas.LineTo(TestImage.Width, y * 80);
|
||||
|
||||
DrawBMP(TestImage, maxInt, RightMarginPos);
|
||||
finally
|
||||
TestImage.Free;
|
||||
end;
|
||||
|
||||
NewPage;
|
||||
end;}
|
||||
|
||||
EndDoc;
|
||||
ForceInternalAntiAliased := true;
|
||||
ForceInternalAntiAliasedFontFallBack := true;
|
||||
ExportPDFGeneratePDF15File := true;
|
||||
ExportPDFUseUniscribe := true;
|
||||
ShowPreviewForm;
|
||||
//ExportPDF('test.pdf', true, true);
|
||||
finally
|
||||
Free;
|
||||
end
|
||||
else
|
||||
if false then
|
||||
with TPdfDocumentGDI.Create do
|
||||
try
|
||||
Stream := TFileStream.Create(ExeVersion.ProgramFilePath + 'streamdirect.pdf', fmCreate);
|
||||
try
|
||||
SaveToStreamDirectBegin(Stream);
|
||||
for i := 1 to 9 do
|
||||
begin
|
||||
AddPage;
|
||||
with VCLCanvas do
|
||||
begin
|
||||
Font.Name := 'Times new roman';
|
||||
Font.Size := 120;
|
||||
Font.Style := [fsBold, fsItalic];
|
||||
Font.Color := clNavy;
|
||||
TextOut(100, 100, 'Page ' + IntToStr(i));
|
||||
end;
|
||||
SaveToStreamDirectPageFlush; // direct writing
|
||||
end;
|
||||
SaveToStreamDirectEnd;
|
||||
finally
|
||||
Stream.Free;
|
||||
end;
|
||||
finally
|
||||
Free;
|
||||
end
|
||||
else
|
||||
with TPdfDocumentGDI.Create do
|
||||
try
|
||||
for i := 1 to 9 do
|
||||
begin
|
||||
AddPage;
|
||||
with VCLCanvas do
|
||||
begin
|
||||
Font.Name := 'Times new roman';
|
||||
Font.Size := 120;
|
||||
Font.Style := [fsBold, fsItalic];
|
||||
Font.Color := clNavy;
|
||||
TextOut(100, 100, 'Page ' + IntToStr(i));
|
||||
end;
|
||||
end;
|
||||
SaveToFile(ExeVersion.ProgramFilePath + 'multipages.pdf');
|
||||
finally
|
||||
Free;
|
||||
end;
|
||||
end;
|
||||
{
|
||||
var
|
||||
xRect: TRect;
|
||||
const
|
||||
Text: WideString = 'RERERERE:';
|
||||
begin
|
||||
with TPdfDocumentGDI.Create do
|
||||
try
|
||||
PDFA1 := true;
|
||||
AddPage;
|
||||
UseUniScribe := false; //uniscribe does not change anything about the problem
|
||||
with VCLCanvas do begin
|
||||
Font.Name := 'Tahoma';
|
||||
Font.Size := 8;
|
||||
Font.Style := [fsBold];
|
||||
Pen.Color := $AAAAAA;
|
||||
|
||||
xRect := Rect(0, 0, TextWidth(Text), TextHeight(Text));
|
||||
OffsetRect(xRect, 100, 100);
|
||||
|
||||
Rectangle(xRect);
|
||||
|
||||
Windows.ExtTextOutW(Handle, xRect.Left, xRect.Top, ETO_CLIPPED,
|
||||
@xRect, PWideChar(Text), Length(Text), nil);
|
||||
|
||||
Font.Size := 24;
|
||||
|
||||
xRect := Rect(0, 0, TextWidth(Text), TextHeight(Text));
|
||||
OffsetRect(xRect, 100, 200);
|
||||
|
||||
Rectangle(xRect);
|
||||
|
||||
Windows.ExtTextOutW(Handle, xRect.Left, xRect.Top, ETO_CLIPPED,
|
||||
@xRect, PWideChar(Text), Length(Text), nil);
|
||||
|
||||
end;
|
||||
SaveToFile('TestVcl.pdf');
|
||||
ShellExecute(Handle,nil,'TestVcl.pdf',nil,nil,SW_SHOWNORMAL);
|
||||
finally
|
||||
Free;
|
||||
end;
|
||||
end;
|
||||
}
|
||||
|
||||
end.
|
||||
|
Reference in New Issue
Block a user