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

  • Home
  • SEARCH
  • 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 7639907
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T08:32:40+00:00 2026-05-31T08:32:40+00:00

Consider a static HTML page as test.html , and a printable version of the

  • 0

Consider a static HTML page as test.html, and a printable version of the page has been stored in test.pdf. How can I guide browser to load and print test.pdf instead of test.html when visitors tell their browser to print?

If it’s not possible how can I introduce a print button (using JavaScript) within the HTML page to do so?

  • 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-05-31T08:32:41+00:00Added an answer on May 31, 2026 at 8:32 am

    You cannot force the browser to print a different file than the user is requesting/viewing. That would be a security nightmare!

    Option 1 (JS (as requested) & HTML)

    I suggest creating a printable version link on your site that will direct the user to the .pdf (opening the PDF in a new window would be preferable).

    <!-- JS -->
    <script type="text/javascript">
        function LoadPrintableVersion() {
            window.open("Test.pdf");
        }
    </script>
    
    <!-- HTML -->
    <span id="spanPrintableVersion" onclick="LoadPrintableVersion()">
        Printable Version
    </span>
    

    Option 2 (pure html)

    <a href="test.pdf" target="_blank">Printable Version</a>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm designing an HTML page for display in Android browsers. Consider this simple example
I want a WYSIWYG html editor to create a static web page. After some
Consider a dynamic content html web site with lots of static .js and image
Consider following program: static void Main (string[] args) { int i; uint ui; i
Consider the following code: private static void WriteProcesses(StreamWriter sw, DateTime d) { sw.WriteLine(List of
Consider the following code: public class MyClass { public static string MyStaticMethod() { //string
Consider the following method in Java: public static boolean expensiveComputation() { for (int i
Consider this case: public Class1 { public static final String ONE = ABC; public
Consider this snippet of code: public static class MatchCollectionExtensions { public static IEnumerable<T> AsEnumerable<T>(this
Consider the following program: class A { public static void Foo() { } }

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.