cleidigh / printing-tools-ng

PrintingTools NG Thunderbird Extension - Printing Utilities
Other
34 stars 17 forks source link

Position of header and footer lines #258

Open b30047 opened 6 days ago

b30047 commented 6 days ago

I can't set the distance of header and footer line from top or bottom. They are always near the page margins (I print A4). Strange enough when I print to letter format and afterwards let PDF Expert convert the pages to A4 I get a reasonable whiteroom form the margins. But this is a cumbersome process.

In the meantime I found a tip from nikitalita that seems to work when printing to PDF:

`Go to about:config, add the following "number" settings:

print.printer_Mozilla_Save_to_PDF.print_edge_bottom
print.printer_Mozilla_Save_to_PDF.print_edge_top
print.printer_Mozilla_Save_to_PDF.print_edge_left
print.printer_Mozilla_Save_to_PDF.print_edge_right

And set them all to "10" (which is about 1/10th of an inch)`

Currently I test "30"

cleidigh commented 6 days ago

@b30047 Thanks for posting here where we can discuss. That's very interesting what you found because I already did a check with edgeTop and had no success. From your post I understand you did? If so I have to check my experiment because I was doing it programmatically versus within the prefs, although it would not make sense .

I will try some further experiments. If this works I can probably do a printingtools preference that would apply to all printers, but I don't think I would be able to get these into the ui yet as that's really tight right now.

Anyway let's see what functions. @cleidigh

b30047 commented 6 days ago

Example:

240627 - [cleidigh_printing-tools-ng] Position of header and footer lines (Issue #258).pdf

cleidigh commented 2 days ago

@b30047 @kiki-ja @tidebre67

This is some new functionality that I implemented in response to @b30047 . I took the time to generalize it so we can add more options in the future.

So the OP asked for the ability to set the edge margins to control where the headers and footers show. For now I have implemented this as the first advanced printer option. Right now you set them in debug options, I may move later. So here is how you use it:

The options are set in the Debug options in the Misc tab. The options are space separated as usual. The format is :

P:printer-name::S:option-name=value

The printer name has the spaces escaped with underscores and the built in Save to PDF is Mozilla_Save_to_PDF

Another example Microsoft_Print_to_PDF

The current option-name possibilities are: edges, edgeTop, edgeBottom, edgeLeft, edgeRight

edges is a pseudo option that sets all the edge margins to the same value. The edge margins are in inches.

Examples:

P:Mozilla_Save_to_PDF::S:edges=0.25 P:Microsoft_Print_to_PDF::S:edgeTop=0.1

This all works on any printer assuming they respect these options. Note because of the way these options work, if you set one edge you have to set them all, that's why I added the edges pseudo option.

I also added a decent amount of error handling.

Very interested in people's responses. It's in beta 3, download here:

@cleidigh

kiki-ja commented 1 day ago

PTNG 3.1.0-b3 Thunderbird 128.0 b3 64bit Windows 10 Pro 22H2 64bit

Test Report: The following steps were performed

(1) Debug options:    P:Mozilla_Save_to_PDF::S:edges=0.25    misc tab -1

(2) Print preview:    Options = Print headers and footers to ON    Margins = Default or Custom (inches or mm)

(3) I was able to print at the inch position I set.    Test Message for PrintingTools NG  PrintingTools NG 用のテストメッセージです。       Issue: 1.Print preview requires 'Print headers and footers' to be turned on every time.   print preview - 3

2.Margins must be selected and specified each time as well. (The default cannot be immobilized).   margins       Other: Cannot copy and paste with mouse in debug options. #172

@kiki-ja

tidebre67 commented 1 day ago

Windows 10 Home 22H2 Thunderbird 115.12.2 (64-Bit) PTNG 3.1.0-b3

@cleidigh could not see any issue.

Issues mentioned by kiki-ja: i do not have these.

cleidigh commented 1 day ago

@tidebre67 Thanks! What do you think of the feature, do you ever want to set the headers and footers to be farther away than the defaults?

I'm very confused about @kiki-ja report. None of the logic has changed to show the custom margins and the headers and footers is enabled by the preview if any are non empty, ptng doesn't have to do anything.

@kiki-ja I have added some debug to the preview window settings and will post tonight. @cleidigh

cleidigh commented 1 day ago

@kiki-ja Very odd that anything has changed with the preview settings. I made b4 With preview debug. Add printsettings to debug options Then do print and capture console, but before you copy, click the expand twisties on both the initial and final preview html debug lines to fully expand. If b4 is still not working fall back to b2 before any of this was added. @cleidigh

cleidigh commented 1 day ago

@b30047 Did you get to try the beta? @cleidigh

kiki-ja commented 22 hours ago

PTNG 3.1.0-b4 Thunderbird 128.0 b6 64bit Windows 10 Pro 22H2 64bit

@cleidigh I have been able to confirm about the Issue and I stand corrected.

Issue: 1.Print preview requires 'Print headers and footers' to be turned on every time.

I had left headers and footers empty (blank) in the PTNG options. I confirmed that by default, in print preview, they are always on.

2.Margins must be selected and specified each time as well. (The default Cannot be immobilized).

In 'Mozilla_Save_to_PDF' the margins are all '0.5' by default. In print preview, I have confirmed that it will always be 'Custom'. I found that I have to manually switch to 'Default'. I always use 'Custom' so no problem.

@kiki-ja

tidebre67 commented 21 hours ago

@tidebre67 Thanks! What do you think of the feature, do you ever want to set the headers and footers to be farther away than the defaults?

I'm very confused about @kiki-ja report. None of the logic has changed to show the custom margins and the headers and footers is enabled by the preview if any are non empty, ptng doesn't have to do anything.

@kiki-ja I have added some debug to the preview window settings and will post tonight. @cleidigh

@cleidigh Windows 10 Home 22H2 Thunderbird 115.12.2 (64-Bit) now PTNG 3.1.0-b4

also here no issues .

once margins set in general not changed again. I like to see &PT ,but due to Windows language it looks 1 von 3 or so. This cannot be changed to 1/3 as far as i know. Therefore i leave header abd footer blank currently.

cleidigh commented 16 hours ago

@tidebre67 I wonder if we can get the total pages so we could format our own pages-total or whatever... @cleidigh

cleidigh commented 9 hours ago

@kiki-ja That is good. I was confused by it not working. Hopefully we will get some feedback from @b30047 @cleidigh