You are not logged in.
Pages: 1
Hello i've an Html File with some tables on it .
please how can i convert this html file into a PDF file using SynPdf library .
this's what i want as a pseudo code :
Procedure ConvertHtmlToPdf(AsourceHtMLFile,ATargetPDFFile:String);
var
lPdf : TPdfDocument;
lPage : TPdfPage;
begin
lPdf := TPdfDocument.Create;
try
lPdf.LoadFromFile(AsourceHtMLFile);//<--- this procedure doesn't exist just to show you what i want
//**
//**
lPdf.SaveToFile(ATargetPDFFile);
finally
lPdf.Free;
end;
end;
and here's an Html file sample :
http://img17.imageshack.us/img17/8859/htmlsample.png
Please is This possible ?.
many thanks , Randy
Hi , does SynZip support 7z archives ( in Com\Decompression operations ).?
if No then is there any other Alternative that can be used ( in both Operations ) with NO external DLL ?
Thank you Sir ab .
My Project is a Virtual File System , so the User will / can Use it with very huge files ** from 1 MB to 5 GB ** , so imagine a user is adding a file with 2 GB size and more imagine he wants to Compress / Encrypt it ; and as you know all these operations ( Compression+Encryption ) will be done on the Fly ...!!!!!
I did tests with the Current used Compression method and results were impressive mainly with Speed . that's why i was asked by ONE of my Clients to add the Encryption Feature ;
Encryption means each file added will be encrypted On the Fly .
I use this way :
function TFileHolder.CreateStorage(const ASourceFile: string;ACompressed:Boolean;AMode: Word): TStream;
begin
if (AMode and fmCreate = fmCreate) then
Begin
Case ACompressed of
True:
begin
// Create Compressed
Result := TFileContainer.Create(ASourceFile,True, fmCreate);// Store the Stream in TFileContainer +Compression Status
Result := TCompressStream.Create(Result, AMode,vclMax); // Compresse the Stream in TFileContainer
end;
False:
Result := TFileContainer.Create(ASourceFile,False, fmCreate);// Store the Stream in TFileContainer +Compression Status
end;
end
else
.
.
end;
Hi in my Project i use the Zlib Compression for En/DeCrypting Streams on the Fly :
This how i declare It .
type
TCompressionLevel = (clNone, clFastest, clDefault, clMax);
TMemStream = class(TMemoryStream);
TCompressStream = class(TStream)
private
FFStream: TStream;
FMStream: TStream;
FCompressionLevel: TCompressionLevel;
FMode:Word;
protected
procedure SetNewSize(NewSize: Longint); override;
public
constructor Create(const AFileStream: TStream; AMode: Word; CompressionLevel: TCompressionLevel); overload;
destructor Destroy; override;
function Read(var Buffer; Count: Longint): Longint; override;
function Write(const Buffer; Count: Longint): Longint; override;
function Seek(Offset: Longint; Origin: Word): Longint; override;
end;
//*
constructor TCompressStream.Create(const AFileStream: TStream; AMode: Word; CompressionLevel: TCompressionLevel);
var
Dcmp: TDecompressionStream;
begin
inherited Create;
FMode := Mode;
FCompressionLevel := CompressionLevel;
FFStream := AFileStream;
FMStream := TMemoryStream.Create;
if Mode and fmCreate = 0 then
begin
FMStream.Position := 0;
Dcmp := TDecompressionStream.Create(FFStream);
FMStream.CopyFrom(Dcmp, Dcmp.Size);
FMStream.Position := 0;
Dcmp.Free;
end;
end;
destructor TCompressStream.Destroy;
var
Ccmp: TCompressionStream;
begin
if (FMode and fmCreate = fmCreate) or (FMode and fmOpenWrite = fmOpenWrite) then
begin
FFStream.Position := 0;
FMStream.Position := 0;
Ccmp := TCompressionStream.Create(TCompressionLevel(FCompressionLevel),FFStream);
Ccmp.CopyFrom(FMStream, FMStream.Size);
Ccmp.Free;
end;
If Assigned(FMStream) Then FreeAndNil(FMStream);
If Assigned(FFStream) Then FreeAndNil(FFStream);
inherited;
end;
function TCompressStream.Seek(Offset: Longint; Origin: Word): Longint;
begin
Result := FMStream.Seek(Offset, Origin);
end;
procedure TCompressStream.SetNewSize(NewSize: Integer);
begin
TMemStream(FMStream).SetNewSize(NewSize);
end;
function TCompressStream.Read(var Buffer; Count: Integer): Longint;
begin
Result :=FMStream.Read(Buffer, Count);
end;
function TCompressStream.Write(const Buffer; Count: Integer): Longint;
begin
Result := FMStream.Write(Buffer, Count);
end;
My Question is : How could i use the SynCrypto TAESWriteStream the Same Way .
Because the User will be asked either to Compress or Encrypt his File or Both .
many thanks
Pages: 1