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 8950453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:27:32+00:00 2026-06-15T13:27:32+00:00

I know that there are ways to print a PDF to a network printer

  • 0

I know that there are ways to print a PDF to a network printer located on the same network as the server, but that does not help me as the server is remote. In my situation a user clicks a link to “print labels” which then generates and outputs a PDF file formatted for them. I currently “stream” the file output to the browser such that Adobe Reader automatically opens it using the following code:

header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Content-type: application/pdf");
header('Content-Disposition: attachment; filename="labels.pdf"');
readfile($ServerPathToFile);

Is there something else I can add to this code that will automatically trigger the print dialogue box to open so that they only have to click print? In this case, Google CloudPrint is not an option, nor are other things that require “special setup” on the user end…as this will be used by a variety of users.

  • 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-15T13:27:33+00:00Added an answer on June 15, 2026 at 1:27 pm

    You could output the PDF to a child window (<iframe>) on the same domain and then call window.print() on that window.

    <p>Don't forget to print your document!</p>
    <iframe src="/path/to/your/pdfgenerator.php" id="mypdf"></iframe>
    
    <script>
    function printIframe(id) {
        var iframe = document.frames ? document.frames[id] : document.getElementById(id);
        var ifWin = iframe.contentWindow || iframe;
        iframe.focus();
        ifWin.printPage();
        return false;
    }
    </script>
    

    In the iframe page, add this:

    function printPage() {
        print();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know that technically all three ways below are valid, but is there any
I know that there can be multiple values for an email, but I'm not
I know that there are more practical ways of going about what I'm trying
I know a great thing about perl is that there's multiple ways of doing
I know that there are lot's of questons on this, but all seem to
I know that there are others posts with solutions on the site but i
I know that there are lots of examples out there on this, but they
I know that there are many Delphi database related questions available, but I'm considering
I know that there are various ways to get random numbers, eg, from the
I know that there are some threads have a similar issue with this thread.

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.