PDF-XChange - Tracker PDF Viewer - TIFF-XChange - Image-XChange - XMF-XChange - Raster-XChange - Support

Moderators: TrackerSupp-Daniel, Tracker Support, Chris - Tracker Supp, Vasyl-Tracker Dev Team, Paul - Tracker Supp, Ivan - Tracker Software, Sean - Tracker, Tracker Supp-Stefan

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
 
dkeith2
User
Topic Author
Posts: 46
Joined: Mon Aug 14, 2017 8:28 pm

Activate/Deactivate PencilTool for signature

Wed Nov 29, 2017 6:16 pm

I would like to see an example of how to enable/turn on/show the pencil tool on a form, so that I may sign a PDF signature block. The platform could be... Windows with a mouse, windows tablet with a stylus, windows tablet with a touch screen using your finger etc.

The canvas will contain a drawn PDF form with or without form fields.

On command, the user will open a form for editing. When the user needs to sign the form, a button for ex. is made available and the user clicks or otherwise presses the button, the penciltool is activated, and the user signs the document.

How is this done? Is there an example available?

Thank you.
 
User avatar
Sasha - Tracker Dev Team
User
Posts: 3277
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Activate/Deactivate PencilTool for signature

Wed Nov 29, 2017 7:24 pm

Hello dkeith2,

Well that's not possible with the CoreApi, because there is no UI Control at all.
You can use the Editor SDK - there you can activate the tool by using the ExecuteUICmd method and giving the ID of the command that activates the pencil tool. You can look for the ID by using the Customize Commands feature of the end user Editor.

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
 
dkeith2
User
Topic Author
Posts: 46
Joined: Mon Aug 14, 2017 8:28 pm

Re: Activate/Deactivate PencilTool for signature

Wed Nov 29, 2017 7:29 pm

Ok so I have a TPXV_Inst (Delphi). How do I go from, say, a .Doc[0] instance (or any other interface) to an IUIX_Obj (second parameter of the ExecUICmd procedure)?

Also I'm assuming we're talking about PencilTool - 33129 - Annots:Tool:InkMenuItem?

What about IUIX_Pen? Would that do the trick? If so, can you provide an example of it's use, starting with the IPXV_Inst?

Thank you.
 
dkeith2
User
Topic Author
Posts: 46
Joined: Mon Aug 14, 2017 8:28 pm

Re: Activate/Deactivate PencilTool for signature

Wed Nov 29, 2017 7:53 pm

I've tried:

FInst.ExecUICmd('PencilTool',FInst.ActiveMainFrm.Obj);
FInst.ExecUICmd('Annot.Tool.InkMenuItem',FInst.ActiveMainFrm.Obj);
FInst.ExecUICmd2(33129,FInst.ActiveMainFrm.Obj);

...with an open PDF.

Nothing happens....

Is this documented somewhere?
 
dkeith2
User
Topic Author
Posts: 46
Joined: Mon Aug 14, 2017 8:28 pm

Re: Activate/Deactivate PencilTool for signature

Wed Nov 29, 2017 9:36 pm

Ok, this worked:

FInst.ExecUICmd('cmd.tool.annot.pencil',FInst.ActiveMainFrm.Obj);
 
User avatar
Sasha - Tracker Dev Team
User
Posts: 3277
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Activate/Deactivate PencilTool for signature

Thu Nov 30, 2017 7:59 am

:)
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
 
dkeith2
User
Topic Author
Posts: 46
Joined: Mon Aug 14, 2017 8:28 pm

Re: Activate/Deactivate PencilTool for signature

Thu Nov 30, 2017 6:37 pm

I noticed a problem with this: when I call ExecUICmd('cmd.annots.flatten',Inst.ActiveDoc.ActiveView.PagesView.Obj) it allows me to save the annotations (pencil drawing etc.) with the document. Have to jump through other hoops as well, but the annots are saved with the document.

I thought that if I choose to flatten the annots, they would be 'burned in' to the document and could no longer be edited. However, when I open the doc up in my editor, the annot is still selectable/modifiable. Is this the way it is supposed to work? I need hand drawn signatures to become a permanent, non-editable part of the document. Is there another way to do this?

Thanks.
 
User avatar
Sasha - Tracker Dev Team
User
Posts: 3277
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Activate/Deactivate PencilTool for signature

Sat Dec 02, 2017 7:27 am

Hello dkeith2,

There is a command that flattens selected comments only and the command that flattens all of the comments on pages. Be sure to use the needed one.
But in your case, it's better to use the operation directly, as the command launches the options dialog:
https://sdkhelp.tracker-software.com/vi ... ts_flatten

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
 
dkeith2
User
Topic Author
Posts: 46
Joined: Mon Aug 14, 2017 8:28 pm

Re: Activate/Deactivate PencilTool for signature

Sun Dec 03, 2017 12:19 am

Great, got that working, thank you.

Now I need to figure out how to access the brush for the PencilTool. Here's what I've tried:

var
  i: Cardinal;
  coll: IUIX_ObjCollection;
  obj: IUIX_Obj;
  s: WideString;
  IUIX_PencilTool;
begin
  coll := FInst.ActiveDocView.Obj.Children;
  for i := 0 to Pred(FInst.ActiveDocView.Obj.Children.Count) do
    if Assigned(FInst.ActiveDocView.Obj.Children.Item[i]) then
    ...
   


but this really doesn't seem to give me access, even thought I'm activating the PencilTool this way:
Inst.ExecUICmd('cmd.tool.annot.pencil',Inst.ActiveDocView.Obj);


I thought that maybe, just maybe, since the owner of the PencilTool is the ActiveDocView.Obj, perhaps the PencilTool would show up as a child to the .obj... I do find one child of the .obj, but I can't get any class info from it.

Also, in the COM interface wrapper, there is no interface to a 'PencilTool'. I did find a pen, however, but can't seem to activate it.

I need to change the color of the PencilTool's brush, as well as the width. How do I do this?

Thanks.
 
dkeith2
User
Topic Author
Posts: 46
Joined: Mon Aug 14, 2017 8:28 pm

Re: Activate/Deactivate PencilTool for signature

Sun Dec 03, 2017 12:40 am

Also tried this:

var
  i: Cardinal;
  coll: IUIX_ObjCollection;
  obj: IUIX_Obj;
  s: WideString;
  brush: IUIX_Brush;
begin
  coll := FInst.ActiveDocView.Obj.Children;
  for i := 0 to Pred(FInst.ActiveDocView.Obj.Children.Count) do
    if Assigned(FInst.ActiveDocView.Obj.Children.Item[i]) then
      try
       IUIX_Pen(FInst.ActiveDocView.Obj.Children.Item[i]).Get_Brush(brush);
       if not Brush.Set_Color0(000000) = S_OK then
        raise Exception.Create('Error: Object does not have a brush');
      except
        MessageDlg('Error: Object does not have a brush',mtError,[mbOK],0);
      end;
      ...


I don't get any errors, and my brush color remains the same. Also tried brush.SetColor1(0) etc. same same.
 
User avatar
Sasha - Tracker Dev Team
User
Posts: 3277
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Activate/Deactivate PencilTool for signature

Mon Dec 04, 2017 12:38 pm

Hello dkeith2,

Check this topic:
viewtopic.php?f=66&t=24223

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
 
dkeith2
User
Topic Author
Posts: 46
Joined: Mon Aug 14, 2017 8:28 pm

Re: Activate/Deactivate PencilTool for signature

Mon Dec 04, 2017 5:21 pm

var
  tid: Integer;
  styleparms: ICabNode;
  hr: HRESULT;
begin
  tid := Inst.Str2ID('cmd.tool.annot.pencil',false);
  hr := Inst.CommentStylesManager.GetCurrentStyle(tid,styleParms);
  if HR = S_OK then
  begin
    styleparms['SC'].v := RGB(0,0,0);
    Inst.CommentStylesManager.OnChangedCurrentStyle(tid);
  end;
  VerifyFPControlWord;
  Inst.ExecUICmd('cmd.tool.annot.pencil',FPencilOwner);


This doesn't change the color of the pencil tool...
 
dkeith2
User
Topic Author
Posts: 46
Joined: Mon Aug 14, 2017 8:28 pm

Re: Activate/Deactivate PencilTool for signature

Mon Dec 04, 2017 5:51 pm

When I changed it to this:
var
  tid: Integer;
  styleparms: ICabNode;
  hr: HRESULT;
begin
  // Pencil Tool command constant - 4216 - cmd.tool.annot.pencil -
  VerifyFPControlWord;
  tid := Inst.Str2ID('tool.annot.pencil',false);
  hr := Inst.CommentStylesManager.GetCurrentStyle(tid,styleParms);
  if HR = S_OK then
  begin
    styleparms['SC'].v := RGB(0,0,0);
    Inst.CommentStylesManager.OnChangedCurrentStyle(tid); 
  end;
  Inst.ExecUICmd('tool.annot.pencil',FPencilOwner);
 

...HR returns S_OK. However I get an EOleException 'The Parameter is incorrect' error here:
    Inst.CommentStylesManager.OnChangedCurrentStyle(4216); // same error if I specify the command constant 4216 
 
dkeith2
User
Topic Author
Posts: 46
Joined: Mon Aug 14, 2017 8:28 pm

Re: Activate/Deactivate PencilTool for signature

Mon Dec 04, 2017 6:30 pm

Ok, didn't realize that rgbd was a string value that needed to be quoted. Once I quoted the rgb values as a string, it changed the color successfully:
styleparms['SC'].v := 'rgbd(0,0,0)';


Now to figure out how to change the width of the stroke...

Thanks.
 
dkeith2
User
Topic Author
Posts: 46
Joined: Mon Aug 14, 2017 8:28 pm

Re: Activate/Deactivate PencilTool for signature

Mon Dec 04, 2017 7:00 pm

In order to set the PencilTool brush size, I've tried this:
styleparms['S.W'].v := 6.0;
styleparms['SW'].v := 6.0;
styleparms['SW'].v := 6;
styleparms['SW'].v := '6';
styleparms['SW'].v := '6pt';

Have you yet created a reference to the constants list?

What is the PencilTool brush width constant?

"The parameter is incorrect'...
 
User avatar
Sasha - Tracker Dev Team
User
Posts: 3277
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Activate/Deactivate PencilTool for signature

Tue Dec 05, 2017 8:30 am

Hello dkeith2,

For this, better use the CabNodeExplorer available from here:
viewtopic.php?f=66&t=25943
Or just look into the registry and see the needed values - it's the same but the node explorer itself is much easier to use.

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

Who is online

Users browsing this forum: No registered users and 1 guest