LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Can I print an email with its filename (https://www.linuxquestions.org/questions/programming-9/can-i-print-an-email-with-its-filename-4175728441/)

rblampain 08-28-2023 08:45 AM

Can I print an email with its filename
 
I have a number of emails saved as .pdf files.
It is easy enough to print them but I'd like to also print the filename in the top right corner so that the printed pages show the email with their filename (not the full path) in the top right corner.

I have used "convert" on .jpg files but this does not work (easily) on PDF files.

How can I do that?

Thank you for your help.

pan64 08-28-2023 08:49 AM

google is your friend: https://superuser.com/questions/4523...-in-a-pdf-file

TB0ne 08-28-2023 09:07 AM

Quote:

Originally Posted by rblampain (Post 6450648)
I have a number of emails saved as .pdf files. It is easy enough to print them but I'd like to also print the filename in the top right corner so that the printed pages show the email with their filename (not the full path) in the top right corner.

I have used "convert" on .jpg files but this does not work (easily) on PDF files. How can I do that?

Seems to fit in nicely with your (several) other related threads:
https://www.linuxquestions.org/quest...ce-4175722994/
https://www.linuxquestions.org/quest...le-4175720764/
https://www.linuxquestions.org/quest...ck-4175728390/

If you're created the source PDF's, why not write a script to simply insert the filename at the top, before PDF conversion??? Or use Libreoffice and set the header/footer to print it?? Or use convert:
Code:

#!/bin/bash
convert -draw 'text 200,0 "$1"' $1 /some/new/filename.pdf
mv /some/new/filename.pdf $1

...to do it??? All things you've been told about before and could find with a small bit of research. There are also options for CUPS you can enable. Have you done any research of your own???

rblampain 08-28-2023 10:13 AM

It is not emails I am sending, it is emails I have received over the years and saved on my machine as pdf files.
Imagemagick keeps giving errors apparently due to the size limit (that's my research) and being a one off job, I am hoping not to have to change config files.
As I have said, "convert" works on jpg files (photos attached to emails) but not on the pdf files (emails) and processing files one at a time is not a option since I have to print a number of copies of each.

I am amazed to see that linuxquestion.org survives when some of its members try their best to make one feel unwelcome.

TB0ne 08-28-2023 11:32 AM

Quote:

Originally Posted by rblampain (Post 6450656)
It is not emails I am sending, it is emails I have received over the years and saved on my machine as pdf files.

Which we figured, based on your previous posts
Quote:

Imagemagick keeps giving errors apparently due to the size limit (that's my research) and being a one off job, I am hoping not to have to change config files.
If you told us what you're actually doing/entering, what the message is you're getting, so we can't tell you much.
Quote:

As I have said, "convert" works on jpg files (photos attached to emails) but not on the pdf files (emails) and processing files one at a time is not a option since I have to print a number of copies of each.
Again, you're not telling us what you're doing/seeing...do you expect us to guess????
Quote:

I am amazed to see that linuxquestion.org survives when some of its members try their best to make one feel unwelcome.
And we are amazed that we have to continually tell some of it's members to actually do research, tell us what they've done/tried, and provide actual details. Yet here we are. Despite you being given:
  • The exact convert command needed to put text into a PDF (with a script to process numerous)
  • The advice to use Libreoffice, which can print a header/footer with the file name
  • The advice to put the text into the email BEFORE PDF conversion
....that's somehow not enough. The script you were given works just fine...modify the placement as needed. If you (AGAIN) don't actually TELL US what you did/tried/researched/read/whatever, we don't know. We can't guess, so just saying "how can I do that?" implies you've done nothing. Following it up with complaining about "that's my research" and still providing no details also tells us nothing.

pan64 08-28-2023 11:47 AM

I don't really understand why do you want to print them, no one will read these, ever. Additionally you wanted to print the pdf with filenames, you do not need to convert anything, the print tool can do this without changing the pdf files (regardless of the number of copies). Just read the link or any other similar page about that. And as it was mentioned you have got a lot of different advice already.

rblampain 08-29-2023 05:52 AM

This is an unusual situation and it is also a court case.
The "opposing party" thought that, to confuse their opponents (me), they produced a single "image" consisting of 198 photos presumably thinking that their opponents would not be able to refer to any of the 198 photos individually.

I splitted these images and the first and the only person confused was the (acting) judge who looked at "the photo" thinking that "the photo" was proof of what the party was claiming and this judge (a "registrar" presumably a lawyer in training) in turn found a clever solution and ordered the parties (that is every body involved) to
Quote:

produce to the court and to every other party printed copies of what they rely upon..
(I am not a lawyer).

Quote:

I don't really understand why do you want to print them, no one will read these, ever.
I do not want to print them, I have no other option than printing them.

Printing the photos (.jpg files) by themselves was not good enough since the "printed" photo would have had no identification but "convert" solved the problem since I could "annotate" each photo with its (individual) number and later refer to "photo number one" etc.
But as I said, "convert" or mogrify do not work on PDF file without changing the config file and testing the result.

One single error in numbering these emails is enough for anyone to claim that what has been done is not trustworthy hence the necessity to have the file name of each email found electronically and "printed" on the "printed" copy of the email.
Any other method that involves "entering" any value (by hand) may make the "evidence" "inadmissible" or no evidence at all.

The point is not to have something added by any means to the printed copy of the email, it is to have its filename added (or present) in an indisputable way (making sure that human error was not possible).

So far, the only solution I have found is to scan each email with a script (which I have done), find its date and time and use that as a filename but the date contains slashes which are not acceptable characters in a filename.
As a worst-case solution, I can replace every slash and space with a dash which would make the date and time as the new filename (almost) indisputable since the email would remain in its original state.

I still have to investigate fully the other solutions proposed but at first glance, they all involve processing each email individually and entering a value.

Repeating myself, processing each email individually and entering any value is not an option and I do not want to spend time finding why "convert" does not work after having found on the internet that it fails on PDF files due to the size limit.

My objective is, if one thing does not work "out-of-the-box", find another that does.

TB0ne 08-29-2023 07:47 AM

Quote:

Originally Posted by rblampain (Post 6450819)
This is an unusual situation and it is also a court case. The "opposing party" thought that, to confuse their opponents (me), they produced a single "image" consisting of 198 photos presumably thinking that their opponents would not be able to refer to any of the 198 photos individually.

I splitted these images and the first and the only person confused was the (acting) judge who looked at "the photo" thinking that "the photo" was proof of what the party was claiming and this judge (a "registrar" presumably a lawyer in training) in turn found a clever solution and ordered the parties (that is every body involved) to

(I am not a lawyer). I do not want to print them, I have no other option than printing them.

Obviously not a lawyer, and not too concerned with this 'court case', because if you were and you DID consult an actual lawyer, they'd tell you that PDF's are 100% acceptable in court, and have been for MANY years. They can even be digitally signed and/or password protected. Did you ask your lawyers???
Quote:

Printing the photos (.jpg files) by themselves was not good enough since the "printed" photo would have had no identification but "convert" solved the problem since I could "annotate" each photo with its (individual) number and later refer to "photo number one" etc. But as I said, "convert" or mogrify do not work on PDF file without changing the config file and testing the result.
And you *STILL* don't tell us what this mystery error is, what config files you're talking about, or what you're seeing. Nor why it's a huge deal to change a config file on your local system.
Quote:

One single error in numbering these emails is enough for anyone to claim that what has been done is not trustworthy hence the necessity to have the file name of each email found electronically and "printed" on the "printed" copy of the email. Any other method that involves "entering" any value (by hand) may make the "evidence" "inadmissible" or no evidence at all.

The point is not to have something added by any means to the printed copy of the email, it is to have its filename added (or present) in an indisputable way (making sure that human error was not possible).
...which is what you were given, in a few different ways.
Quote:

So far, the only solution I have found is to scan each email with a script (which I have done), find its date and time and use that as a filename but the date contains slashes which are not acceptable characters in a filename. As a worst-case solution, I can replace every slash and space with a dash which would make the date and time as the new filename (almost) indisputable since the email would remain in its original state.

I still have to investigate fully the other solutions proposed but at first glance, they all involve processing each email individually and entering a value. Repeating myself, processing each email individually and entering any value is not an option and I do not want to spend time finding why "convert" does not work after having found on the internet that it fails on PDF files due to the size limit. My objective is, if one thing does not work "out-of-the-box", find another that does.
Not sure what you need to 'fully investigate'...you were HANDED A SCRIPT to process PDF's, and overlay the text of the filename on it. The ONLY thing you have to change is where you want the output. Want to process 1,000 files??? Great...take what you were handed, and put a loop in it, to read all the filenames. You are now done.

Want something else??? Open it in Libreoffice, where you can digitally sign it, and print it with the filename in the header/footer as you were told. Concerned about going to 'court'? Then ask your attorney, because they know far more about what they need/want/can-accept than you do.

pan64 08-29-2023 07:56 AM

Quote:

Originally Posted by TB0ne (Post 6450831)
Concerned about going to 'court'? Then ask your attorney, because they know far more about what they need/want/can-accept than you do.

That is the way.
However, no one will read them all, so you should select and print only the important ones (if any).

TB0ne 08-29-2023 08:03 AM

Quote:

Originally Posted by pan64 (Post 6450832)
That is the way.
However, no one will read them all, so you should select and print only the important ones (if any).

And to add to things; the fact that the OP seems to want things that are 'trustworthy' and somehow beyond suspicion....yet seem to ignore the fact that THEY are the ones printing them, and annotating them BEFORE they get to court. If anyone is going to claim things are sketchy, that'd to it for me, rather than dumping ALL my stuff to my lawyer, then having them print/annotate/file/whatever to make sure MY hands are well off things, so no one could claim I did anything.


All times are GMT -5. The time now is 10:38 PM.