Re: PHP/HTMLDOC For Creating PDF Files
| From: | Michael Stearne | Date: | Thu, 28 Dec 2000 19:17:39 +0000 |
| Subject: | Re: PHP/HTMLDOC For Creating PDF Files | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-4713@lists.php.net to get a copy of this message | ||
I have used HTMLDOC with Perl. The bulk of my app was really pre-made in HTML and then searched
through using perl regular expressions for the replacements. After that it uses a system call to my
newly created file based on the HTML template that was searched and replaced.
Michael
On Thursday, December 28, 2000, at 01:17 PM, Paul Meagher wrote:
>
>
> > Has anyone had any success in using the HTMLDOC program thru PHP to
> convert
> > html files to PDF? If so, how did you call the htmldoc program in you PHP
> > script?
> >
> > Since all I really want to do is create a simple raffle ticket when
> someone
> > registers through the web and print it to the local server's printer the
> > HTMLDOC program seems to be easier to use than trying to learn the pdf
> > functions in php.
>
> This is snippet on printing from Fred Langa's email newsletter. It might
> help you to solve your problem. Let me know if it does.
>
> You might also want to look at this article on creating printer-friendly
> pages:
>
> http://www.phpbuilder.com/tips/item.php?id=171
>
> Regards,
> Paul
>
> 2) Printing From A File
>
> Sounds simple, doesn't it? It's one of those things that you can ignore
> almost forever--- until you unexpectedly and urgently need to do it.
> Then, suddenly, what seemed like a simple task may turn out to be
> considerably more complicated.
>
> The concept *is* simple: Most standard Print dialogs in Windows include a
> small checkbox called "Print to file." If you check this (say, when your
> printer is offline or if you're working on a laptop and are away from a
> printer), Windows will send to a file exactly the same stream of data
> that it would have sent to the printer. The file is given a PRN
> extension, such as "MyReport.Prn."
>
> In theory, when you later have access to a printer, you send the PRN file
> to that printer, and it prints out.
>
> But trouble is, in practice, Windows has no clue what to do with a PRN
> file, on its own. If you click on the file, you'll simply get the "Open
> With?" dialog. So what do you do?
>
> Well, you can "copy" a PRN file to the printer port (usually LPT1 or
> LPT2, so called from the old days when printers were called "line
> printers"). One very simple way to do this is to drop to DOS or open a
> DOS box and type
>
> copy filename.prn lpt1 /b
>
> Of course, you replace "filename" with the actual name of the file. The
> "/b" tells the system you're processing a "binary" (machine language)
> file, not text.
>
> This works best with simple files that don't use any or many of modern
> printers' advanced capabilities. In fact, it works best with plain text
> files.
>
> One easy way to create truly plain-vanilla text files is to add a special
> fake printer to your system by using Control Panel's "Add Printer"
> dialog, and lying: Tell Windows you want to install a new local printer,
> and select "Generic/Text Only" from the offered choices. When you're
> ready to print, select the Generic printer, and then click the "Print to
> file" box: Although you'll lose access to your printer's advanced
> capabilities, you'll create a simplified PRN file that may be easier to
> print out later than a more complex PRN file.
>
> And there are other tricks of increasing complexity (desktop shortcuts,
> etc.), to get PRN files to print. But they may not work well, or at all:
> For example, many color and complex printers require their Windows
> drivers to be loaded and running at print time; any attempt to direct-
> print may fail. Some printers are designed actually to use the PC's own
> CPU to control the live printing process; trying a "back door" approach
> to printing will fail. Likewise, networked or shared printers add an
> additional layer of complexity that may thwart your attempts to print a
> PRN file.
>
> Believe me, I know: I recently needed to print color output from an
> application on a machine I was testing. It's a long story, but I needed
> to do it via a PRN file. But nothing I did--- and I tried every trick I
> could think of or find in a lengthy online search--- *nothing* let me
> correctly print the PRN file. At best, my printer would print gibberish;
> at worst, it'd hiccup once and die.
>
> Eventually, I found Gallicrow Software's "Imprint," a small trialware
> Windows app (you can try it free for 30 days) that lets you easily and
> controllably print binary and PostScript PRN files from within Windows.
> After downloading Imprint, I had the PRN file rolling out of the printer
> in less than a minute. (See http://www.gallicrow.co.uk/ )
> Imprint is
> $30 if you decide to keep it. I wish I'd found it sooner--- I would have
> saved myself a couple of very frustrating hours.
>
> BTW, along the way, in trying to get the *%$E%$# PRN files to print, I
> found "the Ultimate Windows 95 Spool32 FAQ on the Internet" at
> http://www.starkreality.com/~callen/spool32.htm . There's
> a ton of good
> (free) information there, should you ever need it.
> Click to email this item to a friend
>
> http://www.langa.com/sendit2.htm
>
>
>
> > Thanks,
> >
> > Ron Woods/GAI
> >
> > --
> > PHP Windows Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net
> > For additional commands, e-mail: php-windows-help@lists.php.net
> > To contact the list administrators, e-mail: php-list-admin@lists.php.net
> >
> >
>
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net
> For additional commands, e-mail: php-windows-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>
>