#1 2015-01-02 07:48:52

mariomoretti
Member
From: italy
Registered: 2012-01-29
Posts: 88

synzip compress & uncompress

Bonjour AB and good 2015 !!
I'm troubling wirh pdf stream and synzip uncompress.
After many attempts i've done this test with compress and uncompress : the uncompress function returns Error -3 during zip/deflate process.
Perhaps i'm doing something wrong, but cannot understand where it is.

program testsynzip;

{$I Synopse.inc} 

uses
  {$I SynDprUses.inc}
  Forms,
  main in 'main.pas' {Form1};

{$R *.res}
{$R Vista.res}

begin
  Application.Initialize;
  Application.CreateForm(TForm1, Form1);
  Application.Run;
end.


unit main;

interface

uses
  Winapi.Windows,
  Winapi.Messages,
  System.SysUtils,
  System.Variants,
  System.Classes,
  Vcl.Graphics,
  Vcl.Controls,
  Vcl.Forms,
  Vcl.Dialogs,
  syncommons,
  synzip, Vcl.StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var si, s1, s2 : tHeapmemorystream;
    li, lo : integer;
begin
     si := tHeapMemoryStream.Create;
     s1 := tHeapMemoryStream.Create;
     s2 := tHeapMemoryStream.Create;
     si.LoadFromFile('main.pas');
     lo := compressstream(si.Memory, si.Size, s1, 7, true);
     s1.SaveToFile('main.zpd');
     li := uncompressstream(s1.Memory, s1.Size, s2, nil);
     s2.SaveToFile('main.cpy');
     s2.Free;
     s1.Free;
     si.Free;
end;

end.

Offline

#2 2015-01-02 08:01:44

mariomoretti
Member
From: italy
Registered: 2012-01-29
Posts: 88

Re: synzip compress & uncompress

P.S.
I'm using dephy XE4; synopse updated with  NightlyBuild.

Offline

#3 2015-01-02 11:48:32

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,183
Website

Re: synzip compress & uncompress

You should have written:

lo := compressstream(si.Memory, si.Size, s1, 7, FALSE);

Offline

#4 2015-01-02 11:55:26

mariomoretti
Member
From: italy
Registered: 2012-01-29
Posts: 88

Re: synzip compress & uncompress

Many tx AB,

so i can't use uncompress to deflate a pdf stream : is there a synzyp function that may I use ?

Offline

#5 2015-01-02 12:23:30

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,183
Website

Re: synzip compress & uncompress

You should be able to use both layouts now.

See http://synopse.info/fossil/info/166312002d

Offline

#6 2015-01-02 13:57:09

mariomoretti
Member
From: italy
Registered: 2012-01-29
Posts: 88

Re: synzip compress & uncompress

tx a lot AB !!!

Offline

Board footer

Powered by FluxBB