You are not logged in.

#1 2013-08-30 17:03:00

mamamia88
Member
Registered: 2012-08-29
Posts: 483

Print File Name in footer CUPS?

So I'm ocd and have been selling a bunch of stuff on ebay lately and want to get the shipping proccess as as simple as possible.  So my idea is to print the shipping label to a pdf file with the name of the item sold as the filename and then mass print the pdfs with the filename somewhere on the page, so that when it's time to ship i don't have to triple check to make sure that the shipping label corresponds with the right item.  Is this at all possible with cups? EDIT: I see that I can customize a banner file but i don't see an option for filename.  I see an option for job id etc but nothing for filename.  So does that mean it's impossible?

Last edited by mamamia88 (2013-08-30 17:22:36)

Offline

#2 2013-08-30 18:55:13

Thaodan
Member
From: Dortmund, Nordrein-Westfalen
Registered: 2012-04-28
Posts: 448

Re: Print File Name in footer CUPS?

please be more clearly what you want to do. You can print a file in command line with lp or lpr


Linux odin 3.13.1-pf #1 SMP PREEMPT Wed Mar 5 21:47:28 CET 2014 x86_64 GNU/Linux

Offline

#3 2013-08-30 19:09:50

mamamia88
Member
Registered: 2012-08-29
Posts: 483

Re: Print File Name in footer CUPS?

Thaodan wrote:

please be more clearly what you want to do. You can print a file in command line with lp or lpr

i want the name of the file printed on the physical piece of paper when i print it.

Offline

#4 2013-08-30 19:28:39

Thaodan
Member
From: Dortmund, Nordrein-Westfalen
Registered: 2012-04-28
Posts: 448

Re: Print File Name in footer CUPS?

I don't know how to edit pdf in commandd line but with a text file you could it the file name to the head eg.

for file in *.txt ; do
echo $file > ${file}.1 
cat $file >>  $f{file}.1
lp ${file}.1
done
rm -f *.txt.1

Last edited by Thaodan (2013-08-30 19:29:59)


Linux odin 3.13.1-pf #1 SMP PREEMPT Wed Mar 5 21:47:28 CET 2014 x86_64 GNU/Linux

Offline

#5 2013-08-30 19:34:43

mamamia88
Member
Registered: 2012-08-29
Posts: 483

Re: Print File Name in footer CUPS?

Thaodan wrote:

I don't know how to edit pdf in commandd line but with a text file you could it the file name to the head eg.

for file in *.txt ; do
echo $file > ${file}.1 
cat $file >>  $f{file}.1
lp ${file}.1
done
rm -f *.txt.1

What i really want is to be able to print shipping labels from ebay and include the name of the item corresponding to the shipping label directly on the shipping label.  That way it makes it easier to make sure the right shipping label goes on the right package. For example i shipped out 15 videogames the other day and had to double and triple check that i didn't send out the wrong game to wrong person.

Offline

#6 2013-08-31 17:28:05

cookies
Member
Registered: 2013-01-17
Posts: 253

Re: Print File Name in footer CUPS?

This propably isn't about just generating a list (or something like that) and printing it. I guess you want it to be automated (or you could just use pen and paper instead). So before we try and find the right tools for the job you should answer the following two questions:

1) How should the print out look like (more specifically: what data is shown there?)?
Something like this maybe?

Buyer Name
and Address

Items:
- Game 1
- Game 3
- Game 7

2) How can you get the data out of ebay?
Are there helper tools that can save the data in some kind of text form? Do you have to copy & paste the data from the website? Or could you try and process emails from ebay?

Offline

#7 2013-08-31 17:41:35

mamamia88
Member
Registered: 2012-08-29
Posts: 483

Re: Print File Name in footer CUPS?

Well what I hoped to accomplish was to print a shipping label to PDF format with the name of item sold as the filename.PDF.  then when finished bulk print the labels and have the name of file in either the header or footer of the page.  Printing label only takes up half a page or so so there is plenty of whitespace

Offline

#8 2013-08-31 17:42:35

mamamia88
Member
Registered: 2012-08-29
Posts: 483

Re: Print File Name in footer CUPS?

Well what I hoped to accomplish was to print a shipping label to PDF format with the name of item sold as the filename.PDF.  then when finished bulk print the labels and have the name of file in either the header or footer of the page.  Printing label only takes up half a page or so so there is plenty of whitespace

Offline

#9 2013-08-31 18:14:11

cookies
Member
Registered: 2013-01-17
Posts: 253

Re: Print File Name in footer CUPS?

Ah, okay, got it. How do you generate the pdf files?

Edit:
In case of LaTeX take a look at http://tex.stackexchange.com/questions/ … -file-name

Last edited by cookies (2013-08-31 18:26:39)

Offline

#10 2013-08-31 19:34:48

mamamia88
Member
Registered: 2012-08-29
Posts: 483

Re: Print File Name in footer CUPS?

cookies wrote:

Ah, okay, got it. How do you generate the pdf files?

Edit:
In case of LaTeX take a look at http://tex.stackexchange.com/questions/ … -file-name

With the built in functionality of cups to print to file

Offline

#11 2013-08-31 20:53:28

cookies
Member
Registered: 2013-01-17
Posts: 253

Re: Print File Name in footer CUPS?

Okay, so you create some initial source file that contains the data you want to print. Then you convert this source file to pdf via the CUPS print-to-pdf feature. How do you create the initial source file?

Right now I can see two ways of getting the file name into the document.

Most office suits should be able to do what you want. With libre office (I tested it with lowriter) you can just hit ctrl+F2 and add the file name (and a lot of other things); it should be updated automatically for you if you change the file name. Don't forget to save the file!
Also, libre office can export to pdf directly. If you have libre office installed you might give it a try.

If you use plain text files, you might add some place holder somewhere and have it replaced by sed (or you could simply append the name at the end). Since you want to work with the pdf files in the end you can write a script that replaces the place holder with the file name and then generates the pdf for you.

Offline

#12 2013-09-01 02:53:16

mamamia88
Member
Registered: 2012-08-29
Posts: 483

Re: Print File Name in footer CUPS?

cookies wrote:

Okay, so you create some initial source file that contains the data you want to print. Then you convert this source file to pdf via the CUPS print-to-pdf feature. How do you create the initial source file?

Right now I can see two ways of getting the file name into the document.

Most office suits should be able to do what you want. With libre office (I tested it with lowriter) you can just hit ctrl+F2 and add the file name (and a lot of other things); it should be updated automatically for you if you change the file name. Don't forget to save the file!
Also, libre office can export to pdf directly. If you have libre office installed you might give it a try.

If you use plain text files, you might add some place holder somewhere and have it replaced by sed (or you could simply append the name at the end). Since you want to work with the pdf files in the end you can write a script that replaces the place holder with the file name and then generates the pdf for you.

I'm trying to make this simpler not more complicated. To print to pdf you just go file>print>print to file>select pdf>type in name you want for file.  I don't want to go editing the file I just would like the name of the file to be included on the document.    Sure I could go write it out but the printer is in another room and i'd prefer not to make a million trips back and forth

Offline

#13 2013-09-01 14:27:13

cookies
Member
Registered: 2013-01-17
Posts: 253

Re: Print File Name in footer CUPS?

Okay, I've just uploaded a libre office example for you (http://sachen.themonkeyhead.de/arch/example.odt), so you know what I was talking about. This should be the simplest and quickest way I can think of (unless of course you start selling much more items).

mamamia88 wrote:

To print to pdf you just go file>print>print to file>select pdf>type in name you want for file.

If you don't use libre office, then please tell me which program you use, to do exactly that.

Offline

#14 2013-09-01 16:55:47

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,547
Website

Re: Print File Name in footer CUPS?

Use imagemagick's convert

#!/bin/bash

convert -draw 'text 200,0 "$1"' $1 /tmp/new.pdf
mv /tmp/new.pdf $1

Experiment and adjust the 200,0 to be the x,y coordinates where you want the file name to be put in the file.  Note that as written this will overwrite the original file - so test carefully, or revise.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#15 2013-09-01 18:11:08

mamamia88
Member
Registered: 2012-08-29
Posts: 483

Re: Print File Name in footer CUPS?

cookies wrote:

Okay, I've just uploaded a libre office example for you (http://sachen.themonkeyhead.de/arch/example.odt), so you know what I was talking about. This should be the simplest and quickest way I can think of (unless of course you start selling much more items).

mamamia88 wrote:

To print to pdf you just go file>print>print to file>select pdf>type in name you want for file.

If you don't use libre office, then please tell me which program you use, to do exactly that.

literally any program you can print from.  it's built in here's a picture

http://i443.photobucket.com/albums/qq15 … ce17ae.png




-- mod edit: read the Forum Etiquette and only post thumbnails http://wiki.archlinux.org/index.php/For … s_and_Code [jwr] --

Offline

#16 2013-09-01 18:29:15

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: Print File Name in footer CUPS?

This stackoverflow thread has a similar question and a generic *nix solution that may work for you:

http://stackoverflow.com/questions/1119 … os-x-appli

cups-pdf is in the Arch repos.

Last edited by skottish (2013-09-01 18:30:30)

Offline

#17 2013-09-01 18:36:32

2ManyDogs
Forum Fellow
Registered: 2012-01-15
Posts: 4,648

Re: Print File Name in footer CUPS?

mamamia88 wrote:

literally any program you can print from.  it's built in here's a picture

But what tool are you using? If you are using libreoffice (or can use it) just use the example cookies was generous enough to provide. If you are using another tool we will need to know exactly what you're using, or you will have to figure it out yourself based on the example you go from cookies.

(edit) never mind -- Trilby answered my question. Good luck.

Last edited by 2ManyDogs (2013-09-01 18:47:26)

Offline

#18 2013-09-01 18:45:44

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,547
Website

Re: Print File Name in footer CUPS?

2ManyDogs wrote:

But what tool are you using?

I don't know why the OP would be so secretive about the answer - but the context makes it pretty clear it is a webbrowser.  He want's to print labels from ebay.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

Board footer

Powered by FluxBB