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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:06:03+00:00 2026-05-28T07:06:03+00:00

I’ve been working with html2ps to get some text only labels to print correctly

  • 0

I’ve been working with html2ps to get some text only labels to print correctly on a Dymo 450 Labelwriter printer. According to this page you should be able to resize the page using CSS. Here’s the CSS I tried (in an external file and also tried it inline):

  @page {
      size: 28mm 85mm landscape;
      margin: 0mm;
  }

But the output postscript continues to be letter size. I was also able to do scaling using html2ps’ -s option, but the margins are still so great that no text prints (just a blank label comes out)

html2ps -s .3 -L <url>

What can I do to get margins to zero and an output of the correct page size?

Here’s a sample of the input html:

<div>Code: <b>SNHN1</b>&nbsp;&nbsp; PO: <b>035718</b>&nbsp;&nbsp;ln: <b>1</b><br>Desc: <div>US15 4" SOLID BRASS NO. 1 (SNHN1)******* HOUSE NUMBER SATIN NICKEL "1"<br></div>Remarks: <b>## CUSTOMER NAME 01/13</b><br><div>Vendor: HARDWARE COMPANY ETC...&nbsp;&nbsp; Rcvd: date and time...</div></div>

Also it appears html2ps is not respecting inline:

page-break-after:always;

Thanks for your help. I should also mention that I’m printing using lp from an ubuntu print server.

  • 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-28T07:06:04+00:00Added an answer on May 28, 2026 at 7:06 am

    At work, we use wkhtmltoimage, part of the wkhtmltopdf project, for exactly this purpose. We’re using a 400 and a Twin Turbo 400 instead of a 450. Shouldn’t matter, I’d expect. They offer cross-platform statically compiled binaries, so no compiling is needed. Even then, an older version of wkhtmltopdf seems to be available in Universe.

    In our case, we set the html and body sizes to specific pixel dimensions, calculated from the DPI of the printer, plus some fudge factor for CUPS. For example, when printing to the 30252 1.125×3.5 Address labels:

    html, body {
        margin: 0px;
        border: 0px;
        padding: 0px;
        height: 290px;
        width: 958px !important;
        max-width: 958px !important;
        overflow: hidden;
    }
    

    These pixel dimensions were then matched with the proper command line switches to force a specific height and width. The resulting image can just be fed straight to the printer via lp or lpr. You can also turn the label sideways by changing the printing orientation (-o landscape or -o orientation-requested=N, see the docs) and swapping the dimensions.

    You might need to manually specify the DPI of the image when passing it to CUPS. We do so expressly through -o ppi=300.

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

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
I have a reasonable size flat file database of text documents mostly saved in

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.