Browsershot : show two pages per sheet - laravel

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();

Related

Is there a way to PDF Page reorder according to any order of my choice?

Is there a way to PDF Page reorder according to text string of my choice?
There are multiple sites that allow rearranging PDF pages by drag & drop. But, this process becomes to lengthy when I have a document of say 100 pages.
In case I need to print a 100 page PDF in such a way that it can be bound like a book, I need to rearrange these as the following order.
100,1,98,3,2,99,4,97,96,5,94,7,6,95,8,93,92,9,90,11,10,91,12,89,88,13,86,15,14,87,16,85,84,17,82,19,18,83,20,81,80,21,78,23,22,79,24,77,76,25,74,27,26,75,28,73,72,29,70,31,30,71,32,69,68,33,66,35,34,67,36,65,64,37,62,39,38,63,40,61,60,41,58,43,42,59,44,57,56,45,54,47,46,55,48,53,52,49,50,51
Here, the order is logical to be printed as a book, but it is not easy to utilise drag & drop to achieve this. Is there any way to rearrange the PDF in the above order of pages?
I have tried to use Microsoft Print to PDF and Chrome Print to do this, but this gives the output files as 1,2,3,.........,100 order.
cpdf in.pdf 100,1,98,3,2,99,4,97,96,5,94,7,6,95,8,93,92,9,90,11,10,91,12,89,88,13,86,15,14,87,16,85,84,17,82,19,18,83,20,81,80,21,78,23,22,79,24,77,76,25,74,27,26,75,28,73,72,29,70,31,30,71,32,69,68,33,66,35,34,67,36,65,64,37,62,39,38,63,40,61,60,41,58,43,42,59,44,57,56,45,54,47,46,55,48,53,52,49,50,51 -o out.pdf

BIRT - How to List the Contents of Page Variable

I have a report with page variable implemented to display current/total page numbers for each customer. I have another requirement - Display a list of customer names and the respective page numbers contained in the report on the last page of the report(such as Company A - 3 pages, Company B - 4 pages).
It has to be proper looking with border lines.
I was able to implement the page variable by simply borrowing the code I've found on the Internet, but have no idea how to display the contents(customer names and page numbers) as a list at the end of the report.
Would someone help me to accomplish this requirement?
I don't think this is possible with BIRT.
In similar cases, and only for the special case of PDF output, we are using a post-processing approach, but it requires Java programming:
First, we let BIRT generate Table-of-Content entries ("outline" in PDF speech) for the companies.
The second-step is post-processing: we read the PDF using iText and examine the TOC. That way we get the information about which company starts at which page number. Together with the total page number it is easy to compute how many pages each company takes.
Then iText can generate and add a visible TOC (as you described) to the PDF.

Add fragment on every page of A4 size Thymeleaf

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.

How can I import a block of RTML into a yahoo merchant store?

I've put together a block of RTML that i would like to add to a product page. Now that i've got that, I'm trying to figure out how to place that whole block of RTML into the product's template. That may not be the right way to do it.
my desired result is that the html of the product page is rendered PLUS the html that would be rendered by my added block of RTML.'
What I have tried: as far as I can tell, i can only use the editor to add RTML 1 line / update at a time. which means anything complicated would take forever.
Yes Kristian, you're absolutely right. The operators in RTML take a very, very long time to insert because it requires a page refresh for each operator in the store editor. If you have a lot of HTML to update, you can use the RTML template uploader located here http://www.yourstorewizards.com/rtml-transfer-utility.html . While it is free to "download" templates, you are charged for "uploading" templates. This is because you aren't truly uploading or downloading templates. What the program does is move your mouse around the screen very quickly doing all the clicking for you.
At the very least, you can use the MULTI command to group other commands together. That way you can quickly duplicate operators/HTML. You can take a bunch of TEXT operators and quickly duplicate them inside a MULTI, and then duplicate the MULTI. This is probably one of the most efficient ways to do large blocks of HTML.
Another idea... Print out a script tag using a TEXT operator, and insert your HTML with JavaScript. Obviously you won't want to do this all the time, but if you're looking to insert a very large piece of HTML this may be your best bet.

Pinpointing the difference and changes made between two pages in magento 1.6.2

I have two pages that should be using the exact same template and layout.
The correct item layout can be seen below.
http://dokha.co/index.php/medwakh/custom-medwakh-from-white-horse-studios-13.html
The incorrect item layout is below.
http://dokha.co/index.php/shisha-tobacco/al-fakher-shisha-tobacco-1.html
As you can see in the first image the layout of the item is compact. In the second link it is all drawn out.
I am curious to know if you can tell me how to make the second one like the first one, The compact style. I am not sure what modifications could have been made in magento to cause the layout to only show up that way for specific items, as only the items in the category on link 1 behave that way, I would like to know how to make them all behave this way.
Ok, first thing: the layouts are slightly different because in the first example, you have simple product and in the second example you have a configurable product.
So, view.phtml is including different templates in each.
Regardless though, the actually culprit of the expanded space you are seeing in the second example is being caused by a clearing div. Simply remove it.
The div you are looking for is this:
<div class="clearer"></div>
and you will find it in app/design/frontend/your_package/your_theme/template/catalog/product/view.phtml

Resources