Note that there are some explanatory texts on larger screens.

plurals
  1. POApplet printing fine on Windows, but not on Mac
    primarykey
    data
    text
    <p>We built an mvc in .net for receipts. We wrote a small applet that takes in a url to our view and prints the receipt generated at that url to the users default printer. </p> <p>There is one specific receipt that doesn't use our mvc because it isn't tied to a sale and is merely a tip slip for a service. The main difference between this receipt is that the page that displays the preview of it (along with the button to print it) is the same page that the applet will use to print it. So, the applet essentially takes the url of the preview but with an extra param in the query string telling it to not render anything other than just the tip slip content. </p> <p>This all works perfectly on Windows on any browser. However, when we switch to a Mac, the tip slip only prints about 15% of the time, the rest of the time it just prints a tiny sliver of blankness. It's as if the applet is getting no content from the url, even though when I link to that exact url through the browser I get the tip slip content.</p> <p>I'm thinking this may be a timing issue. Perhaps the applet is not waiting until the tip slip is rendered.</p> <p>This is the applet's print method code:</p> <pre><code>public void printDocument(final String url, final boolean ccInfo, final boolean printDialog) { AccessController.doPrivileged(new PrivilegedAction&lt;Object&gt;() { @Override public Object run() { try { new ParserDelegator(); JEditorPane jEditorPane = new JEditorPane(); jEditorPane.setEditorKit(new HTMLEditorKit() { @Override public ViewFactory getViewFactory() { return new HTMLFactory() { @Override public View create(Element elem) { View view = super.create(elem); if (view instanceof ImageView) { ((ImageView) view) .setLoadsSynchronously(true); } return view; } }; } }); jEditorPane.setPage(url); JeditorRendererer docRenderer = new JeditorRendererer(); } catch (IOException e) { System.out.println("IO Exception"); e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } return null; } </code></pre> <p>}); }</p> <p>As you can see, in order to get our barcode to not display as a broken image icon I overwrote the method for creating an ImageView so that it loads it synchronously. Is there something similar for the rest of the html content? A receipt will all be text in html and an image tag at the bottom.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload