cleidigh / printing-tools-ng

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

format pdf filename possible issue with subject Content-Length or forbidden characters #247

Open R44D44 opened 8 months ago

R44D44 commented 8 months ago

i am trying to print an email using ${prefix} ${subject} as filename (Dateinamenformat) within the pdf print options. the resulting filename is not as expected.

as prefix i use %y %m %d %H %M

the subject has 118 characters, also some +/() in it

PrintingTools NG will not format the pdf filename according to what i have set. it gives out differnet versions of subject, depending on the pdf printer used. using pdf xchange standart printer it will give out the word after / and the first character after whats in the brackets.

using "save as pdf" it gives out the subject as filename without / and without prefix.

microsoft print to pdf and adobe pdf gives no filename.

OS windows 10 TB 115.8.0 64bit PrintingTools NG 3.0.1

bug or human error?

cleidigh commented 8 months ago

Can you also do a screenshot of the pdf options tab?

On Tue, Mar 12, 2024 at 1:05 PM R44D44 @.***> wrote:

i am trying to print an email using ${prefix} ${subject} as filename (Dateinamenformat) within the pdf print options. the resulting filename is not as expected.

as prefix i use %y %m %d %H %M

the subject has 118 characters, also some +/() in it

PrintingTools NG will not format the pdf filename according to what i have set. it gives out differnet versions of subject, depending on the pdf printer used. using pdf xchange standart printer it will give out the word after / and the first character after whats in the brackets.

using "save as pdf" it gives out the subject as filename without / and without prefix.

microsoft print to pdf and adobe pdf gives no filename.

OS windows 10 TB 115.8.0 64bit PrintingTools NG 3.0.1

bug or human error?

— Reply to this email directly, view it on GitHub https://github.com/cleidigh/printing-tools-ng/issues/247, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGAZ76ZOSZD5IU62IVVJWADYX4YUHAVCNFSM6AAAAABESUMMHGVHI2DSMVQWIX3LMV43ASLTON2WKOZSGE4DEMRSGA3TGOI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

R44D44 commented 8 months ago

shure. i was playing with different characters/tokens. it did not change the outcome. examples: 2024-03-13_103438 2024-03-13_103534

cleidigh commented 8 months ago

@R44D44 Thanks, the screenshots helped. So there are a couple of things to start with. First the filename is constructed in the Dateinamenformat field. This is where the tokens should be and where the substitutions are made. So for example the prefix and suffix are supposed to be static text, no tokens. You have placed time/date items which will never be formatted. This is what the custom date field is for.

Now assuming you want the custom date then the subject, here is the setup:

custom date: %y %m %d %H %M Dateinamenformat: ${date_custom} ${subject}

Now as for the special characters +/() The forward slash / is one of several illegal windows or Linux OS filename characters. The list is Invalid characters are: | * : < > ? \ / "

Each of these is substituted with an underscore _

The other characters are fine and should have no affect.

I have not seen different outputs from different pdf drivers so lets look at that once you are using the correct tokens. BTW all the above is in the help, but maybe needs clarification.

When you report back, give the exact message subject and resulting filenames so I can debug better. @cleidigh

R44D44 commented 8 months ago

thanx for looking into this. i was a little lost with the help and gave up after a couple of hours. so to confirm if i did the settings right, here it is. is this what you meant? problems persists. 2024-03-13_195711

cleidigh commented 8 months ago

@R44D44 Ok, but give me exactly what the message subject is and the resulting filenames for a given driver. @cleidigh

cleidigh commented 8 months ago

@R44D44 Also what is the exact sequence you do for printing including dialogs etc. @cleidigh

R44D44 commented 8 months ago

message subject is Gummilager Motor + Getriebe checken+ggf. tauschen MERCEDES BENZ T1 Bus/Kasten (601) 210 2.3 (Bremer Modell) B-HT 9368H output with the settings here is as follows using pdf-exchange standard Driver Version: 10.0.18362.1: Kasten (601) 210 2.pdf save as pdf: Gummilager Motor + Getriebe checken+ggf. tauschen MERCEDES BENZ T1 Bus_Kasten (601) 210 2.3 (Bremer Modell) B-HT 9368H.pdf microsoft print to pdf: empty/malfunction adobe pdf: *.pdf

i select the message and click on Drucken NG in the menu bar. the preview appears fine. i click print and copy the filename here.

cleidigh commented 8 months ago

@R44D44 Thanks, now I know the issue. There is a disconnect between the Thunderbird and the pdf drivers. PrintingTools is not able to pass the output name via print preview. The various pdf drivers usually use just the pure subject as a name. The Microsoft PDF driver has a blank name. Some may give partials due to the invalid slash.

To use the auto naming you have to enable the pdf output directory and set the directory. Then when you press print you will be given the option to autosave the PDF or preview. Choose Autosave and your filename will be used. Hope that helps. @cleidigh

R44D44 commented 8 months ago

thats the solution. but it also works here without enabling the pdf output directory, just print+select the folder you wish the pdf to be saved. thanx!

cleidigh commented 8 months ago

@R44D44 Great! It wasn't clear from above, but I think you used the Don't display dialog option? I should have remembered that. The truth is there are so many paths I forget sometimes. Normally that would be a silent print, however, for PDF without a defined directory a folder picker is necessary. Cheers, Christopher

R44D44 commented 7 months ago

Clipboard01 first option lets me select the output folder, even with multiple emails selected

R44D44 commented 7 months ago

now with v. 3.0.1. the filename shortens the 4 digit year to 2 digits. so i get 24 instead of 2024. still using same settings. 2024-04-05_095646

cleidigh commented 7 months ago

@R44D44 If you look in the custom date help table you will see %y is the two digit year. For four digits use %Y (capital Y) @cleidigh