How To Print Multiple Pages Programatically? - asp.net

I have an app that displays transcripts, something like this myapp.com/transcript/1234 The transcripts are formatted so they can just be printed from the browser (ctrl+p).
What should I do to allow the users to be able to print multiple transcripts without visiting each page? e.g. Print transcripts for every user in group B.
Should I create a new view that just displays all of the requested transcripts at once?
Do I now have to look into creating PDFs? (shoot me)
Other thoughts?

If you want to keep it simple, create/change a view to display all the transcripts to be printed. Wrap each transcript in a container with a style class (like a div, <div class="transcript">...</div>). Use CSS to style each container such that a page-break occurs for each transcript. The style will look something like the following.
.transcript: {
page-break-after: always;
}

I personally just create pdfs. Using it for things such as official time sheets and various other forms I can't change. It is actually very simple to do with itextsharp and if your PDF has properly labeled input fields (aka isn't just one big scanned image or something).

Related

When using apoc.load.html, Is it possible to return the full HTML rather than only text?

Lets say I want to scrape the Neo4j RefCard found at: https://neo4j.com/docs/cypher-refcard/current/
And I would like to fetch a 'code' example along with its styling. Here's my target. Notice that it has CSS treatment (font, color...):
...so in Neo4j I call the apoc.load.html procedure as shown here, and you can see it's no problem finding the content:
It returns a map with three keys: tagName, attributes, and text.
The text is the issue for me. It's stripped of all styling. I would like for it to let me know more about the styling of the different parts of this text.
The actual HTML in the webpage looks like following image with all of these span class tags: cm-string, cm-node, cm-atom, etc. Note that this was not generated by Neo4j's apoc.load.html procedure. It came straight from my Chrome browser's inspect console.
I don't need the actual fonts and colors, just the tag names.
I can seen in the documentation that there is an optional config map you can supply, but there's no explanation for what can be configured there. It would be lovely if I could configure it to return, say, HTML rather than text.
The library that Neo4j uses for CSS selection here is jsoup.
So I am hoping to not strip the <span> tags, or otherwise, extract their class names for each segment of text.
Could you not generate the HTML yourself from the properties in your object? It looks they are all span tags with 3 different classes depending on whether your using the property name, property value, or property delimiter?
That is probably how they are generating the HTML themselves.
Okay, two years later I revisited this question I posted, and did find a solution. I'll keep it short.
The APOC procedure CALL apoc.load.html is using the scraping library Jsoup, which is not a full-fledged browser. When it visits a page it reads the html sent by the server but ignores any javascript. As a result, if a page uses javascript for inserting content or even just formatting the content, then Jsoup will miss the html that the javascript would have generated had it run.
So I have just tried out the service at prerender.com. It's simple to use. You send it a URL, it takes your url as an argument and fetches that page itself and executes the page's javascript as it does. It returns the final result as static HTML.
So if I just call prerender.com with apoc.load.html then the Jsoup library will simply ask for the html and this time it will get the fully rendered html. :)
You can try the following two queries and see the difference pre-rendering makes. The span tags in this page are rendered only by javascript. So if we call it asking for its span tags without pre-rendering we get nothing returned.
CALL apoc.load.html("https://neo4j.com/docs/cypher-refcard/current/", {target:".listingblock pre:contains(age: 38) span"}) YIELD value
UNWIND value.target AS spantags
RETURN spantags
...but if we call it via the prender.com website, you will get a bunch of span tags and their content.
CALL apoc.load.html("https://service.prerender.cloud/https://neo4j.com/docs/cypher-refcard/current/", {target:".listingblock pre:contains(age: 38) span"}) YIELD value
UNWIND value.target AS spantags
RETURN spantags

Confluence: Is there a way to use space variables in Global PDF Stylesheet? Or somehow include it on PDF Exports

For PDF exports, I'm trying to export the space name to the bottom center of the export.
I tried the following but no luck so far:
#bottom-center
{
content: $space.getName();
}
I think the space variables do not work within the PDF CSS Stylesheet.
Is there another way of possibly achieving this?
I look forward to your ideas.
You might want to have a look at our Scroll PDF Exporter for Confluence.
Scroll PDF Exporter is an app for Confluence Server and Cloud that allows you to further customize your exports using a graphical template designer.
One key feature of the app is the possibility to use placeholders for specific metadata (e.g. the space name). Those placeholders can be used in the header or footer of your exported file and will be replaced during export with the wanted information.
You can find further information about all available placeholders in our Scroll PDF Exporter documentation.
For your specific use case the placeholder "Space Name" should work.
You can try out Scroll PDF Exporter using a 30 day trial license via the Atlassian Marketplace.
In case you have any further questions regarding the app, please get in touch with us via support[at]k15t.com.
We'll be happy to help.
Best,
Nils

Export a html table to a pdf with all its css intact

I need to open a html table to a new tab as a pdf to be ready for printing. Problem I am having is exporting the html table due to the css tied to it. Many of the elements are colored differently depending on the row, cell, etc. How can I export the table to a pdf with all the css intact? I am using angularjs btw
In another part of the page, I had ui-grids created using angularjs and I was able to exporter them using pdf make.
Without your code, tough to know with complete certainty that this would work for you, but I have used fpdf to generate billing statements for customers. The output can be colored based on values of variables passed to it using the "SetTextColor" function. The call to fpdf is done usually as an ajax request on a button push, so you should be able to capture all the rows and columns of your table, and use the same type of logic to adjust the colors within your fpdf class.
For more information about fpdf: http://www.fpdf.org/

How to put pictures in a single row using semantic view?

I'm trying to put these pictures in a single row using semantic view in drupal7. I just created this view named try and put 2 pictures in it.
After that, I'm editing this view->format-format->setting->row (this is asking for class attribute, not mandatory) and I don't know what to write in this class attribute.
How do I put these pictures in a single row?
Make custom template for that view. Open "Advanced settings" on right side of view editing page and at bottom find "Theming information". There you can see template file suggestions. There if you can see the code of default templates (and copy it to clip board) but you can also see naming suggestions for overriding default templates. So copy code from default template, make from it file with some suggested name, save file in your theme...and clear the cache.
Then change the file as you wish, depending on your needs....
The CSS 'display:inline-block' is a good way to make rows. CSS Flexbox is more difficult to understand, but very powerful. Occasionally, the CSS 'float:left' will do what you need, but it has a tendency to 'log jamb' on differing element heights.
I have used Semantic Views to create continuous, wrap-around content from multiple View rows. I removed the View row element by deleting the default 'div' in the 'Format settings'. That way only a continuous stream of fields appears within the '.view-content' tag.
A custom template is also good.

My website doesn't print correctly

I've created a local website to be used as a database where I work. It's made using Rails 3.2, and TwitterBootstrap for most of the CSS. The problem is, if I want to print the view on my browser by going to file-print, or tools-print, or rightclick-print (depending on the browser), the print preview looks completely different than the actual browser page does. For example, I have my "Index" view loaded with a nice table that has 6-8 columns, but when I print almost all of the information in the columns disapears and random code pops up in random places, including the URL, some SQL, and some folder paths where the links belong. I just want to be able to print the page as it looks in the browser (without having to do a print screen every time).
As it turns out, I need to set up a CSS specially for printing. Then inserting the css link into my HTML header with media="print".
As shown here: http://www.w3schools.com/css/css_mediatypes.asp

Resources