Add fragment on every page of A4 size Thymeleaf - spring

I have requirement that a web page will have different section depending on the size of A4 sheet. For every section of A4 size, I need to have a confirmation check box.
How can I divide a webpage into smaller section of A4 size using thymeleaf?

You can use th:switch, th:fragment, th:replace tags to pull sections you need based on the input you provide.
Remember tho this would only occur on render by server thus real time would either need page reload or use javascripts to modify which sections are in and not.

Related

Apex main region header with dynamic value

I have tried everything I know to make title of header replicate items value, including substitution string &P10_TITLE_TEXT. inside headers title property. Generally, this would work for normal region, but in my case I try to modify value of pages main region, which is rendering first, before any other item. My assumption is that title text is not showing because it cannot see items value yet.
Is there a simple way to refresh title header after items are ready, or perhaps another better solution?
PS: This is main header of the modal dialog page, that has no property for setting static id, and it's template is less adjustable then normal regions.
Try the following javascript in "Execute When Page Loads" of the modal page:
$('.ui-dialog-title',parent ? parent.document : document).text( apex.items. P10_TITLE_TEXT.value );
Pre-Rendering computations may be the solution here.
You can try creating a computation before Regions under Pre-Rendering to set &P10_TITLE_TEXT.. There will be no need to "refresh". This is if you are simply loading it once.
If you are trying to set headers based on input every time you change it, I would advise separating into two pages so you can submit the page and APEX can reload and process, or just use javascript.

Browsershot : show two pages per sheet

I'm using the spatie/browsershot package with puppeteer to generate pdf in my applications. I have several templates for the generation, so I created a blade template for every template made.
I'm having a problem with one of the templates though, I'm trying to simulate two A5 pages printed on one A4 sheet (landscape mode). Doing this purely in css would be too difficult (calculate the end of the page, go on the other column at the right time, etc), so I generate it normally but with width and height set at the A5 dimensions. Of course, it appears right in the middle of the sheet, one page per sheet.
I wanted to know if there were a way to "glue" two pages together with Browsershot. Here's my call to generate the pdf:
$content = view('pdf.' . $survey->pdfTemplate->name, ['answer' => $answer)->render();
Browsershot::html($content)->noSandbox()->showBackground()->waitUntilNetworkIdle()->landscape($survey->pdfTemplate->is_landscape)->save(storage_path($id . '.pdf'));
I think that if there's a way to make such a thing, it must be here at the generation. Thanks a lot!
I see your question is still open.
I had the same problem because I had option ->format('A4') defined.
I removed the option, and all pages still generating in A4 format as long as you use ->savePdf();

Set minimal pages count in pdf using flying saucer

Is there any way to set minimal count of pages to pdf? So my current need looks like:
I have an header on second page that should be shown
First page has content that can overflow to second page
It is not acceptable to have 3 pages
So I need 2 pages in both cases:
First page fits to single page (so I should create second page manually)
First page overflows (at create second page by its content)
Single workaround that I found - overflow by empty (<br/>s) content. But I wanna do it with css.
I've tried to use #page:first but it wouldn't work in common css manner (like #page:first .break-page{...})
I've tried to use #page:first {break-page-after:always} - it wouldn't work...

Magento how to display a block with a small image over the actual product image by using product id

I have a table which contain some product ids and small images. I need to display the image over the actual product image. how can i display the small image in every place where the product image is appeared, that is: product view, related product, list, grid.. without changing there template.
Is there any programmatic way to display the small image everywhere without the need to change something in every template where the product image is display.
Yes this is quite possible. Not easy though.
There is a helper for that
Mage_Catalog_Helper_Image
Within the helper extend the init function and rewrite the assignment of the watermark. Enable it in backend in system > configuration > design > watermark. Then use the helper init function to assign the additional image you have.
When you are finished, make sure you clean the cache AND image cache. Otherwise the images are not generated.
It is still possible that some images wont have the additional image overlay. But this is more of a template issue that doesn't use the helper function.

loading content on separate page that's encased in the jcycle plugin

So I have a website that has just two pages. On the home page, there are some things going on, but are not important. There are some links, however, that will need to link to a specific piece of content on the second page.
On the second page, I have content on there and it's all encased in the jcycle plugin.
What I need to do is if someone is on the homepage and they click on a link, it needs to load up the second page and show the correct "slide" that corresponds to what the homepage link is.
If you need any more clarification, please let me know.
In the cycle options reference, I see that there is a startingSlide option. You could set that dynamically. You could either do it with server-side code, e.g. /foo?slide=3 or you could check which anchor reference was used on the incoming link, e.g. /foo#slide3. Or, you could use DHTML to build the slideshow on the homepage when they click the given link.
Also note that there is a slideExpr option that you could use to filter the slides to a smaller set, depending on what they selected.

Resources