DELPHI AREA
MESSAGE BOARD
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   FavoritesFavorites   Watched TopicsWatched Topics     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Bug : PrintPreview v4.72
Goto page 1, 2  Next
 
Post new topic   Reply to topic   printer-friendly view    DELPHI AREA Forum Index -> DELPHI AREA's Products
View previous topic :: View next topic  
Author Message
akeix
Member


Joined: 14 Jan 2004
Posts: 7
Location: France

PostPosted: 23/04/07 21:25    Post subject: Bug : PrintPreview v4.72 Reply with quote

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:

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
Back to top
View user's profile Send private message Visit poster's website
Kambiz
Administrator


Joined: 07 Mar 2003
Posts: 1192
Location: Tehran, Iran

PostPosted: 23/04/07 22:10    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Kambiz
Administrator


Joined: 07 Mar 2003
Posts: 1192
Location: Tehran, Iran

PostPosted: 23/04/07 22:31    Post subject: Reply with quote

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

Thank you!

_________________
Kambiz
Back to top
View user's profile Send private message Send e-mail Visit poster's website
akeix
Member


Joined: 14 Jan 2004
Posts: 7
Location: France

PostPosted: 25/04/07 04:48    Post subject: Reply with quote

Hello,

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

Thank you for this marvellous component.

Akeix
Back to top
View user's profile Send private message Visit poster's website
DwrCymru
Member


Joined: 27 Apr 2007
Posts: 8

PostPosted: 27/04/07 11:11    Post subject: Reply with quote

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

Code:
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:
dsPDF.SetPage(PaperTypeToPDFPageSize(PaperType), Ord(Orientation), PaperWidth, PaperHeight);


Feel free to use the code.

Dave
Back to top
View user's profile Send private message Send e-mail
Kambiz
Administrator


Joined: 07 Mar 2003
Posts: 1192
Location: Tehran, Iran

PostPosted: 27/04/07 12:16    Post subject: Reply with quote

DwrCymru, thank you very much. I released version 4.74 of the component with your code.
_________________
Kambiz
Back to top
View user's profile Send private message Send e-mail Visit poster's website
DwrCymru
Member


Joined: 27 Apr 2007
Posts: 8

PostPosted: 27/04/07 14:01    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Send e-mail
akeix
Member


Joined: 14 Jan 2004
Posts: 7
Location: France

PostPosted: 28/04/07 07:38    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
Johnny_Bit
Administrator


Joined: 15 Jun 2003
Posts: 389

PostPosted: 28/04/07 09:02    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
DwrCymru
Member


Joined: 27 Apr 2007
Posts: 8

PostPosted: 28/04/07 16:33    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message Send e-mail
akeix
Member


Joined: 14 Jan 2004
Posts: 7
Location: France

PostPosted: 28/04/07 18:12    Post subject: Reply with quote

Good evening,

I agree with you.

Cool still an improvement!

Cheer with Kanbiz and you all!

Akeix
Back to top
View user's profile Send private message Visit poster's website
beinars
Member


Joined: 03 May 2007
Posts: 7
Location: Iceland

PostPosted: 03/05/07 10:19    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
HPW
Moderator


Joined: 25 Feb 2006
Posts: 150
Location: Germany

PostPosted: 03/05/07 10:32    Post subject: Reply with quote

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

Grega Loboda
Tuga Vidmarja 2
4000 KRANJ
SLOVENIA

_________________
Hans-Peter
Back to top
View user's profile Send private message
beinars
Member


Joined: 03 May 2007
Posts: 7
Location: Iceland

PostPosted: 03/05/07 11:59    Post subject: Reply with quote

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!
Back to top
View user's profile Send private message Visit poster's website
Kambiz
Administrator


Joined: 07 Mar 2003
Posts: 1192
Location: Tehran, Iran

PostPosted: 03/05/07 14:28    Post subject: Reply with quote

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? Very Happy

_________________
Kambiz
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    DELPHI AREA Forum Index -> DELPHI AREA's Products All times are GMT
Goto page 1, 2  Next
Page 1 of 2

Add to favorites

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group