Beiträge von bbordwell

    PDFMem is defined as: TWPViewPDF;

    I use (with success in most cases) the following code:


    Result := GetATempFileWithExt(JSTempDir,sDotPDF);

    PDFMem.CommandStrEx( COMPDF_ACTIONNR, Result, 4); //FileSaveAsPDF (no prompt)

    Application.ProcessMessages;

    PDFMem.CommandStr( COMPDF_ACTION,'FileClose=Close');

    Application.ProcessMessages;

    with the call to GetATempFileWithExt() function, Result will be a filename, something similar to: c:\SomeTempDir\__TempFolder\temp1234.pdf

    This is simply a filename, not an actual file. We asked for a temporary filename that does not exist, so we can create it with the next call to PDFMem.CommandStr()

    Yes, this is a local file.

    This seems to fail, with the file not existing after a the call to both FPDFMem.CommandStrEX() and PDFMem.CommandStr() functions.

    PDFMem does not fail, but the expected new file was not created/saved.

    Suggestions? Can I get this to save in another method with better success?

    Thanks in Advance.

    Follow up.

    I have looked at:

    i := WPViewPDF1.Command(COMPDF_GetModified)

    and

    i := WPViewPDF1.Command(COMPDF_Modified);

    but neither returns a value if you simply add a rectangle, or circle.

    If I move the same rectangle or circle, after adding it, I will then get a result from COMPDF_Modified command.

    Thank you for that sample code, but it does not solve what I'm trying to do.

    I want to "Draw" a rectangle, and on completion of the draw, the rectangle appears.

    The Demo draws a rectangle, but the result is transparent.

    How do I turn off the default transparency, or draw a rectangle similar to how the demo draws?

    My attempts using COMPDF_MouseAddOneDrawObject failed as described earlier.

    You mentioned "...does not switch the mouse mode", is that what I'm missing?

    Please give sample to draw the rectangle similar to the demo, but no transparency, or show how to turn off transparency as the default.

    Thanks.

    When drawing a Rectangle from the demo, the default behavior is transparent. The Circle is NOT transparent.

    I'm looking for creating a non-transparent rectangle to redact large areas of text or images.

    I tried the sample code (from help):

    var

    t: TPDFDrawObjectRec;

    begin

    FillChar(t, SizeOf(t), 0);

    t.ColorBrush := clRed;

    t.Alpha := 100; // transparent

    t.grtyp := 1; // Rectangle

    WPViewPDF1.CommandStrEx(COMPDF_MouseAddOneDrawObject,

    'REDRECT', Cardinal(@t));


    and was able to put the mouse once into a drawing mode as a square with an arrow and a +, but no rectangle was drawn on the PDF. As soon as I began the drag with the mouse, the cursor changes to a multi-page glyph.

    After that initial draw attempt, this function failed to put the mouse into a drawing mode.

    I also tried multiple values for t.Alpha := XXX

    So, how can I turn off the transparency for the demo rectangle? If not possible, why does the above code fail?

    Thanks.

    Thanks,

    No luck. the result continually returns 1 (result=1 if disabled)

    I tried enabling:

    WPViewPDF1.command(COMPDF_Ann_Undo, 5); (result=0)

    I tried saving first:

    WPViewPDF1.command(COMPDF_Ann_Undo, 1); (result=1)

    I tried undo:

    WPViewPDF1.command(COMPDF_Ann_Undo, 2); (result=1)

    I tried the above in multiple combinations/order

    What I am trying to undo

    Add a Rect to the PDF, then undo that add.

    I see Undo in the WPDF_ViewCommands.pas file. I also see UnDeletePage(), but I don't see any examples of use.

    Please provide example of how to undo changes (adding annotations).

    Thanks.

    Using the PDF Edit Demo:

    Two questions here.

    I can see File Open, and File Append, etc. But how would you start from scratch? Is that possible?

    Even if I had 'File' -> 'New', and started with a 0,0,0,0 sized image, I could then 'Append' to that memory space.

    Possible? Please give sample code if possible.

    Thanks.