LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-28-2023, 08:45 AM   #1
rblampain
Senior Member
 
Registered: Aug 2004
Location: Western Australia
Distribution: Debian 11
Posts: 1,289

Rep: Reputation: 52
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.
 
Old 08-28-2023, 08:49 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,954

Rep: Reputation: 7329Reputation: 7329Reputation: 7329Reputation: 7329Reputation: 7329Reputation: 7329Reputation: 7329Reputation: 7329Reputation: 7329Reputation: 7329Reputation: 7329
google is your friend: https://superuser.com/questions/4523...-in-a-pdf-file
 
Old 08-28-2023, 09:07 AM   #3
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,699

Rep: Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972
Quote:
Originally Posted by rblampain View Post
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???
 
Old 08-28-2023, 10:13 AM   #4
rblampain
Senior Member
 
Registered: Aug 2004
Location: Western Australia
Distribution: Debian 11
Posts: 1,289

Original Poster
Rep: Reputation: 52
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.
 
Old 08-28-2023, 11:32 AM   #5
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,699

Rep: Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972
Quote:
Originally Posted by rblampain View Post
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.

Last edited by TB0ne; 08-28-2023 at 11:35 AM.
 
Old 08-28-2023, 11:47 AM   #6
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,954

Rep: Reputation: 7329Reputation: 7329Reputation: 7329Reputation: 7329Reputation: 7329Reputation: 7329Reputation: 7329Reputation: 7329Reputation: 7329Reputation: 7329Reputation: 7329
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.
 
1 members found this post helpful.
Old 08-29-2023, 05:52 AM   #7
rblampain
Senior Member
 
Registered: Aug 2004
Location: Western Australia
Distribution: Debian 11
Posts: 1,289

Original Poster
Rep: Reputation: 52
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.
 
Old 08-29-2023, 07:47 AM   #8
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,699

Rep: Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972
Quote:
Originally Posted by rblampain View Post
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.

Last edited by TB0ne; 08-29-2023 at 07:50 AM.
 
Old 08-29-2023, 07:56 AM   #9
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,954

Rep: Reputation: 7329Reputation: 7329Reputation: 7329Reputation: 7329Reputation: 7329Reputation: 7329Reputation: 7329Reputation: 7329Reputation: 7329Reputation: 7329Reputation: 7329
Quote:
Originally Posted by TB0ne View Post
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).
 
1 members found this post helpful.
Old 08-29-2023, 08:03 AM   #10
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,699

Rep: Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972
Quote:
Originally Posted by pan64 View Post
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Find/grep command to find matching files, print filename, then print matching content stefanlasiewski Programming 9 06-30-2016 05:30 PM
How can we convert a dynamic library (filename.so) to a static library (filename.a). hanumaan Programming 4 11-20-2009 12:07 AM
Convert static library (Filename.a) to dynamic shared object (filename.so) afx2029 Linux - Software 4 08-17-2007 06:07 AM
change uploaded files from filename.avi to filename.avi.html like www.rapidshare.de latheesan Linux - Newbie 3 06-16-2005 04:33 AM
filename- and filename~ files? slinky2004 Linux - Newbie 5 10-17-2004 10:32 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:48 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration