Export ScaleRichView to PDF using Gnostice and Metafile

ScaleRichView support and discussion (TRichView add-on for WYSIWYG editing)
RickB
Posts: 5
Joined: Wed Mar 17, 2010 5:43 pm

Export ScaleRichView to PDF using Gnostice and Metafile

Post 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?
Sergey Tkachenko
Site Admin
Posts: 17524
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Does ScaleRichViewTextDrawAlwaysUseGlyphs (global variable from RVStyle.pas) equal to False when you create a metafile?
RickB
Posts: 5
Joined: Wed Mar 17, 2010 5:43 pm

Post 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;
Sergey Tkachenko
Site Admin
Posts: 17524
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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).
RickB
Posts: 5
Joined: Wed Mar 17, 2010 5:43 pm

Post 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?
Sergey Tkachenko
Site Admin
Posts: 17524
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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.
RickB
Posts: 5
Joined: Wed Mar 17, 2010 5:43 pm

Post by RickB »

Sample wmf and source rvf have been sent to the gmail account.
rgsolutions
Posts: 86
Joined: Mon Jun 08, 2009 11:25 pm

Same Problem

Post by rgsolutions »

I am having the same problem with the new version of ScaleRichView (4). This processing worked correctly in version 3.
ccr
Posts: 8
Joined: Sat Nov 13, 2010 12:47 am

Are there some news concerning pdf conversion via gnostice?

Post by ccr »

i am very interested in the conversion to pdf from scalerichview too ...
Sergey Tkachenko
Site Admin
Posts: 17524
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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.
RickB
Posts: 5
Joined: Wed Mar 17, 2010 5:43 pm

Post 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.
jonjon
Posts: 464
Joined: Sat Aug 27, 2005 4:19 pm

Post 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.
yagui
Posts: 6
Joined: Tue May 13, 2014 4:11 pm

Post 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
Sergey Tkachenko
Site Admin
Posts: 17524
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

We are still discussing this problem by email.
JonRobertson
Posts: 164
Joined: Tue Nov 08, 2011 5:11 pm

Post 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?
Post Reply