| View previous topic :: View next topic |
| Author |
Message |
akeix Member
Joined: 14 Jan 2004 Posts: 7 Location: France
|
Posted: 23/04/07 21:25 Post subject: Bug : PrintPreview v4.72 |
|
|
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 |
|
 |
Kambiz Administrator

Joined: 07 Mar 2003 Posts: 1192 Location: Tehran, Iran
|
Posted: 23/04/07 22:10 Post subject: |
|
|
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 |
|
 |
Kambiz Administrator

Joined: 07 Mar 2003 Posts: 1192 Location: Tehran, Iran
|
Posted: 23/04/07 22:31 Post subject: |
|
|
Hopefully it fixed easily.
The update is available to download.
Thank you!
_________________ Kambiz |
|
| Back to top |
|
 |
akeix Member
Joined: 14 Jan 2004 Posts: 7 Location: France
|
Posted: 25/04/07 04:48 Post subject: |
|
|
Hello,
I downloaded the new version of PrintPreview (4.73).
I looked at the modification which you made.
in fact, it was very simple.
I will have to think of it.
Thank you for this marvellous component.
Akeix
|
|
| Back to top |
|
 |
DwrCymru Member
Joined: 27 Apr 2007 Posts: 8
|
Posted: 27/04/07 11:11 Post subject: |
|
|
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 |
|
 |
Kambiz Administrator

Joined: 07 Mar 2003 Posts: 1192 Location: Tehran, Iran
|
Posted: 27/04/07 12:16 Post subject: |
|
|
DwrCymru, thank you very much. I released version 4.74 of the component with your code.
_________________ Kambiz |
|
| Back to top |
|
 |
DwrCymru Member
Joined: 27 Apr 2007 Posts: 8
|
Posted: 27/04/07 14:01 Post subject: |
|
|
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 |
|
 |
akeix Member
Joined: 14 Jan 2004 Posts: 7 Location: France
|
Posted: 28/04/07 07:38 Post subject: |
|
|
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 |
|
 |
Johnny_Bit Administrator
Joined: 15 Jun 2003 Posts: 389
|
Posted: 28/04/07 09:02 Post subject: |
|
|
| 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 |
|
 |
DwrCymru Member
Joined: 27 Apr 2007 Posts: 8
|
Posted: 28/04/07 16:33 Post subject: |
|
|
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 |
|
 |
akeix Member
Joined: 14 Jan 2004 Posts: 7 Location: France
|
Posted: 28/04/07 18:12 Post subject: |
|
|
Good evening,
I agree with you.
Cool still an improvement!
Cheer with Kanbiz and you all!
Akeix
|
|
| Back to top |
|
 |
beinars Member
Joined: 03 May 2007 Posts: 7 Location: Iceland
|
Posted: 03/05/07 10:19 Post subject: |
|
|
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 |
|
 |
HPW Moderator
Joined: 25 Feb 2006 Posts: 150 Location: Germany
|
Posted: 03/05/07 10:32 Post subject: |
|
|
Found at http://delphistep.cis.si/ in support:
Grega Loboda
Tuga Vidmarja 2
4000 KRANJ
SLOVENIA
_________________ Hans-Peter |
|
| Back to top |
|
 |
beinars Member
Joined: 03 May 2007 Posts: 7 Location: Iceland
|
Posted: 03/05/07 11:59 Post subject: |
|
|
Thanks!
Did send him a card from my country Iceland, one with pics of our great waterfall, Gullfoss!
|
|
| Back to top |
|
 |
Kambiz Administrator

Joined: 07 Mar 2003 Posts: 1192 Location: Tehran, Iran
|
Posted: 03/05/07 14:28 Post subject: |
|
|
| beinars wrote: |
Thanks!
Did send him a card from my country Iceland, one with pics of our great waterfall, Gullfoss! |
What about us?
_________________ Kambiz |
|
| Back to top |
|
 |
|