How to print png files from node.js?

using node.js 8, I have to generate a barcode image and print it on a specific printer.

I have been using qrcode package. It generates a png file for me that contains the content. Now I need to send a printjob to print the png file on a specific printer.

Thoughts on the last step? Or a better way of doing this all together?

Debugging print CSS in my browser?

Is there a quick way to display a URL in the browser using the print CSS? I mean, display the page exactly as it will be styled when printing? That way I can inspect the DOM with my browser’s developer tools to see what is affecting the print layout and styles.

Otherwise, tweaking the print CSS is a slow process of trial and error that requires repeatedly printing to file to see how it looks after each CSS edit.

How to print the relative url or node id for each referenced node in twig?

I am using paragraphs to render a number of nodes on a page. The nodes are obtained through an entity reference field called ‘field_nodeslist’ in my cards paragraph type. The cards are then rendered using a custom view layout.

Here is a snippet of my view layout:

<a href="????">    <h3>{{ content.top_region|strip tags}}</h3>    <p>{{ content.middle_region }}</p> </a> 

The problem I am having is printing the relative path for each referenced node. I have tried the following twig commands but have not any success so far:

<a href="{{ url }}"> <a href="{{ uri }}"> <a href="{{ node.id }}"> <a href="{{ link }}"> <a href"{{ content.field.0['#url'] }}"> 

The following allows me to manually specify the node id in twig however that’s not what I am looking for:

<a href="{{ path('entity.node.canonical', {'node': 6 }) }}"> 

Any ideas?

Python program to take in two strings and print the larger string

I have written a Python program to take in two strings and print the larger of the two strings.

Here is my code:

string1 = input("Enter first string: ") string2 = input("Enter second string: ") count1 = 0 count2 = 0 for i in string1:       count1 = count1 + 1  for j in string2:       count2 = count2 + 1  if (count1 < count2):       print ("Larger string is:")       print (string2)  elif (count1 == count2):       print ("Both strings are equal.") else:       print ("Larger string is:")       print (string1) 

Here are some example outputs:

Enter first string: everything Enter second string: nothing Larger string is: everything  Enter first string: cat Enter second string: apple Larger string is: apple 

So, I would like to know whether I could make this program shorter and more efficient.

Any help would be highly appreciated.

How to print the URL of a title field?

I’m trying to print out the url path from the title in my twig template however I haven’t been successful so far.

Printing out the title containing the link works fine using:

{{content.title}} 

However, I would like to seperate the URL from the title so I can use it in other areas of my twig template. For example:

<a href="{{ content.title.0.url }}">Example text</a> 

I’ve tried various combinations and suggestions from stackexchange/drupal forums but to no avail. e.g. {{ url }}, {{ uri }} etc.

Any ideas?

Custom CSS for Entity Print Views

I need to print Cart form view in drupal 8 site. I have installed Entity Print & Entity Print Views. I can generate pdf successfully using tcpdf pdf file or debug version does not considering css. How can I apply custom CSS to pdf file? So far I have added below code in mytheme.libraries.yml

  print-styling:    css:      theme:         css/print-style.css: {} 

and in entity_print.libraries.yml

css: layout:   css/entity-print.css: {} theme:   css/entity-print.css: {} 

And added custom css in entity-print.css, Enable Default CSS checkboox is not checked, added {{ entity_print_css }} brfore </head> in twig file. Still it is not working Edited: Passing inline CSS is working for debug version but not in pdf