Forcing page size when printing

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kvijayhari
    New Member
    • Jul 2007
    • 24

    Forcing page size when printing

    hi

    i've doubt in the window.print() function.
    I'm using a css with the attribute media=print and i'm hiding the unwanted things from display for printing using this css.

    I'm opening a window which contains the content to be printed in a fixed size say 600x300 and i'm using the window.print() to print the current window content and it's printing the page to the default page setup (i.e the whole window) , but i wanted it to print to the specific size (i.e the current window size).. how can i make this?

    May be i'm not explaining it well or may be explaining a bit more .. if u counldn't catch what i'm saying pls post with qs i'll post again.
    but please help in this issue..
    _______________ ___
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Is there anything else on the page besides the content that you wish to print?

    Comment

    • pbmods
      Recognized Expert Expert
      • Apr 2007
      • 5821

      #3
      Heya, kvijayhari.

      The print area is more or less determined by the User because of the Page Setup dialog.

      You can set an absolute width and height for your body element, but this will not force pagination.

      In the end, if you have multiple pages of content, you will need to either use PDF files or else accept that the User will be able to print it out using a height of 8.5".

      Comment

      • kvijayhari
        New Member
        • Jul 2007
        • 24

        #4
        Originally posted by pbmods
        Heya, kvijayhari.
        You can set an absolute width and height for your body element, but this will not force pagination.

        In the end, if you have multiple pages of content, you will need to either use PDF files or else accept that the User will be able to print it out using a height of 8.5".
        I think i can try giving the width and height for the body element ..

        I just have a single page content and it's like printing a short invoice or bill in a pre-formatted print sheets(i.e like pre-printed bills, books, cheques etc..)

        That's why i asked ..

        I use the javascript to open a separate window with the specified height and width and that page contains only the content to be printed not other than that.

        then i javascript window.print to print that document.

        Any way i'll try giving the body attributes and come back.

        Comment

        • kvijayhari
          New Member
          • Jul 2007
          • 24

          #5
          Anyone there to reply please!!!!!!!!! !!

          Comment

          • acoder
            Recognized Expert MVP
            • Nov 2006
            • 16032

            #6
            Try to set the page size and margins using CSS @page rule. If you have any problems with the CSS, post in the HTML/CSS forum.

            Comment

            • pbmods
              Recognized Expert Expert
              • Apr 2007
              • 5821

              #7
              Heya, kvijayhari.

              I'm going to go ahead and move this thread to the HTML/CSS forum, where our resident Experts will be better able to help you out.

              Changed thread title to get a better reception over there.

              Comment

              • kvijayhari
                New Member
                • Jul 2007
                • 24

                #8
                Originally posted by pbmods
                Heya, kvijayhari.

                I'm going to go ahead and move this thread to the HTML/CSS forum, where our resident Experts will be better able to help you out.

                Changed thread title to get a better reception over there.
                Thanks for moving ,,

                Expecting to get done thru this forum.

                Comment

                Working...