Author Topic: Adding custom text stamp, from command line  (Read 9655 times)

0 Members and 1 Guest are viewing this topic.

Marco

  • Guest
Adding custom text stamp, from command line
« on: June 24, 2015, 05:36:57 PM »
I’m looking for a pdf tool for our customer that answer at this requirement:
From batch command (command line) – not GUI – we need to add a stamp with a protocol number with his date, reading these info from external db source…
Could PDF Shell Tools to do this job?

RTT

  • Administrator
  • *****
  • Posts: 918
Re: Adding custom text stamp, from command line
« Reply #1 on: June 24, 2015, 05:45:29 PM »
Yes, with the use of the DynCustomText parameter

First, you need to create a stamp template, using the stamp tool GUI, to place a dynamic text object, with a [C1] string in it, where do you want the text to appear in the PDF page(s). Create a stamp template like the exemplified at the first attached screenshot, and save it to a "C:\PDFStamps\DynamicCmdLine.stp" named file.

Now you just need to call the stamp tool from the command line, refer the saved template, and pass the text that will replace the [C1] reference.
"C:\Program Files (x86)\PDF-ShellTools\PDFShellTools.exe" stamp StampRules=1 -s Template=C:\PDFStamps\DynamicCmdLine.stp DynCustomText=World C:\PDFs\PDF1.pdf
If you call it without the -s parameter (or from the trial version, that doesn't support the run hidden option) you can see what will be stamped (second screenshot).

conrad.drake

  • Newbie
  • *
  • Posts: 35
Re: Adding custom text stamp, from command line
« Reply #2 on: August 12, 2015, 08:50:40 AM »
It works rather nicely, but if the page orientation  (landscape / portrait) varies within the document the stamp doesn't change proportions

RTT

  • Administrator
  • *****
  • Posts: 918
Re: Adding custom text stamp, from command line
« Reply #3 on: August 12, 2015, 04:05:33 PM »
Under the stamp tool "files" tab, the "stamp mode" options (fit to page and maintain aspect ratio) controls proportionality for when the page dimensions/orientation change. Have you played with these options?
If you are referring to a different problem, please attach a stamped PDF showing how it should look like.

conrad.drake

  • Newbie
  • *
  • Posts: 35
Re: Adding custom text stamp, from command line
« Reply #4 on: August 13, 2015, 03:39:28 AM »
Have you played with these options?
I've got that working in interactive mode but (in my ignorance) don't know how to set the stamp mode from the CLI


RTT

  • Administrator
  • *****
  • Posts: 918
Re: Adding custom text stamp, from command line
« Reply #5 on: August 13, 2015, 03:49:23 PM »
These options are imposed by the template itself, and you can specify it by clicking the "options" button of the save template dialog (button placed near the usual "save" and "cancel" buttons). It is explained in the user's guide.
Here is the screenshot of the extra options dialog:

conrad.drake

  • Newbie
  • *
  • Posts: 35
Re: Adding custom text stamp, from command line
« Reply #6 on: August 14, 2015, 05:07:31 AM »
Ah, found it!   

I must confess I misread the instructions - saw what I expected to see rather than what was actually written (I was expecting to see the options tab on the GUI stamp tab)

Thanks once again!