Page 1 of 2

Export ScaleRichView to PDF using Gnostice and Metafile

Posted: Fri Jun 03, 2011 6:29 pm
by RickB
I'm trying to export my ScaleRichView contents to PDF. The tables and lines show correctly, the text does not.

I find that if I use the Basic Demos\PaintMetafile demo, and save the metafile in that demo to a file, the text is also missing, so I assume the metafile is not getting created correctly using the demo code.

How do I make the text show correctly in the metafile, so that I can paint it to the eDocEngine canvas, or is there another way to get the ScaleRichView contents into the eDocEngine?

Posted: Fri Jun 03, 2011 7:31 pm
by Sergey Tkachenko
Does ScaleRichViewTextDrawAlwaysUseGlyphs (global variable from RVStyle.pas) equal to False when you create a metafile?

Posted: Fri Jun 03, 2011 8:39 pm
by RickB
Yes it does. Here is the code I am using:

Code: Select all

procedure TdlgNotePreview.PrintToPDF(aContents: TMemoryStream);
var
  i: Integer;
  Metafile: TMetafile;
  RVUnit: TRVUnits;
begin
  srve.Update; //srve is ScaleRichViewComponent
  gtPDFEngine1.UserStream := aContents;
  gtPDFEngine1.BeginDoc;
  if (gtPDFEngine1.EngineStatus <> esStarted) then
    Exit;
  RVUnit := srve.UnitsProgram; //Get the current value
  srve.UnitsProgram := rvuPixels; //Change DBSRichviewEdit to pixels for PDF Conversion

  for i := 1 to srve.PageCount do
  begin
    if i > 1 then
      gtPDFEngine1.NewPage;
    Metafile := MakePageMetafile(i, Round(srve.PageProperty.PageWidth), Round(srve.PageProperty.PageHeight));
    try
      gtPDFEngine1.Canvas.Draw(0, 0, Metafile);
    finally
      Metafile.Free;
    end;
  end;
  gtPDFEngine1.EndDoc;
  srve.UnitsProgram := RVUnit; //Change back to the previous value before converted to pixels  
end;

function TdlgNotePreview.MakePageMetafile(aPageNo, aWidth, aHeight: Integer): TMetafile;
var
  savTextDraw: Boolean;
begin
  savTextDraw := ScaleRichViewTextDrawAlwaysUseGlyphs;
  ScaleRichViewTextDrawAlwaysUseGlyphs := False;

  Result := TMetafile.Create;
  Result.Width := aWidth;
  Result.Height := aHeight;
  srve.CanUpdate := False;
  srve.UseDrawHyperlinksEvent := True;
  srve.DrawMetafile(aPageNo, Result, False, True, False);
  ScaleRichViewTextDrawAlwaysUseGlyphs := savTextDraw;
  srve.CanUpdate := True;
  srve.UseDrawHyperlinksEvent := False;
end;

Posted: Sat Jun 04, 2011 1:31 pm
by Sergey Tkachenko
If the resulting metafile (after saving it to a file) looks correct, this is an eDocEngine problem, it should be addressed to Gnostice.
(currently, the only PDF library that I know works correctly with ScaleRichView is wPDF).

Posted: Sun Jun 05, 2011 5:43 pm
by RickB
The metafile does not look correct. You can reproduce this by saving the metafile in the Basic Demos\PaintMetafile demo - notice that the text is not included in the metafile output, so I think at least part of the problem is in drawing the metafile from scalerichview.

What is wPDF?

Posted: Sun Jun 05, 2011 5:53 pm
by Sergey Tkachenko
Please send a sample metafile to richviewgmailcom.

wPDF - DLL + component for PDF export, wpcubed.com , programming interface is very similar to LLPDFLib.

Posted: Mon Jun 06, 2011 4:16 pm
by RickB
Sample wmf and source rvf have been sent to the gmail account.

Same Problem

Posted: Fri Jul 08, 2011 12:20 am
by rgsolutions
I am having the same problem with the new version of ScaleRichView (4). This processing worked correctly in version 3.

Are there some news concerning pdf conversion via gnostice?

Posted: Wed Aug 31, 2011 3:03 pm
by ccr
i am very interested in the conversion to pdf from scalerichview too ...

Posted: Wed Aug 31, 2011 4:21 pm
by Sergey Tkachenko
As I said, wPDF if a know working solution for PDF export of ScaleRichView.
And there is an untested solution: Synopse PDF: http://blog.synopse.info
You can try to save ScaleRichView pages as metafiles, and convert them using Synopse.

Posted: Wed Aug 31, 2011 4:25 pm
by RickB
I have been waiting for weeks for a response from Gnostice about this. All I have been getting are auto replies.

If there are other Gnostice users with a similar problem, please contact them, and maybe if we make enough noise they will respond.

Meanwhile, perhaps it is time to investigate Sergey's other suggestions.

Sergey, perhaps it is also time for you to reconsider your relationship with Gnostice. Their customer service has been very bad so far.

Posted: Thu Sep 01, 2011 12:06 pm
by jonjon
RickB wrote:I have been waiting for weeks for a response from Gnostice about this. All I have been getting are auto replies.
If there are other Gnostice users with a similar problem, please contact them, and maybe if we make enough noise they will respond.
I've contacted many times this year and each time it took months and multiple new e-mails to get an answer, even though I provided clear evidence of bugs with detailed test case.
I'll stop using their components as soon as possible.

Posted: Wed May 21, 2014 11:40 pm
by yagui
Jonjon, RickB,
did you solve the problems that you had with eDocEngine?

I need to create PDF files from ScaleRichView but I'm having problems with the Metafiles. They are badly rendered when they are converted to PDF.

I'll appreciate any help on this topic.

Regards,
Martin

Posted: Thu May 22, 2014 4:17 pm
by Sergey Tkachenko
We are still discussing this problem by email.

Posted: Mon Jul 07, 2014 1:02 pm
by JonRobertson
I use eDocEngine to convert ScaleRichView documents to PDF without any problems. I'm surprised to see others are still having problems. :( Are you using the latest version of Gnostice components?