How to keep headline and text in the same column using ColumnText? - layout

I'm using iText to create a PDF file. While testing, a situation occurred where a headline was printed at the bottom of a column but the appendant text in the next.
The easy solution paragraph.setKeepTogether( true ); results in to much white space (see additional info below). Here is an image showing the current situation on the left and what I'd like to get on the right:
current and wanted situation (reputation...)
One of my biggest problems is, columnText.getYLine() returns the lowest position in the "origin" column even if the text flows over to the next.
I looked through the examples on the iText site and all results on stackoverflow for "itext column" plus some blogs but did not find any solution to my problem, other than printing each article in a new column. A concise description of the problem in a few words would help me search myself as English isn't my first language.
additional info
This is part of the report generation in a telemedicine project. A page template is filled by a web front end. There are several post processing steps e.g. attaching images of ECG output. These need a high pixel density to be readable, which is why I use iText (afaik pdfbox scales without taking the density into consideration). Some time ago the physicians noticed they had to insert more text than there's space on one page. So they wanted the overflow in an appendix. I could use another lib. The importance is on high readability on paper and a licence like (l)gpl/apache/... The white space results in more pages hence lessens the overview and wastes paper.

The setKeepTogether() method isn't supposed to work in combination with ColumnText. As documented in my book (the one shown in my avatar), the ColumnText class can be used in similation mode to finetune the layout.
The idea is that you define the location of your content in a trial-and-error process. First you add content and you invoke go(true); This will consume the content in your column, but will not add any content to your document. You can use this to discover how many lines have been written (getLinesWritten()), to check if all the content could be rendered (hasMoreText()), and so on.
Suppose that you find out that all the text can be written using the available space, you add the content to the column once more, change the Y-position to its original value, and add the column for real: go();
If there's content left in the column, you should create a new column, add the content anew and then make a decision. Change the position of the column and go(); If there's content left, but the content can be broken in two parts, change the Y-position and go(); then change the position of the column and invoke go() once more to render the remainder of the content in a different column.
You'll find different ColumnText examples in chapter 3.

Related

Mapbox, create area, label that area, then search for the label

Total newbi here. I have played with studio for a few h but can not get over the next hurdle.
I would like to draw wine growing areas on the map.
Managed to draw areas. Tick.
I would like to give these areas a unique name.
Managed to create labels.
But I don't understand how the text is associated with the area.
I then want to search for this label, so that the map zooms in on that area.
Just like when I search for "Coburg, Victoria, Australia".
I have managed to publish my maps including the areas in my WordPress website.
So my access token and my style does the right thing.
Need some hints how to get the labelling and searching happening.
Thank you for any help.
Regards
Romano
and welcome to using Mapbox.
I would like to give these areas a unique name. Managed to create labels. But I don't understand how the text is associated with the area.
Have you tried creating a Symbol layer, and setting the Text field to the appropriate field in your data source?
I then want to search for this label, so that the map zooms in on that area. Just like when I search for "Coburg, Victoria, Australia".
This goes beyond using Studio, and into building web maps with mapbox-gl-js. One starting point would be to use the Finder Impact Tool.
This might involve processing the data twice -- once for your base map, and another time in a spreadsheet to make available to the Finder template. It's possible to just do once, but would involve some modifying the Finder template.
https://labs.mapbox.com/education/impact-tools/finder-with-filters/

NLP Challenge: Automatically removing bibliography/references?

I recently came across following problem: When applying a topic model on a bunch of parsed PDF files, I discovered that content of the references unfortunately also counts for the model. I.e. words within the references appear in the tokenized list of words.
Is there any known "best-practice" to solve this problem?
I thought about a search strategy where the python code automatically removes all content after the last mention of "references" or "bibliography". If I would go by the first, or a random mention of "references" or "bibliography" within the full text, the parser might not capture the true full content.
The input PDF are all from different journals and thus have a different page structure.
The syntax is what makes a bibliography entry distinct from a regular sentence.
Test for the pattern that coincides with whatever (or multiple) reference styles you are trying to remove.
Aka date, unquoted string, string, page numbers in a certain format.
I'd spend some time searching for a tool that already recognizes bibliography before doing this, as it will be unique to each style (MLA etc.)
Couple of additional features to consider for detecting the start of reference setion
Check if the mention of "references" or "bibliography" is in the last pages as opposed to earlier pages
Run entity recognition on some length of words (~50?) after the word and if a high number of tokens in the 50 are entities, that indicates journal names, author names, etc.

How to add bullets in featured snippet using structured data?

I want to add bullets in featured snippet. When i search for 'gastric balloon' in google it gives me featured snippet for this link www.bariatric-surgery-source.com/gastric-balloon.html as shows in below image :
PLEASE OPEN THIS IMAGE => https://i.stack.imgur.com/1MBoD.png .
I have marked those lines with red color i.e i want to make display them with bullets symbol instead of plain text.
Someone suggest me that it could be possible with structured data but how?
And which code i have to write and where?
You have done everything semantically, so I would make the assumption that Google will strip out any formatting, and apply their own.
Best thing you could do is mark it up with ListItem schema.
An list item, e.g. a step in a checklist or how-to description.
Source - https://schema.org/ListItem

Understanding Orchard placement.info files

I'm new to orchard development and spent the last week studying it. I'm having a hard time in understanding some concepts, such as placement.info files.
I've read the article Understanding placement info from the project site and the section from the book "Orchard up and running" related to it.
What I understand:
Placement info files work on the content item level. It is used to reorder the rendering of the fields and content parts;
This file has three main tags: placement (basically a wrapper), match(which defines if the rules will be applied to the summary or detail display) and place (which effectively defines the placement rules);
What I don't understand:
How do I define the order of the tags? In the "place" tags I see "Content:Before", "Content:After.7", "Content:2.9" and some other rules. What does it mean to define "Place Parts_Tags_ShowTags="Header:after.7"/"? Is the placement file capable of moving parts to different zones?
I'm getting a bit frustrated using it. I don't know if I'm not using the right material (they seem very brief and/or outdated). If so, could someone suggest me some links?
I'd really appreciate some help, guys..
Thanks in advance
The name of the attribute is the shape name (usually as returned by a part driver), and the value is where to send that shape. It is a zone name, followed by a colon, and then ordering. The zone name can start with a slash if you want to target a top-level zone (those are defined in the Layout.cshtml file), like this: /AsideSecond:1. The ordering can be a special number, or a dotted sequence. For example, 1.1 comes after 1 but before 2. 1.1.1 would come after 1.1 and before 1.2, etc. after and before can also be used to send a shape after or before everything else.
I hope this helps.

Output attribute value and text alongside price in Magento

HI
I am new to Magento and still new to the whole css, php thing. And I have been searching for over a month to find this answer (I am sure it is here some place, but I cannot seem to find it)
I am building a b2b site for a clothing company. Since they are a wholesaler, they do not sell single items, but rather, they sell them in a pack. Depending on the items , some will come in a pack of 2-Small; 2-Medium; 2-Large, other will come in a pack of 1-Small; 2-Medium; 1-Large, and so on.
So far, I set up an attribute called “Package Set”, which describes the kind of pack the customer will be getting when ordering the item, but it only appears in the Additional Information tab, which is not good, because we want that information to stand out. Putting it in the Short Description is an option, but we want to emphasize it more.
So we want to
1. add a text “per pack” right behind the price.
2. add the value of the attribute “Package Set”, right underneath the price, so people will see it clearly, both in the category and product page. It would look some thing like,
“$60 per pack
Package Set: 2-Small; 2-Medium; 2-Large.”
I am using the modern theme
running 1.4.1.1
Thank you
Copy the file "app/code/design/frontend/base/default/template/catalog/product/view/price_clone.phtml" to the directory "app/code/design/frontend/default/modern/template/catalog/product/view/". This is so you are not overwriting the original file.
Open the file for editing. After where you see this:
<?php echo $this->getPriceHtml($_product, false, '_clone') ?>
Add the following:
<?php echo $this->__('per pack') ?>
By using the function $this->__() you are making the text available to be translated easily. It is good practice to do this always.
For the second part now add this bit on the line after:
<p><?php echo $this->__('Package Set %s', $_product->getPackageSet()) ?></p>
Again it is potentially being translated but this time your extra attribute is being inserted where it says %s. The reason for doing this is to make it clearer when using inline translation. The line has been wrapped in a <p> paragraph tag for yet more clarity and to ensure it appears on it's own line, not following on the end of the previous.
I have assumed your attribute has the code "product_set" - which in Magento becomes 'camel case', or getProductSet.
Finally you might want to remove the attribute from Additional Information tab. This is quite simple, go back to the Manage Attributes page in admin, edit your attribute and change "Visible on Product View Page on Front-end" to "No".

Resources