Bug : PrintPreview v4.72

Please post bug reports, feature requests, or any question regarding the DELPHI AREA products here.

Bug : PrintPreview v4.72

Postby akeix » April 23rd, 2007, 9:25 pm

Good evening,

I am French. Excuse me for my English.

PrintPreview does not take account of the orientation of paper to create file pdf.

In portrait, there is no problem.
In landscape, the PDF file is created in portrait.


I modified the SaveAsPdf function but that functions only on the first page.
Here modification:

Code: Select all
procedure TPrintPreview.SaveAsPDF(const FileName: String);
var
  I: Integer;
  Mem: TMemoryStream;
begin
  if dsPDF.Handle > 0 then
  begin
    dsPDF.BeginDoc(PChar(FileName));
    try



      if  FOrientation = poPortrait then
        dsPDF.SetPage(2, 0, 0, 0)
      else
        dsPDF.SetPage(2, 1, 0, 0);



      Mem := TMemoryStream.Create;
      try
        for I := 1 to TotalPages do
        begin
          if I > 1 then
            dsPDF.NewPage;
          Mem.Clear;
          Pages[I].SaveToStream(Mem);
          dsPDF.PrintPageMemory(Mem.Memory, Mem.Size);
        end;
      finally
        Mem.Free;
      end;
    finally
      dsPDF.EndDoc;
    end;
  end
  else
    raise EMissingPDFLibrary.Create('Cannot locate ' + dsPDF_lib);
end;



I am not an expert in Delphi. I make especially C or of C++.

I use the version demonstration of dspdf.dll.

Thank you for this component.

Akeix
akeix
Active Member
Active Member
 
Posts: 7
Joined: January 14th, 2004, 2:12 pm
Location: France

Postby Kambiz » April 23rd, 2007, 10:10 pm

Thank you very much for informing this issue.

The problem is lack of documentation of dspdf. I'll contact the author for the correct usage of the functions.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2408
Joined: March 7th, 2003, 7:10 pm

Postby Kambiz » April 23rd, 2007, 10:31 pm

Hopefully it fixed easily.
The update is available to download.

Thank you!
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2408
Joined: March 7th, 2003, 7:10 pm

Postby akeix » April 25th, 2007, 4:48 am

Hello,

I downloaded the new version of PrintPreview (4.73).
I looked at the modification which you made.
in fact, it was very simple. :D
I will have to think of it.

Thank you for this marvellous component.

Akeix
akeix
Active Member
Active Member
 
Posts: 7
Joined: January 14th, 2004, 2:12 pm
Location: France

Postby DwrCymru » April 27th, 2007, 11:11 am

If anyone is interested I wrote a function that returns the "ps" value for some of the "TPaperType" used in the print preview.

Code: Select all
Function PaperTypeToPDFPageSize(Const PaperType : TPaperType) : Integer;
 begin

   Case PaperType of
     pCustom     : Result := 00;
     pLetter     : Result := 01;
     pLegal      : Result := 04;
     pExecutive  : Result := 11;
     pA3         : Result := 03;
     pA4         : Result := 02;
     pA5         : Result := 09;
     pB4         : Result := 08;
     pB5         : Result := 05;
     pFolio      : Result := 10;
     pEnvDL      : Result := 15;
     pEnvB4      : Result := 12;
     pEnvB5      : Result := 13;
     pEnvMonarch : Result := 16;

    else

       Result := 0; // Default to custom

   end;
end; // PaperTypeToPDFPageSize


in the "SaveAsPDF" I changed the "dsSetPage" to :

Code: Select all
dsPDF.SetPage(PaperTypeToPDFPageSize(PaperType), Ord(Orientation), PaperWidth, PaperHeight);


Feel free to use the code.

Dave
DwrCymru
Active Member
Active Member
 
Posts: 8
Joined: April 27th, 2007, 11:02 am

Postby Kambiz » April 27th, 2007, 12:16 pm

DwrCymru, thank you very much. I released version 4.74 of the component with your code.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2408
Joined: March 7th, 2003, 7:10 pm

Postby DwrCymru » April 27th, 2007, 2:01 pm

Your very welcome, the PrintPreview is a great component, keep up the good work. You can find more info on the VCL used in the DLL by going here : http://www.llion.net/llpdflib.php and there is also a trial version you can download which contains a help file describing the properties of the component.

All the best.

Dave
DwrCymru
Active Member
Active Member
 
Posts: 8
Joined: April 27th, 2007, 11:02 am

Postby akeix » April 28th, 2007, 7:38 am

Hello,

the library llPDFLib 3.6 is paying (299 $ for a licence!).

The DLL dspdf.dll is almost free because it is enough to send a postcard to its author to receive the full version.

This approach is closer to Kambiz which offers its components in freeware.

It is my opinion.

Cordially,

Akeix
akeix
Active Member
Active Member
 
Posts: 7
Joined: January 14th, 2004, 2:12 pm
Location: France

Postby Johnny_Bit » April 28th, 2007, 9:02 am

In terms of money... Take a look at GNU Linux and all the tools that are in it (any major distro). You can get perfect PDF making tool with GNU license, that not only gives that for free, but also allows you to look at the source and/or change to make it work better for you.
Johnny_Bit
VIP Member
VIP Member
 
Posts: 455
Joined: June 15th, 2003, 9:56 am

Postby DwrCymru » April 28th, 2007, 4:33 pm

I agree with Johnny_Bit, why would anyone pay $299.99 for a piece of code when there are many alternatives out there with source code available for free, which you can then modify when you find it does not do what you want or has bugs in it that you need fixing ASAP.

You have to admire the author of "dspdf.dll" though for paying out all that money and then giving a needed functionality away for just a postcard.

Dave
Dave

If a week were 8 days long I could have finished this yesterday.
DwrCymru
Active Member
Active Member
 
Posts: 8
Joined: April 27th, 2007, 11:02 am

Postby akeix » April 28th, 2007, 6:12 pm

Good evening,

I agree with you.

Cool still an improvement!

Cheer with Kanbiz and you all!

Akeix
akeix
Active Member
Active Member
 
Posts: 7
Joined: January 14th, 2004, 2:12 pm
Location: France

Postby beinars » May 3rd, 2007, 10:19 am

Hi!

I'm new here and like this Print Preview component very much!

Very well written indeed.

I'm also using this dll, DSPDF.DLL

What I need is a address to whom I can send postcard to, as to get fully functional DLL.

All the best
Einarsson
beinars
Active Member
Active Member
 
Posts: 12
Joined: May 3rd, 2007, 9:38 am
Location: Iceland

Postby HPW » May 3rd, 2007, 10:32 am

Found at http://delphistep.cis.si/ in support:

Grega Loboda
Tuga Vidmarja 2
4000 KRANJ
SLOVENIA
Hans-Peter
HPW
Moderator
Moderator
 
Posts: 230
Joined: February 25th, 2006, 10:19 am
Location: Germany

Postby beinars » May 3rd, 2007, 11:59 am

HPW wrote:Found at http://delphistep.cis.si/ in support:

Grega Loboda
Tuga Vidmarja 2
4000 KRANJ
SLOVENIA


Thanks!

Did send him a card from my country Iceland, one with pics of our great waterfall, Gullfoss!
beinars
Active Member
Active Member
 
Posts: 12
Joined: May 3rd, 2007, 9:38 am
Location: Iceland

Postby Kambiz » May 3rd, 2007, 2:28 pm

beinars wrote:
HPW wrote:Found at http://delphistep.cis.si/ in support:

Grega Loboda
Tuga Vidmarja 2
4000 KRANJ
SLOVENIA


Thanks!

Did send him a card from my country Iceland, one with pics of our great waterfall, Gullfoss!

What about us? :D
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2408
Joined: March 7th, 2003, 7:10 pm

Next

Return to DELPHI AREA Products

Who is online

Users browsing this forum: No registered users and 1 guest