Connecting Tech Pros Worldwide Forums | Help | Site Map

custom printing

r6uji7
Guest
 
Posts: n/a
#1: Jul 17 '05
hello,

is it possible to print certain details on a fixed area of a paper
using PHP?

here's the scenario:

i'm trying to print labels with names and addresses. the names and
addresses are stored in the database.

after i retrieve the details, i should be able to print as many (or as
less) number of details as many (or as less) number of times at a
specified position.

for example if i have a sheet of paper that can hold 12 addresses with
4 rows and 3 columns, i can have the page marked areas as

a11 a12 a13
a21 a22 a21
a31 a32 a33
a41 a42 a43

each of which denotes a label.

is it possible to print the label say at position a32? or 2 labels
starting at position a33 and a41? (assuming we are printing it in a "Z"
format)

regards,
ranjit


Ken Robinson
Guest
 
Posts: n/a
#2: Jul 17 '05

re: custom printing



r6uji7 wrote:[color=blue]
> hello,
>
> is it possible to print certain details on a fixed area of a paper
> using PHP?
>
> here's the scenario:
>
> i'm trying to print labels with names and addresses. the names and
> addresses are stored in the database.
>[/color]

PHP is used to retrieve the information. You should use HTML or,
better, CSS to format your page. Using CSS you can format your data
one way for the screen and another way for printing.

Ken

Daniel Tryba
Guest
 
Posts: n/a
#3: Jul 17 '05

re: custom printing


r6uji7 <r6uji7@gmail.com> wrote:[color=blue]
> is it possible to print certain details on a fixed area of a paper
> using PHP?
>
> here's the scenario:[/color]
[snip]

Certainly. All you have to know is the documentformat you need to print.
You could generate eg postscript or pcl and send that directly to a
printer, or you could render pdf/html/rdf/doc/images and send that to a
program capable of rendering/printing the specific format.

Philip Ronan
Guest
 
Posts: n/a
#4: Jul 17 '05

re: custom printing


Here's another suggestion: export the address labels from PHP as an XML
file, and use an application like InDesign to import it into a predefined
template

see <http://www.adobe.com/products/indesign/crossmedia.html#xmlID>

Phil

--
phil [dot] ronan @ virgin [dot] net
http://vzone.virgin.net/phil.ronan/


Jamie Isaacs
Guest
 
Posts: n/a
#5: Jul 17 '05

re: custom printing


Ken Robinson wrote:[color=blue]
> r6uji7 wrote:
>[color=green]
>>hello,
>>
>>is it possible to print certain details on a fixed area of a paper
>>using PHP?
>>
>>here's the scenario:
>>
>>i'm trying to print labels with names and addresses. the names and
>>addresses are stored in the database.
>>[/color]
>
>
> PHP is used to retrieve the information. You should use HTML or,
> better, CSS to format your page. Using CSS you can format your data
> one way for the screen and another way for printing.
>
> Ken
>[/color]

I do this sort of thing with XML -> XSLT -> XSL-FO -> PDF

Web browsers are not good for reports that rely on pagination. XSLT will
give you complete control of the layout whether your output is PDF or
whatever format.

http://xml.apache.org/fop/

-JI
Chung Leong
Guest
 
Posts: n/a
#6: Jul 17 '05

re: custom printing


"r6uji7" <r6uji7@gmail.com> wrote in message
news:1105453596.277358.58380@f14g2000cwb.googlegro ups.com...[color=blue]
> hello,
>
> is it possible to print certain details on a fixed area of a paper
> using PHP?[/color]

If you want to get precise print out, you pretty much have to use PDF. PHP
has functions for creating PDF files. Printing out a grid with text should
be fairly straight forward to implement. Just look in the PHP online manual.

If you don't want to bother with that, a really dumb way to achieve that
same thing is to create an uncompressed PDF file with placeholder text
strings, something like


11111111 22222222 3333333
44444444 55555555 6666666


then do a search and replace on the placeholders. Just need to keep the
number of characters the same, padding with white spaces when necessary.


Roy W. Andersen
Guest
 
Posts: n/a
#7: Jul 17 '05

re: custom printing


r6uji7 wrote:[color=blue]
> hello,
>
> is it possible to print certain details on a fixed area of a paper
> using PHP?[/color]

As others have already pointed out, PDF is a good way to go with this.
For simple PDF-creation (actually quite advanced as well if you put your
mind to it), I recommend the FPDF class.

http://www.fpdf.org/

It doesn't require PDFlib, nor does it require PHP to be (re)compiled
with PDFlib-support, and it's very easy to use. It's also free, as
opposed to PDFlib which costs €/$450 for commercial use. On the FPDF
website you'll also find a script that extends the class which lets you
print labels very easily - all you need to know is the dimensions of the
label-sheet(s) you want to support and add them to the script. I've been
using that for a while and it works flawlessly :)



Roy W. Andersen
--
ra at broadpark dot no / http://roy.netgoth.org/

"Hey! What kind of party is this? There's no booze
and only one hooker!" - Bender, Futurama
r6uji7
Guest
 
Posts: n/a
#8: Jul 17 '05

re: custom printing


thanks one and all for your inputs! i guess fpdf seems like a good
option to start with before i can confidently move onto xml/xsl stuff.
thank you everyone once again.

Jamie Isaacs
Guest
 
Posts: n/a
#9: Jul 17 '05

re: custom printing


r6uji7 wrote:[color=blue]
> thanks one and all for your inputs! i guess fpdf seems like a good
> option to start with before i can confidently move onto xml/xsl stuff.
> thank you everyone once again.
>[/color]

Good luck with that. Remember that you are restricting your reports to
rely on php. If you have another project that needs to print the same
report from a different language, you are out of luck. I don't know of
many companies using XSL-FO. The one I know that does just offered me a
job based on that skill set alone.

It can be time consuming to learn the XSLT and XSL-FO language, but the
results are tenfold. I know this isn't the proper group to discuss this,
but people developing web applications in PHP need to be aware of better
alternatives to fpdf. Because this is a relatively new language, there
are not very many GUI programs to help write the translation style
sheet. In time the prices will drop for them and maybe a "good" open
source one will fall out.

http://groups.yahoo.com/group/XSL-FO/message/2344

-JI
Closed Thread