PrintPreview Grayscale PDF

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

PrintPreview Grayscale PDF

Postby Acheron » June 24th, 2013, 11:16 pm

Hello!

First of all, let me apologize if this topic has been discussed earlier, though I couldn't finy any traces of it.
I am using your printpreview component with much satisfaction, however when I set grayscale options to [gsPreview, gsPrint] the resulting pdf saved from this will never be grayscaled. The preview is grayscaled as it should be.
Could you please help me fix this problem?

Thank you in advance,
Bela
Acheron
Active Member
Active Member
 
Posts: 10
Joined: December 5th, 2012, 9:53 pm

Re: PrintPreview Grayscale PDF

Postby Kambiz » June 25th, 2013, 7:55 pm

Hi,

This behaviour is intentinal.

When grayscale option is enabled, the grayscale filter applies on each page befor print or display. However, The pdf generates always using the original metafile of pages.

This is because an end-user can manipulate the generated pdf as he/she wishes at anytime.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Re: PrintPreview Grayscale PDF

Postby Acheron » June 25th, 2013, 8:36 pm

Ok, thank you! Then what is it option for anyway?I mean, even in your general demo, one can switch between coloured and grayscale mode, but cannot save anything that will be grayscaled.It's a bit embarrassing for me.
Acheron
Active Member
Active Member
 
Posts: 10
Joined: December 5th, 2012, 9:53 pm

Re: PrintPreview Grayscale PDF

Postby Kambiz » June 26th, 2013, 5:10 pm

Converting all pages permanently to gray scale is not so difficult.

Code: Select all
procedure PermanentGrayscale(PrintPreview: TPrintPreview);
var
  PageNo: Integer;
begin
  with PrintPreview do
  begin
    for PageNo := 1 to TotalPages do
    begin
      BeginReplace(PageNo);
      StretchDrawGrayscale(Canvas, PageBounds, Pages[PageNo], GrayBrightness, GrayContrast);
      EndReplace(False);
    end;
  end;
end;
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Re: PrintPreview Grayscale PDF

Postby Acheron » June 26th, 2013, 7:56 pm

I really appreciate your answer, thank you very much!
Acheron
Active Member
Active Member
 
Posts: 10
Joined: December 5th, 2012, 9:53 pm


Return to DELPHI AREA Projects

Who is online

Users browsing this forum: No registered users and 4 guests

cron