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 

PrintPreview Problem. Bug or ?- Updated Please Read Inside

 
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
salpay
Member


Joined: 07 Mar 2005
Posts: 1

PostPosted: 08/03/05 08:00    Post subject: PrintPreview Problem. Bug or ?- Updated Please Read Inside Reply with quote

I downloaded PreviewSuit 4.60 and compiled "General Demo", Preview works fine but when i send this preview to printer , all output pages clipped some from the bottom of the pages. So the output and preview becomes different from each others. (For both inkjets and laser printers).
Finally, i realized that the problem comes from "SetPrinterOptions" Code.
In this Code, Printer PaperSize is set for only if (ActiveForm = '') or (Win32Platform <> VER_PLATFORM_WIN32_NT). But if you have already selected a paper (means ActiveForm and papersize), printer papersize is not set and the problem occurs.
So I made a modification in the "SetPrinterOptions" routine below;

Replace:
if (ActiveForm = '') or (Win32Platform <> VER_PLATFORM_WIN32_NT) then
begin
...........................
...........................
end;

With:
if (ActiveForm = '') or (Win32Platform <> VER_PLATFORM_WIN32_NT) then
begin
...........................
...........................
end
else
begin
dmFields := dmFields or DM_PAPERSIZE;
DmPaperSize := PaperSizes[FPaperType].ID;
end;

---------------------------------------------------------------------------------
The important point is that you have to assign correct value to FpaperType after changing activeform (new papertype and also papersize) before printing. So you can do this easly by using the code below:

with printpreview do
begin
PaperType:=TpaperType( NewPaperID ); // NewPaperId:=9 for A4 Form
end;

For general demo, this code should be;

procedure TPreviewForm.FormComboBoxChange(Sender: TObject);
begin
with PrintPreview do
begin
if FormComboBox.ItemIndex >= 0 then
FormName := FormComboBox.Items[FormComboBox.ItemIndex];
PaperType:=TpaperType(FormComboBox.ItemIndex);
end;


Now, Everyting works fine for me.


Salpay.
Back to top
View user's profile Send private message
Kambiz
Administrator


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

PostPosted: 12/05/05 09:37    Post subject: Reply with quote

Hi,

I'm sorry for being so late. I forgot to come back to this topic. Embarassed

By modifications you did in PrintPreview, actually you set the condition always true, because if and else parts of the condition are identical except that you didn't consider custom paper sizes for the else part.

Now the question is: when a form is selected, shall we also set the paper size field for NT? According to Microsoft documentations, printer drivers on Win9x ignore FormName field, so we should set paper size field in Win9x. Seems there are also some printer drivers on NT, which ignore form name field too. Rolling Eyes Which OS are you using?

By the way, in PrintPreview setting the FormName property updates the PaperType property value and vice versa. Therefore, the modifications you suggested for the demo program are not necessary at all.

Cheers

_________________
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
Page 1 of 1

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