I am trying to add a print button to a Cognos report to print the whole report which when run is delievered as HTML pages. I used an HTML item and used the code:
<button type="button"onClick="window.print();return false;">Print Report</button>
This only prints the first page even after I select to print all pages. How do I make it to print all the pages?
That is the expected behavior of the code you've written. It's printing the HTML page. Cognos doesnt return all the results - it pages to 20 rows by default. The extra rows are not hidden on the page. Don't try to reinvent the wheel here. HTML was not designed for printing. Export to PDF and print from there.
Related
I have a simple one page report for quoting an opportunity from Acumatica ERP which is working fine.
However, my customer has a standard boilerplate page for terms and conditions. They would like that to be appended to all quotes being generated. But, I don't see a way of adding a pre-formatted page to a report at execution time.
I can do it in code. Create a button that calls the report, and then through .NET code add the conditions page that way. But it seems like this functionality might exist within the report writer itself.
Does it?
In the report footer section, this is the appropriate place to add the boilerplate page. Report footer prints as the last page. You could create a PNG file, in case your boilerplate page has graphics. Then embed the image file into the report footer section.
Be sure to set Page Break property as true
I'm using Flask and trying to create a form that user will fill and when user will hit on submit then the output render on the same page but I'm facing a problem that content of jinja is also displayed before execution in the following way.
Is there any possible way to hide those content or any other efficient method to render the content on the same page ?
I want to convert the HTML to PDF for which I am using this package (https://www.npmjs.com/package/html-pdf).
But in this HTML I am also getting tables and that tables can come in any position in HTML.
So I want to copy the table thead to another page if the table in the HTML exceeds more than 1 page.
Can you please help me on this.
Thanks in advance
You're going to have to modify the CSS of the page to properly handle a printable view.
See also: Repeat table headers in print mode
Try to use Puppeteer to create PDF from HTML
Example from here https://github.com/chuongtrh/html_to_pdf
Or https://github.com/GoogleChrome/puppeteer
I have one prompt page, one html report output page and one xls report output page. On prompt page, I have a prompt that selects Output Format(HTML/XLS) and a generate button that generates the report. The generate button needs to display the output page in the correct format.
The 'Generate' button just does promptAction('finish'). The thing is that no matter what i select in the format (XLS,PDF etc),promptAction('finish') always generates the HTML output.
So is there a way to call something like promptAction('finish', varFormat)?
I normally do this the other way around - use native Cognos functionality to run it in the format required (i.e. using run with options). Then use a variable to detect the format that was applied then apply conditional formatting. In your case the would be rendering the XLS page if XLS was selected and render the HTML page if HTML was selected.
I remember having this problem with HTML vs PDF page rendering. I don't have Cognos in front of me but what i found out is that i had to update my conditional style/format because the following would not work right... it was a strange problem but i did come up with a workaround
old pseudo code that wouldnt' work.
Created Variable that says
Case RENDER_TYPE
When PDF
THEN PDF
WHEN HTML
THEN HTML
End
then i put on a conditional style using this variable to make the page visible or not... and this would not work.
what i had to do was this...
Case
When RENDER TYPE = 'HTML'
Then 'HTML'
Else 'PDF' <- or in your case EXL
End
of course its only good for two formats but for some strange reason trying to use any other value than HTML created weird behavior.
Thanks,
If Render Type <> 'HTML' then render PDF otherwise render HTML...
i had problems anytime referring to the render variable with anything other than HTML. So basically i just had to test when HTML then HTML else other format.
I have seen webpage with a PDF icon, where you could click on it to print the content of that webpage.
The page i am intending to add the print feature is designed in JSF, so is there anyway where i could add a print button, to get the webpage printed ?
No, you must do this yourself. Get some PDF library (for example iText), then get web page output (plain HTML). Then you will have to iterate thru HTML and create PDF version (for example build iText document). You will probably have to do this yourself, because some elements (javascript powered) will need to turn into static content. Nobody but you knows how the output should look like.