Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8066815
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T12:06:47+00:00 2026-06-05T12:06:47+00:00

How can i print my html file via php script? I just want to

  • 0

How can i print my html file via php script? I just want to run it in background without any prompt. I have read other posts regarding this but still didnt find anything working.
I tried this one :

<?php
$dir = "temp"; // the folder that you are storing the file to be printed
$file = "file.html"; //change to proper file name
$file_dir = $dir.$file;
$server = "home_computer"; //name of the computer you are printing to on your network
$printer = "HP"; //printers shared name
$command = "print $file_dir /d:\\$server\\$printer";
exec($command) or die("File failed to print");
?>

got this example here http://www.phpfreaks.com/forums/index.php/topic,207946.0.html

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T12:06:48+00:00Added an answer on June 5, 2026 at 12:06 pm

    here is what i got working :

    $html = "testing print";
    $handle = printer_open();
    printer_set_option($handle, PRINTER_MODE, "RAW");
    printer_write($handle, $html);
    printer_close($handle);
    

    We require php_printer.dll php extension to make this work in php5. 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a Python script that I want to run daily via a
The JavaScript code window.print() can print the current HTML page. If I have a
Is there any way I can print/show images on top of each other. The
Here is my program import subprocess print Content-type:text/html\r\n\r\n print File starting to execute print
Here's what I'm doing. I want to upload multipart file via Ajax to my
I'm reading an xml file with PHP and pulling it into jQuery via a
Have been asked to print to a remote printer via a socket connection, and
How can I print an HTML string so all of the HTML tags are
I have a form and I want the calculations to be done via ajax
Does anyone know of a script that can accept a raw diff file and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.