Page 1 of 1

PrintPreview Grayscale PDF

PostPosted: June 24th, 2013, 11:16 pm
by Acheron
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

Re: PrintPreview Grayscale PDF

PostPosted: June 25th, 2013, 7:55 pm
by Kambiz
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.

Re: PrintPreview Grayscale PDF

PostPosted: June 25th, 2013, 8:36 pm
by Acheron
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.

Re: PrintPreview Grayscale PDF

PostPosted: June 26th, 2013, 5:10 pm
by Kambiz
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;

Re: PrintPreview Grayscale PDF

PostPosted: June 26th, 2013, 7:56 pm
by Acheron
I really appreciate your answer, thank you very much!