i have page , in this page i have around 45 lines ,
the first 5 lines are document heading, and this document heading css style is just font-family-arial, font-weight bold ,
and heading inserted inside the td , no more style,
problem is , this first 5 line print very dead slow, after 5the printer print the text very fastly, obviously the reset of the
text are just fonr-weight:normel, Pleawse advise some tip/ideas to increase the printing fast ,
(Am using dot matrix printer ,)
It is a known issue with DMP (Dot Matrix Printer) as the printing from a web page goes as a image print. For bold-face printing it normally prints twice or very slowly (depending on the number of pins in the printer).
For one such issue, I rolled out a component to convert RTF to plain text with printer escape characters (for bold facing, double sizing, compressing fonts) and sent it as a text file to the printer.
This may be a design issue with your printer: as you're saying, it's dot-matrix. These types of printers have very low DPI, so they're working around it by printing bolded text as normal text, but several times in the same area, slightly offset each time (whereas normal text is only printed once). That means that a line in bold text will take a multiple of the time necessary to print a normal line.
If this is a major issue, consider getting a laser printer - those print in near-constant time, regardless of page coverage.
Related
My client requires to print challan/invoice on pre-formatted paper where labels are already there on paper, and values are generated through a web application (fetched by php code). They use Epson's FX 2175 dot matrix.
I've seen that, documents printed via Notepad or PDF get printed nicely, but the html data from our web app. Main issue is, text gets shrinked/compressed such that, letter spacing is almost none. To add more to confusion, 2 out of 5 times, this won't even happen! Print will be as good as expected.
I've tried things like media queries for print - media #print{....}, changing printer settings, restarting printer, etc. Other solutions I found on stack point towards doing this thing by using plugins like jspdf, which would convert html to pdf and then do the next thing, print. But I'm thinking is as a last option.
So by now, I have concluded that the problem is with printing html document, since other stuff looks nice on printouts taken on the same printer. What could be the cause exactly? print from html not supported? Or printer is buggy?
My client has a website full of data in HTML table form. A feature of the website is to select various rows from the HTML table and copy the contents of the rows (along with other data) to the clipboard. The client wants the format of this resulting string to maintain certain in-cell formats, such as line breaks and bullets.
Currently I am using Zero Clipboard with an AJAX callback to generate the content and copy it to the clipboard. That part is working fine.
I have processed the resulting string to use "\t" characters to separate cells in a row and "\n" to separate rows. Past this I am lost.
Is there any way to encode bullet point characters and in-cell line breaks into a UTF-8 string so that formatting is preserved when it gets to Excel?
The web server is running Apache with PHP 5.3.
The solution I came to for this issue was sitting in front of me the whole time.
When you paste HTML code into Excel, it translates all the HTML characters into their entities (<) with the exception of one set...tables.
While I was never able to add bullet points into excel, I was able to create the tables even with some styles like background colors and borders by generating a table element with inline css. Excel handled the row and col spans correctly and still preserved some formatting. This met the client's needs and is about as close as I think you can get.
For my Ckeditor text box, I need a line break after a certain amount of characters. The site I manage converts this rich text using tcpdf to generate over a pdf. Long story short, the box lets them type to much in and it carries over with a break at the wrong point from what they can see. So my solution is to shrink the box to the appropriate size, and so that it adds the break at the appropriate spot, or if there is a forcible way to make it put a line break in after a certain amount of text is entered that would be very helpful.
I want to print simple text file (no style, formatting ) ,such that it fits in letter-size page and any overflow should be wrap to next line etc.
wordwrap()
php wordwrap function is doing what needed , but I am not sure how much character at maximum that fit on single line of letter-size page.
I hope this is not silly question . Do I need to look other way e.g px /font-size / max page size in pixels etc .
thanks in advance for any kind of help :)
Note: printing will be done from desktop application like notepad , wordpad or whatever text editing application available
Note: printing will be done from desktop application like notepad , wordpad or whatever text editing application available
You won't be able to predict at what size the text is going to be printed out on client side, so this will be completely impossible to do in PHP. You'll have to rely on the client doing the line breaks.
If you need full control over the printed result on that level, consider generating a PDF file.
so I'm using FPDF in PHP to programmatically generate a PDF file from images and text (not HTML).
One of the biggest issues I've been having is being able to wordwrap text around an image. My current algorithm looks like:
Get text as an array of words
Add words one at a time to a 'current line' variable, and call GetStringWidth() on it to determine the width of the current line
Once I reach a pre-determined max width, I pass off the current line to an array of lines, and start on a new 'current line'.
Doing this allows me to get an array of lines that shouldn't be breaking improperly, however I've discovered that because my text is justified-aligned, GetStringWidth() can't accurately give me the width of the line when it has been justified.
I've dug into FPDF's MultiCell method to try and figure out how it breaks justified text properly but can't really make heads nor tails of it. It seems to boil down to a similar algorithim (and it writes each line using Cell ) but it never actually seems to calculate the width, it writes out PDF "code" such as 0.375 Tw.
Does anyone know how to calculate the width of justified text, given a string and a max width?
Answering a really old Question.
In the end, I took the function that does justification out of the library and rewrote it to allow for another parameter that makes it continue justifying text even on the last line.
This would result in text that was fully justified for a specific paragraph, then you write the final paragraph without the parameter and have the final line not justified (as per normal).
not sure if this helps but I have a related problem - needing to know how many lines a MultiCell will take up.
I did this by using GetStringWidth() / $maxWidth and getting the ceil() of that.
I can then work out the estimated height (as I know the line height I am using) and use that figure (in my case to switch columns or not).
Perhaps feeding the base text into GetStringWidth() and estimating height this way will allow you to determine an appropriate place to break the text into the multiple MultiCell()s.