printing

printing a 2 pages of jframe in java

风流意气都作罢 提交于 2019-12-17 20:31:27
问题 i would like to print a jframe that contain a lot of textfield and buttons that contain a data. i want to print this jframe by clicking a Print jbutton. i tried this code. protected void print() { PrinterJob job = PrinterJob.getPrinterJob(); if(job.printDialog()){ try { job.setPrintable(new Printable() { @Override public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws PrinterException { if(pageIndex == 0){ Graphics2D g2d = (Graphics2D)graphics; g2d.translate

Conditionally render JSF components for printing

╄→尐↘猪︶ㄣ 提交于 2019-12-17 20:29:23
问题 I want to print only a certain part of my webpage (so not the whole page). How can I achieve this in JSF? 回答1: This is normally to be controlled by CSS with display: none|block . Check the CSS media rules. For example, as @media print {} inside a default CSS file: @media print { #header, #footer, #menu { display: none; } } (the above example will hide HTML elements with IDs header , footer and menu ) Or via a generic style class: @media screen { .printonly { display: none; } } @media print {

Google apps script getAs('application/pdf') layout

☆樱花仙子☆ 提交于 2019-12-17 19:53:35
问题 I am generating a PDF file from a spreadsheet using an app script I found here. This one uses the good old Method getAs('application/pdf') and works great. The problem is that the PDF document generated in this way has unwanted asymmetric margins (larger on the right, narrow on the left). I just wanted the page to be centered. The weird thing is that when I print from the Google menu File -> Print (or Ctrl + P) the document appears centered correctly. My code looks like this: function CreaPDF

Printing of WPF Window on one page

▼魔方 西西 提交于 2019-12-17 19:44:59
问题 I am able to print the current Window using the following code: PrintDialog printDialog = new PrintDialog(); if (printDialog.ShowDialog().GetValueOrDefault(false)) { printDialog.PrintVisual(this, this.Title); } However if the Window does not fit the page it get truncated. How do I make the Window fit the Page ? I guess I need to make a graphics element first and check if this graphics fits the page, but I have found nothing so far. 回答1: There is one solution out there that lots of people are

Printing with advanced options (tray selection, duplex, staple)

有些话、适合烂在心里 提交于 2019-12-17 19:29:37
问题 We have a project of managing printing documents. At first I wonder why printing options couldn't be set up in single place. For example printer tray selection for first page and for other pages can be done using MS Word automation : var doc = _applicationObject.Documents.OpenNoRepairDialog(FileName: ref sourceFile, ReadOnly: ref readOnly, AddToRecentFiles: ref addToRecentFiles, Visible: ref visible); doc.PageSetup.FirstPageTray = (WdPaperTray) firstPageTrayCode; doc.PageSetup.OtherPagesTray

Java: Printing program output to a physical printer

∥☆過路亽.° 提交于 2019-12-17 18:43:40
问题 I am a relatively new programmer so this may be a really simple question to answer but its got me a bit stumped.. I'm trying to print my Java GUI's final output to a printer. Now, in my GUI, I have it so that when you hit print, a pop-up comes up with the list of available printers, and based on the one you select, it should print to that printer. However it is not. I got most of my code by scouring the internet for solutions to this problem and found some promising code. However, it printed

How to connect a network printer over Android?

拈花ヽ惹草 提交于 2019-12-17 17:46:08
问题 I want to code an Android app, which will connect to a network printer with a specific IP address, and then make a printing. For printing I know that I need to write my own Postscript for specific files types, and connecting to a network is not a problem over WIFI. How to connect to the network printer? 回答1: Any device connected to a network will communicate via their IP and Ports / sockets. The simplest way to connect via telnet or socket and write the data to their socket buffers. try {

Printing page with bootstrap 3

喜你入骨 提交于 2019-12-17 17:41:42
问题 I've been looking through a lot of answers here on stackoverflow that semi-cover what I'm wondering about, but haven't found anything that worked for me. I understand that the printing page is about 550 px for A4 and therefor bootstrap will use the styles and layout usually used for mobile devices. When I use Ctrl+P for my web page, the printable page looks just like the mobile version of my page. But how do I make it look like the desktop version? (media > 1024 px) Is there a way to do this?

Print PDF from ASP.Net without preview

筅森魡賤 提交于 2019-12-17 17:38:24
问题 I've generated a pdf using iTextSharp and I can preview it very well in ASP.Net but I need to send it directly to printer without a preview. I want the user to click the print button and automatically the document prints. I know that a page can be sent directly to printer using the javascript window.print() but I don't know how to make it for a PDF. Edit: it is not embedded, I generate it like this; ... FileStream stream = new FileStream(Request.PhysicalApplicationPath + "~1.pdf", FileMode

Printing to POS printer from PHP

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-17 17:26:17
问题 We are looking to print to a POS printer connected where apache is running. Due to design of the application, and deployment, printing should be done from Server (it should detect the order and send to different printers and different formats of printing...bill, kitchen orders, and so on...). For this reason and others (like access application from an iPad for example) we discard options like QZ-Print applet and needst o print directly server side. We searched a lot, and found that there are