Beiträge von darren

    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;

    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

    I am experiencing the exact same problem. Is there a fix to this, a newer version for 4 than 4.25? I have had to roll back to the previous version. Like others, the plan is to move to 5, but there is a large amount of code that has to be handled. Any help would be appreciated.

    Thanks for the reply.

    Unfortunately I have to keep them in RTF.

    I have created a component that seems to work concatenating the files together. I am going to test it more, but so far it has worked surprisingly well.

    Thanks again.

    Thanks for your reply.

    My situation is a little different than that. I am not printing the file, just creating it. The file will be printed later or emailed. So, my preference is to have 1 file, if at all possible. If I used loadfromfile to load multiple "pieces", the resulting file would still be too large in regards to memory (unless I am missing something) using a richtext box.

    I tested splitting the file into multiple pieces and each is saved resulting in multiple individual rtf files. I just can't find an easy way to put them back together again.

    I am running a process that appends multiple documents into 1 rtf text box. It works fine, but now the documents are getting larger in size and quantity. I am at a point where all of the memory is consumed resulting in an error. I need to find a way around this.

    I am assuming that the rtf file being built is stored in memory. Is there a way to have it stream to disk?

    I have considered breaking it into pieces, but then I have to merge the pieces back together (have not found a good way to do that yet).

    Any help would be appreciated.