• I have some situations where an rtf fits on 1 page but when it is converted to a pdf via TWPPDFExport it ends up on 2 pages. At first glance, the top margin appears larger in the pdf than in the original rtf which would probably account for pushing the bottom onto a second page. Is there a setting I am missing that will take a "snapshot" of the rtf and produce the pdf exactly?

    WPDF 2.65
    WPTools 4.25, best I can tell

  • After a little more digging I have a better understanding of my problem. I am creating a wprichtext dynamically and loading a saved rtf from disk into it. I then create a pdf with wppdf. Here is my problem. When I do this in a delphi2006 vcl application it works fine, when I create the pdf via a webservice (also delphi2006, soap), some of the pages end up bleeding onto the next page eventually causing some blank pages, etc...

    Both sets of code are identical. My first guess is that it has something to do with the application code residing within a form.

    here is the code:

    function TWS.GetStoredLetter(SomeStuff: String): TByteDynArray; stdcall;
    var
    OutputPDFStream: TMemoryStream;
    WPPDFExport: TWPPDFExport;
    TmpStream: TMemoryStream;
    WPRichText: TWPRichText;

    begin

    ...

    TmpStream.Seek(0,0);


    WPRichText := TWPRichText.CreateDynamic;

    WPPDFExport := TWPPDFExport.Create(nil);
    WPPDFExport.Source := WPRichText;
    WPRichText.LoadFromStream(TmpStream);
    WPPDFExport.CompressStreamMethod := wpCompressFastFlate;
    WPPDFExport.InMemoryMode := true;

    WPPDFExport.Stream := OutputPDFStream;
    WPPDFExport.Print;

    OutputPDFStream.Seek(0,0);
    OutputPDFStream.SaveToFile('testpdf.pdf');

    ...

    end;

  • After looking further, it looks like the pdf generated from the webservice has slightly larger spacing in regards to the the distance between letters/words. It is hard to tell if there is any increase in space between lines. But the extra space between words is enough such that it can cause an extra line to be created and push the text onto the next physical page.

    Both the stand-alone app and the webservice are running on the same machine.

  • In an attempt to discover the problem, I have installed the demo version of wptools 5 and the demo version of wppdf 3. After doing this and changing no other code, now both the stand-alone executable and the webservice produce identical pdfs. However they both cause 1 page (the same in both cases) to run-over into another page where as wptools 4 created the pdf perfectly in the stand-alone application, both with pdf 2 and pdf 3.

    Any help would be appreciated.

  • I ran one last test. I created a console applicaiton to create the pdf from the rtf. I then had the webservice execute the console application. When I run the console application by itself, the pdf is fine, when it runs via the webservice, pages overflow. It appears that when executed via the webservice, the pdf font is slightly different than when run in a standard application.

    I am getting out of my comfort zone with this, so any help would be appreciated.

  • It appears that running under a webservice produces different pdf renderings depending upon the user that the webservice is running under.

    I was able to create a pdf that was perfect when run under one user, but was off when run under the default user.

    Can you tell me what about different user accounts could cause this? For example, is there some permission on a user that might affect the font size or choice differently for different users?

    • Offizieller Beitrag
    Zitat

    It appears that running under a webservice produces different pdf renderings depending upon the user that the webservice is running under.

    I was able to create a pdf that was perfect when run under one user, but was off when run under the default user.

    Can you tell me what about different user accounts could cause this? For example, is there some permission on a user that might affect the font size or choice differently for different users?

    The difference can be the availability of a printer. If WYSIWYG is active in wptools 4 it requires a printer, when wPDF uses Printer as canvas reference it does, too.

    WPTools 4 always requires a window handle, only WPTools 5 has the method CreateDynamic which creates and editor (as paint engine) without a window handle but with full print and PDF functionality.

    Julian