Closed rocketraman closed 1 week ago
--help
for the -H
and -W
options, the default size for the signature depends on the document size and the signature proportions, not signature size. This is done in order to make it easier to sign documents of various sizes. I could of course decrease the default value for -H
, but I think it might be good as it is. The idea is that you make your signature pdf about twice as tall as your intended signature, then add your signature or initials writing on an imagined line through the middle of the empty pdf. That way, when you use the signature you can click on the signature line and get your signature placed correctly. After trying this, do you still think the default value for -H
is too large?
- Unable to reproduce. Could you provide an example signature without sensitive content?
I am unable to reproduce as well. Maybe I flubbed the file type or something :shrug: .
- As documented in --help for the -H and -W options, the default size for the signature depends on the document size and the signature proportions, not signature size.
To take a concrete example, say my signature on paper is approximately 1" high and 2" wide. I would like it to show up on the target PDF with these dimensions. I don't actually care if the target PDF is letter, or legal, or A4 -- my physical signature size doesn't get larger if I'm signing a larger paper!
To take another concrete example, lets say my target PDF is in letter landscape mode. If the page height and width matters, won't this drastically affect the size of my signature? Why should it? With pen and paper, I wouldn't sign any smaller or larger just because my page is landscape.
Also, a minor note: I don't see anything in the docs about how the default size of the signature is determined. The output is currently:
-W WIDTH, --width WIDTH
Width of box to fit signature to, in page width units. (default: 0.28)
-H HEIGHT, --height HEIGHT
Height of box to fit signature to, in page height units. (default: 0.11)
Its really unclear to me what "page width units" and "page height units" means. On first reading, I would assume 0.28 page width units meant the width of the signature should be 28% of the page width, but as per above, as a user it'd be much easier to just specify an absolute value of 2" wide.
The idea is that you make your signature pdf about twice as tall as your intended signature, then add your signature or initials writing on an imagined line through the middle of the empty pdf. That way, when you use the signature you can click on the signature line and get your signature placed correctly.
Also useful information, and also not mentioned in the docs or the README.
Just to make sure I understand the overall point correctly, if I want my signature and my initials to show up as approximately the same height (because physically they are approximately the same height), then I need to put them into PDFs with the same dimensions -- just with more whitespace for the initials in the width dimension?
I don't actually care if the target PDF is letter, or legal, or A4 -- my physical signature size doesn't get larger if I'm signing a larger paper! ... I wouldn't sign any smaller or larger just because my page is landscape.
So essentially, you are saying that the size of the signature PDF should matter. I think this seems like a valid point, especially since PDF sizes are designed to say something about physical size, and not about resolution or quality, especially since we expect to (usually) get non-rasterized signature PDFs.
Its really unclear to me what "page width units" and "page height units" means.
Your first reading is (almost?) correct. What it means is that by default, the signature is scaled (proportionally) to the maximum size that fulfills both of these conditions: 1) The width is no greater than 28% of the page width and 2) The height is no greater than 11% of the page height.
I'm not exactly sure why I thought this was a good idea. Perhaps I imagined a use case where you'd like to sign the same document with many different signatures, but that seems far-fetched.
Also useful information, and also not mentioned in the docs or the README.
The README does mention something similar: "Keep in mind that it's the center of this mini-page that will be used for positioning the signature." Not clear enough by far, and needs to be much improved.
Just to make sure I understand the overall point correctly, if I want my signature and my initials to show up as approximately the same height (because physically they are approximately the same height), then I need to put them into PDFs with the same dimensions -- just with more whitespace for the initials in the width dimension?
If you use the default settings, I guess that is one way. Another way is to make sure your signature is no wider than 28/11 of its height; that way, the height is what will determine the scaling in both cases. You can also apply an argument -W 1
to make the height the limiting factor in both cases.
I imagine you will find all approaches mentioned rather unsatisfying and I agree. I'd like feedback on the proposed improvement below:
1
, meaning that the signature will retain its actual size as specified in the PDF.
Any suggestion for a suitable option letter?-W
and -H
like so:
pts
, in
, cm
, and mm
, similarly to what is already supported by pdf-create-empty
. This will enable you to specify the maximum signature size in absolute terms.-W
and -H
, whichever is less.
With all three defaults all set to 1, it means the signature will retain its actual size unless it's bigger than the document page in either direction.
Perhaps this is not desired? Would it be better if -W
an -H
defaulted to infinity, and the scaling factor defaulted to infinity if -W
or -H
is given and otherwise 1
?
This might be more intuitive in practice but more difficult to understand from the help text.-X
and -Y
like so:
pts
, in
, cm
, and mm
.
Unit-less still means page width/height units.-X R-1in
means 1 inch left of right edge.
Left/top edge would be default, so -X L+2mm
is equivalent to -X 2mm
.I don't actually care if the target PDF is letter, or legal, or A4 -- my physical signature size doesn't get larger if I'm signing a larger paper! ... I wouldn't sign any smaller or larger just because my page is landscape.
So essentially, you are saying that the size of the signature PDF should matter. I think this seems like a valid point, especially since PDF sizes are designed to say something about physical size, and not about resolution or quality, especially since we expect to (usually) get non-rasterized signature PDFs.
Yep. Though I think you mean "usually get rasterized" though right? Most people will write their signature on paper and then scan it, so its not a vector source.
Its really unclear to me what "page width units" and "page height units" means.
Your first reading is (almost?) correct. What it means is that by default, the signature is scaled (proportionally) to the maximum size that fulfills both of these conditions: 1) The width is no greater than 28% of the page width and 2) The height is no greater than 11% of the page height.
I'm not exactly sure why I thought this was a good idea. Perhaps I imagined a use case where you'd like to sign the same document with many different signatures, but that seems far-fetched.
The use case seems right but not sure the reasoning :shrug: . For example, many documents need both initials and full signatures. Also many documents need witness or co-signer signatures -- I'll quite often insert my wife's signature (with her consent of course!) on the same PDF where I insert mine.
Also useful information, and also not mentioned in the docs or the README.
The README does mention something similar: "Keep in mind that it's the center of this mini-page that will be used for positioning the signature." Not clear enough by far, and needs to be much improved.
:+1:
Just to make sure I understand the overall point correctly, if I want my signature and my initials to show up as approximately the same height (because physically they are approximately the same height), then I need to put them into PDFs with the same dimensions -- just with more whitespace for the initials in the width dimension?
If you use the default settings, I guess that is one way. Another way is to make sure your signature is no wider than 28/11 of its height; that way, the height is what will determine the scaling in both cases. You can also apply an argument
-W 1
to make the height the limiting factor in both cases.I imagine you will find all approaches mentioned rather unsatisfying and I agree. I'd like feedback on the proposed improvement below:
:+1:
- Add an option for scaling factor that defaults to
1
, meaning that the signature will retain its actual size as specified in the PDF.
:+1:
Any suggestion for a suitable option letter?
Maybe --actual-size
/ -a
?
Change
-W
and-H
like so:
- Add support for units
pts
,in
,cm
, andmm
, similarly to what is already supported bypdf-create-empty
. This will enable you to specify the maximum signature size in absolute terms.- Clarify that numbers without unit are taken to mean page width/height units.
- Clarify that these options specify maximum sizes.
- Change the defaults to 1 (page width/height unit).
All sounds good except I'm not certain I understand the last point. Wouldn't a page width/height unit of 1 mean the signature would cover the smaller dimension of the entire page?
- Clarify that the actual default size for a signature will be either exactly as specified by the scaling factor, or the maximum allowed by
-W
and-H
, whichever is less. With all three defaults all set to 1, it means the signature will retain its actual size unless it's bigger than the document page in either direction. Perhaps this is not desired? Would it be better if-W
an-H
defaulted to infinity, and the scaling factor defaulted to infinity if-W
or-H
is given and otherwise1
? This might be more intuitive in practice but more difficult to understand from the help text.
Ah, now I understand the previous point. I might go the other way and make the default 0.5 or something like that -- so the default will be the actual scale, or if that covers more than half the page, then it will scale down to half the page. That way in the normal case the signature will be actual size, and in the edge case, the signature will never (or rarely) cover the entire content of the page which might get confusing for people.
- Maybe add an option for anchor point: NW, N, NE, W, C, E, SW, S, SE. Default is C, meaning that the signature PDF is positioned such that the center of it is at the designated signature position. Or perhaps it should be W, so that you can click at the start of the signature line?
- Clarify in the README how to create a signature that works with the default anchor point.
Neat feature, but seems like overkill. I might just change the default so it is a bit more intuitive -- an anchor point of about 25% of the height from the bottom of the image in the vertical plane, and in the center in the horizontal plane, will generally do approximately the right thing where people are just creating signature PDFs without thinking about it too much i.e. centering their signature on an empty canvas with some whitespace around it.
Or you could leave it as-is bang-on in the center -- its intuitive for people that their signature shows up centered on the place they clicked.
For people that want the ability to click on the signature line, they can position their signature as you described.
- Change
-X
and-Y
like so:
- Add support for units
pts
,in
,cm
, andmm
. Unit-less still means page width/height units.- Clarify what page width/height units mean.
- Perhaps add ability to use the "other" page limit as origin, i.e.
-X R-1in
means 1 inch left of right edge. Left/top edge would be default, so-X L+2mm
is equivalent to-X 2mm
.
I don't have this use case myself at the moment, but for signing the same thing over and over, this is a great feature. Much easier to position by absolute values or absolute values relative to page limits, as opposed to page units.
Yep. Though I think you mean "usually get rasterized" though right? Most people will write their signature on paper and then scan it, so its not a vector source.
Ah I see the way you suggested creating signatures in the README would result in a vector signature.
In any case, I don't think it matters to the point. For a rasterized image, its even more important to try and avoid scaling and just use the input height and width as-is.
As a side note, I tried vectorizing my scanned signature in Inkscape but just couldn't figure out a way to capture most of the minute variations of colorization based on pen pressure. The signature ended up looking "too perfect".
Maybe
--actual-size
/-a
?
But it wouldn't describe the actual size. Rather, it's a scaling factor to be multiplied with the actual size to arrive at the resulting size. I'd use -s
/ --scale
, but -s
already means --signature
.
I might go the other way and make the default 0.5 or something like that
0.5 default sounds reasonable for default maximums, good idea.
Neat feature, but seems like overkill... Or you could leave it as-is bang-on in the center
I'll probably leave it then, and just make the documentation better.
Maybe
--actual-size
/-a
?But it wouldn't describe the actual size. Rather, it's a scaling factor to be multiplied with the actual size to arrive at the resulting size. I'd use
-s
/--scale
, but-s
already means--signature
.
Right, so maybe --resize
/ -r
? Or possible --size-ratio
/ -r
?
As a side note, I tried vectorizing my scanned signature in Inkscape but just couldn't figure out a way to capture most of the minute variations of colorization based on pen pressure. The signature ended up looking "too perfect".
Finally figured out a way to get a good vectorization result (maybe a wiki page or section in the README?).
Inkscape Trace Bitmap Multicolor mode, Detection mode = Grays, 32 scans (grayscale levels), Smooth On, Stack On, Remove Background On
followed by:
Filters Fill and Transparency Light Eraser (settings that worked for me were Expansion = 80, Erosion = 100, Global Opacity = 1)
See branch dev for a work-in-progress fix. Not very tested yet.
I haven't done much comprehensive testing, but I will note that the behavior out of the box on the dev branch with my signature and initials is good! My initials are imported with the size I would expect rather than blown up to a very large size as before.
I have a couple of issues with signatures of varying dimensions.
1) If the input width is some fractional number of points, pdf-sign appears to crash with the error:
pdfinfo from crashing input:
2) If the dimensions of the signature is smaller (such as I would have for initials, for example), pdf-sign blows it up to a very large size on the screen by default. I would expect a smaller input dimension to show up with a default size on the screen which is proportionally smaller.