Beiträge von rackerson

    Sorry for replying so late, I was away for a couple of days.

    About the error I get when using your MetafileOverlay demo, I will email that to you now.

    In the meantime I tried to push on with my own prototype and I have a couple of more questions.

    I am using Delphi 5 and the following logic to loop through all pages in my PDF to apply a watermark to specified pages:

    My questions:
    1. in the above code I am trying to insert a text watermark but I continually get a PDF with a large 3D rectangular image drawn instead.
    2. The loop in the code above correctly prevents processing of certain pages of the PDF, which prevents the AddDrawObject method from being called. Despite this, every page of my PDF always gets a watermark. So obviously I am doing something very wrong. I just don't see what.

    What do I need to change to the code above to make it print a text watermark and to have it not put the watermark on every page?

    Thanks Julian.

    I thought there might be something Delphi 5-related going on here.

    I applied your type casts and the demo now starts up (after I manually copy the wPDFViewDemo03.dll into the folder containing the demo's EXE file). Unfortunately, it doesn't allow me to load a PDF to work with. I have tried 4 different PDF files, ranging in complexity from a single page ReadMe document with just text to a multi-page document with graphics and text (no form stuff though).

    When I click the OPEN toolbar button, I see my File Open dialog and I select a PDF. When I close the dialog, I assume I am supposed to see the PDF loaded in the viewed in the demo. Nothing ever shows up. If I drag the vertical scrollbar at this time I get a "List Index out of Bounds (-1)" error. When I close the demo after trying to load a PDF I get the exception:
    "Exception EAccessViolation in module wPDFViewDemo03.dll at 002A6EC5.
    Access violation at address 04416EC5 in module 'wPDFViewDemo03.dll'. Read of address 00000000."

    I tried adding a breakpoint to trace execution to see if I could tell where something was failing but nothing obvious presented itself. Do you have any ideas of what might be causing my problem?

    Thank you for the reply. Your comments helped a lot.

    I noticed the MetafileOverlay demo but was not able to use it because all attempts to compile or run it resulted in errors with the parameters in the AddDrawObject method ("There is no overloaded version of 'AddDrawObject' that can be called with these arguments").

    I didn't know if the demo was written to support WPViewPDF 2 and I was using 3 or if the problem was something to do with my old Delphi version. Either way, once I hit those errors I just moved on and looked for something else to test with.

    One thing I do notice in that demo is the loading of a DLL. Is that a requirement of WPViewPDF Plus?

    Hello,
    I am evaluating WPViewPDF Plus to add PDF watermarking abilities to my Delphi 5 application. I downloaded the demo and experimented a bit but I'm still not sure how to handle what I need to do.
    My requirements. The user must be able to define:
    1. Text to insert as a watermark
    2. Watermark font type, style, color, and size
    3. Watermark opacity
    4. Watermark location (page top/middle/bottom, left/center/right side of page, or even X/Y coordinates on page)
    5. Page range to apply watermark to (all, even only, odd only, specific page numbers, etc)
    6. Watermark orientation (horizontal, vertical)
    7. Watermark rotation

    Is all of the following available from WPViewPDF Plus? Also, is there any sample code that demonstrates how to do at least some of the above?

    Thank you.
    Rich

    My application contains a collection of WPTools documents containing merge fields. I have a client request to be able to export these documents; as part of the export process, they need me to convert the merge fields. The placeholders need to be converted to text.

    I admittedly do not see the value in this but, hey, the client is paying for it!

    I know I can use the GetFieldList method to retrieve a list of the merge fields in my document but is there a way to convert them from merge fields to literal text? The text that should appear in place of the merge tag is the merge field's id.

    Thanks.

    Thanks for the tip. I will give this a try. Just so I don't do something stupid, setting the cursor position to 0 would simply be:

    Code
    WPTools.CPPosition := 0;

    (where WPTools is an instance of your TWPCustomRtfEdit object)
    Correct?

    Hi Felipe,

    Thanks for the reply.

    HAVE tried your suggestion before and my test *seemed* to succeed but, as I said, this problem occurs something like 1 time in 50 so it's not exactly an easily reproducable case. Thus the apparent success of my test case saving to a file and loading it right back into WPTools is no more a true sign of success than the hundreds of times when my existing logic saves to and loads from the database with no error...

    I thought about this possibly being a data conversion issue but so far have ruled that out because the same document can have this occur and then not occur in successive editing sessions. If there was a true conversion issue then I would expect the same document to fail repeatedly. There really seems to be no rhyme or reason

    For what it's worth, I am not insinuating there is something *wrong* with WPTools that is causing this error. Rather, I am simply trying to understand what is going on in that particular method that raises an exception. It looks to me like WPTools is trying to determine which RTF data block the cursor was in and grabs that block into its FCursorRTFData field. And if the correct block cannot be found for some reason then the exception is raised.

    I know my data did not get corrupted because the resulting documents are fine; I can still print them, edit them, merge variables into them... even call them into Word and look at them. The user's documents seem perfectly fine in 100% of the cases.

    If my brief analysis of this WPTools method is correct, my solution may be something as simple as forcing focus back into the document being saved just before posting to the database. I just don't know...

    Delphi 6, WPTools 6.08

    I am writing for two reasons concerning this error message.
    It is raised in the procedure set_RTFData(x: TWPRTFDataBlock) in the TWPRTFDataCursor class of the WPRTEDefs.pas unit.

    First the trivial item - since the text is hard coded in English, I would like to point out that there is a misspelling. "currupted" should be spelled with an O, as "corrupted".

    The second issue is little more difficult. As silly as it may sound, "why should this exception be raised?" We recently started getting reports from users stating that this error appeared when saving changes to a document in WPTools.
    Our save process consists of using your SaveToFile() method to save the document to a temporary local file. Then we read the contents of the temporary file into a TBlobField of an ADODataSet via its LoadFromFile() method. Then we Post. This has worked well for months now.

    Oddly enough, when the exception is raised all of the user's changes DO properly save. I have tried tracing the problem but it occurs something like 1 time out of 50 and I have not been able to come up with any causes. Thus the reason for asking what should cause this problem.

    Obviously there is some problem but since all processes seem to work, I have no idea where to turn. Any suggestions?

    As a further followup, I tried simply commenting out the IsHidden method (not expecting that to be a good idea) and tested the spell check.
    The good news: Addict correctly skipped all of my merge fields!
    The bad news: Addict now flags EVERYTHING as being mispelled! It seems that all words on a line within a single data block are read without the spaces and analyzed as if they were a single word. :-(

    For example, the title of one of my documents is: Writing MTS and COM+ Components in Delphi. Note there is a single space between each word. When I run the spell check before adding the new code, everything is processed properly. However, with the new code Addict reads this sentence as if it was the single word WritingMTSandCOM+ComponentsinDelphi and flags it as being misspelled.

    I assume this is because of my commenting out the unknown IsHidden method. Correct?

    Yes. As it turns out a new dialog was created for each layer. It wouldn't have been too bad except that Addict displays a "Spell check has been completed" message following each scan - so this dialog appeared multiple times as well.

    I suppose my next step is to contact Michael Novak to see if there is a way to suppress that message...

    Worked perfect, thanks!

    As it turns out, I was using MergeActiveText. I completely forgot about the header, footer, and document body being considered different data blocks and that only one would be active. Thus I had accidentally been telling WPTools to skip the header and footer all along!

    Okay, I found the spot to insert this code but I have a couple of questions I hope you can assist with.

    First, the body of the TWPToolsControlParser.MoveNext is:


    I believe I should be able to insert your code following the ENDIF directive. However I just want to make sure I am using the proper values.
    1. You used a variable named "pos" in your WHILE loop. I assume this value is the same as FEdit.CPPosition. Correct?
    2. You use an object named "par" in your code. I assume this is the active paragraph, or FEdit.ActiveParagraph. Correct?
    3. The third portion of your WHILE condition is "IsHidden". I can only find two references to anything named IsHidden is all of the source for WPTools. Both are properties of records, TWPPaintExtraParams and TWPFontCacheInput, not methods. Is this something new?

    Unfortunately I don't have an answer to your exact problem but I thought I would share something that works for us (granted my Delphi version is 6 and I am using the latest WPTools - 6.08)

    Instead of using the action to retrieve the pagecount, I use the PageCount property of the editor itself. Works like a charm for us.

    Delphi 6, WPTools 6.08
    I currently have mail merge functionality working correctly throughout my documents, with one exception.
    If I place a merge field in either a header or a footer, variable substitution is not occuring. Instead, the variable name remains.
    For instance, if I take the variable <<Account>> and place it in my document's body, the code in the OnMailMergeGetText event properly replaces this with valid database values, such as A00561289.

    However, if I place the same merge variable in my header or footer, the code in the OnMailMergeGetText event turns <<Account>> into Account.

    Is there something special I need to do for merge variables to be "seen" correctly by the MailMergeGetText event when the variable resides in a header/footer?

    Using WPTools 6.08, Delphi 6, and Addict 3.5

    Spell checking is working reasonably well (except for my other posted problem about skipping merge fields). However, I cannot see how to make spellcheck scan my entire document.

    If my document does NOT have headers or footers, everything is okay and the entire document is scanned. But if I have headers or footers, it seems the spell checking only operates on either the headers, the body, or the footers. Is there a way to make it cover all three together?