ZPL: Multiple textboxes under each other - zpl

I would like to print a label with multiple text boxes (something like^FB600,3,0,c,0) under each other. The text boxes need to have different fonts and each of them might have variable number of rows.
The issue is how to position these two textblocks under each other so that they don't overlap.
To demonstrate the problem, I use this tool: http://labelary.com/viewer.html
Please try following code:
^XA
^FO0,0
^CF0,50
^FB600,4,0,c,0
^FDLorem ipsum dolor sit amet, consectetuer adipiscing elit. Integer vulputate sem a nibh rutrum consequat. Etiam egestas wisi a erat. Fusce tellus.
^FS
^FO0,300
^CF0,40
^FB600,3,0,c,0
^FDNulla quis diam. Curabitur ligula sapien, pulvinar a vestibulum quis, facilisis vel sapien. In convallis.
^FS
^XZ
The problem is the ^FO0,300 as it is absolute, I need to position the second block according to the first one.

Related

Dompdf text not wrapping in table cell

Can someone explain this to me please, i have a Laravel app (probably not important) and am using dompdf when i use the HTML below
<head>
<style type="text/css">
</style>
</head>
<body>
<table style="width:100%;">
<tr>
<td>
<p>Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.</p>
</td>
</tr>
</table>
</body>
</html>
out of the box i get this....
Why does the text not wrap around, and why does it go off the screen, am i missing something really obvious?
Thanks
Some style not working on dom-pdf so for now just try with giving black solid border of 1px to
Just add this code in your CSS:
td {
border: 1px solid black;
}
Adding style="white-space:wrap" worked for me. It justifies the text and matches the cell width.
<td style="white-space:wrap">My long text goes here. My long text goes here. My long text goes here. My long text goes here. My long text goes here. My long text goes here. My long text goes here. My long text goes here. My long text goes here.</td>

Display formatted paragraphs on Laravel 5.8

I'm trying to build a blog and I'm stuck at something.
When I add a post, I'm adding spaces and building block textes, like paragraphs, and I want to display them exactly in the same form as they were written.
eg:
"*Lorem ipsum lorem ipsumipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum
lorem ipsum lorem ipsum lorem ipsum lorem ipsum* "
is rendered as one line:
"lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum "
How can I do that? Thank you
One approach is to add some simple CSS to the page. Add a class name to the wrapping html tag:
<div class="class-name">
*Lorem ipsum lorem ipsumipsum lorem ipsum lorem ipsum lorem ipsum lorem
ipsum lorem ipsum lorem ipsum lorem ipsum
lorem ipsum lorem ipsum lorem ipsum lorem ipsum*
</div>
And add the following CSS:
.class-name {
white-space: pre-wrap;
}
pre-wrap allows:
Sequences of white space are preserved. Lines are broken at newline
characters, at < br>, and as necessary to fill line boxes.
While the default, normal, is the following:
Sequences of white space are collapsed. Newline characters in the
source are handled the same as other white space. Lines are broken as
necessary to fill line boxes.
You can read more about the white-space attribute here.
Alternatively, you can use the <pre> html tag to achieve a similar outcome.
The HTML element represents preformatted text which is to be
presented exactly as written in the HTML file. The text is typically
rendered using a non-proportional ("monospace") font. Whitespace
inside this element is displayed as written.
You can use a WYSIWYG tool like CKFinder or Summernote, and save the html in your db. Then render it {!!$post->text!!}

Using Dojo's behavior functionality to recognize scrolling events

I'm not able to figure out how to assign a function to a scroll event in Dojo.
I have seen this other post about using dojo's connect, but I've been unable to get that to work, and even if I could, my project's using behaviours as much as possible, so I'm really trying to get that to work first...
The puzzling thing for me, is that I've looked around on dojo's website a bit, and the only references I've seen to scroll events just mention them as an aside. On http://dojotoolkit.org/reference-guide/1.9/quickstart/events.html#connecting-to-a-dom-event as an example, there's a list of events that can be connect-ed to, and scroll isn't on them. Mouse wheel up + down are, but that does not cover all possible actions that might lead to a scroll occurring.
I've used jQuery's scroll event before, and that was nice and simple. The fact that I'm having this much trouble figuring out the scroll event in Dojo bothers me a little.
This is what I've tried:
var myBehavior = {
window : {
scroll: function(e) {
console.log("i'm scrolling");
}
}
};
behavior.add(myBehavior);
behavior.apply();
That loads without any problems, but scrolling doesn't give me the console logging message.
I've also tried
dojo.connect(window,'scroll',this,function() {
console.log("scrolling away");
})
which I pretty much got from the linked post, and I didn't get the console logging message either.
I'm starting to wonder if I'm missing a key library?
The ones I have required that I think are more than necessary:
- dojo/_base/lang
- dojo/query
- dojo/_base/event
- dojo/on
- dojo/behaviour
- dojo/window
Does anybody have a suggestion for how I start registering these scrolling events in Dojo? Thank you
I created a jsfiddle demoing the usage of dojo/on for the window scroll event.
html:
<body>
<div style="height:1000px;">
Bacon ipsum dolor sit amet meatball drumstick jerky strip steak kielbasa shoulder, short ribs filet mignon prosciutto swine meatloaf ribeye tongue turkey andouille. Hamburger bacon fatback, short ribs pork loin cow chicken. Capicola venison andouille kielbasa cow. Short ribs kevin rump meatloaf jowl prosciutto leberkas. Pork belly shankle doner spare ribs, rump pork chop sausage tenderloin. Brisket swine pig, fatback beef ribs shank tri-tip flank ham venison strip steak filet mignon rump frankfurter ribeye.
Fatback turkey sausage tongue doner strip steak boudin shoulder chuck beef ribs chicken bacon brisket. Turkey biltong bacon cow short ribs fatback. Sausage brisket pork loin corned beef pork chop shank jowl capicola leberkas strip steak prosciutto beef tri-tip. Jowl frankfurter beef ribs, swine tail doner tri-tip t-bone. Jowl pork loin sausage venison salami shankle kevin strip steak boudin doner bresaola filet mignon ham drumstick ribeye. Turkey pork belly kielbasa ribeye salami, strip steak ham hock jerky shoulder tenderloin shankle spare ribs beef ribs filet mignon. Short loin fatback kevin, biltong tail shoulder ball tip.
Pork loin t-bone ground round tongue turducken tail shoulder chicken sausage pancetta hamburger, kielbasa tri-tip strip steak short ribs. Pork chop prosciutto tri-tip, jerky brisket leberkas andouille ham hock tongue shoulder fatback meatball. Pig short loin beef spare ribs, rump meatball short ribs doner kielbasa ball tip swine bacon kevin. Hamburger tail frankfurter ham hock tongue, jerky pork belly bacon shank salami prosciutto ground round doner jowl turducken. Prosciutto pork chop drumstick ham hock meatloaf. Drumstick ham hock ball tip salami cow.
Shankle hamburger sirloin sausage tongue pork chop flank, doner pig tri-tip pancetta shoulder. Venison ball tip beef biltong tail, corned beef pastrami andouille frankfurter kevin pork meatball chicken. Ground round shankle sirloin capicola kevin spare ribs ham hock fatback strip steak short ribs leberkas. Venison flank tenderloin tri-tip salami pork capicola drumstick brisket short ribs sirloin chuck boudin kielbasa cow.
Short ribs corned beef shankle meatball, tri-tip t-bone sirloin cow leberkas chicken jerky. Short loin drumstick pork loin biltong sausage prosciutto rump flank hamburger pork chop meatball capicola turkey leberkas cow. Andouille ribeye boudin ham chicken. T-bone rump meatball drumstick hamburger pork chop, flank sausage tongue andouille fatback.
Does your lorem ipsum text long for something a little meatier? Give our generator a try… it’s tasty!
</div>
</body>
js:
require(['dojo/on','dojo/domReady!'],function(on,domReadyPlugin){
on(window,'scroll',function(evt){
console.log(evt);
});
});
The result will print to the console every time the user scrolls in the window. If you continue to have issues with it, post more code so we can get to the bottom of it, this should be a simple thing to do.
use "onscroll" instead of "scroll", see this jsfiddle
dojo.connect(window,'onscroll',this,function() {
console.log("scrolling away");
})

How can I gradually change font across a text frame in InDesign?

I would like to change the Typeface or Font Weight across a text frame gradually either by character, word, line, sentance or so on (basically any grep function).
I am generating (or interpolating) fonts so that I have a font family with the weights 1,2,3,4,5,6,7 which would change in the above fashion.
Unfortunately I do not have the scripting skills at the moment... Basil.JS looks promising though. Any help would be appreciated.
this should do the trick to change the font sizes of a characters, words and lines ...
for a sentence based interpolation you have to parse the content of the text frame according to '.' ... and then iterate in a second step over the individual groups of characters for each sentence. sadly indesign doesn't have a built-in collection for sentences.
hope that helps.
#includepath "~/Documents/;%USERPROFILE%Documents";
#include "basiljs/bundle/basil.js";
function draw() {
var lorem = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam pellentesque ultrices dolor, vitae venenatis erat.";
var tf = b.text(lorem, 0, 0, 300, b.height);
// replace words with characters/words/lines/
for (var i = 0; i < tf.words.length; i++) {
tf.words[i].pointSize = b.map(i, 0,tf.words.length, 5,30);
};
}
b.go();
see also the typography related basil.js examples: https://github.com/basiljs/basil.js/tree/master/examples/typography

HTML split a list in multiple columns

I'm trying to divide my list into multiple columns.
Example:
<ul class="loremipsum">
<li>Lorem ipsum 01</li>
<li>Lorem ipsum 02</li>
<li>Lorem ipsum 03</li>
<li>Lorem ipsum 04</li>
<li>Lorem ipsum 05</li>
<li>Lorem ipsum 06</li>
<li>Lorem ipsum 07</li>
<li>Lorem farem 08</li>
<li>Lorem ipsum 09</li>
<li>Lorem ipsum 10</li>
<li>Lorem ipsum 11</li>
<li>Lorem ipsum 12</li>
<li>Lorem ipsum 13</li>
<li>Lorem ipsum 14</li>
<li>Lorem ipsum 15</li>
<li>Lorem ipsum 16</li>
</ul>
Lorem ipsum 01 Lorem ipsum 06 Lorem ipsum 11 Lorem ipsum 16
Lorem ipsum 02 Lorem ipsum 07 Lorem ipsum 12 etc
Lorem ipsum 03 Lorem ipsum 08 Lorem ipsum 13
Lorem ipsum 04 Lorem ipsum 09 Lorem ipsum 14
Lorem ipsum 05 Lorem ipsum 10 Lorem ipsum 15
This is not a problem with jquery as I have found "Easy List Splitter".
However, this does not provide me with what I need.
The problem with the script of "Easy List Splitter" is that I need to put in an amount of columns. This is a problem for me because I'll be adding new items to this list weekly (if not daily) at the top of the list. It would mean I would need to edit the js file everytime.
Now that wouldn't even be a big problem (editting the amount of columns).
However, some of these list items (maybe 1 out of 10) is an image link.
What I would like to accomplish is this (numbers are just examples):
a wrapper div with 300px height
each list item has a min-height of 60px
max. 5 items per column
min. 1 item per column ofcourse
any column (left, right or the center) should be able to have only 1 list item if that 1 list item is 300px height for example (or 2 of 150px etc)
must be a vertical list
new column automatically created on the right of the other columns
A better question is........is this possible?
If new DIV's would show below/on top of eachother instead of next to eachother, the problem was solved already.
Big big thanks in advance!
If any more questions, please ask.
You might find some interest in this W3C recommendation about Multiple-Column layout which you can already use (with some prefixes though) on modern browsers.
Maybe not exactly what you would have wanted, but I think this is the best solution for your problem at the moment...
The nearest solution I found is to make LI float left and assign a width of 33% (for 3 columns) but it will not fill a column before starting another. The CSS Indeed is not complex.
.loremipsum li {
display: inline;
float: left;
width: 25%;
}
http://jsfiddle.net/cSJNm/

Resources