Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
R44D44 opened this issue Mar 12, 2024 · 13 comments

Comments

@R44D44
Copy link

R44D44 commented Mar 12, 2024

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
Copy link
Owner

cleidigh commented Mar 13, 2024 via email

@R44D44
Copy link
Author

R44D44 commented Mar 13, 2024

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

@cleidigh
Copy link
Owner

@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
Copy link
Author

R44D44 commented Mar 13, 2024

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
Copy link
Owner

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

@cleidigh
Copy link
Owner

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

@R44D44
Copy link
Author

R44D44 commented Mar 13, 2024

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
Copy link
Owner

@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
Copy link
Author

R44D44 commented Mar 18, 2024

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
Copy link
Owner

@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
Copy link
Author

R44D44 commented Apr 3, 2024

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

@R44D44
Copy link
Author

R44D44 commented Apr 5, 2024

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
Copy link
Owner

cleidigh commented Apr 5, 2024

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants