I have an app to make and the basic idea is that a client sits on the master computer whilst a server on the other. You drag and drop a file from one of the child computers, enter the number of copies and send it. (VIA TCP) it is received on the other end and printed.
The problem I am facing is that HOW TO send the FILE (.docx, .pdf, .png, .pptx, etc. ANY FORMAT) for printing.
I can use .NET (ANY), JSP and PHP :)
See this question for an answer on how to automate printing documents using acrobat reader. Basically, you would upload the file to the server and then call the respective acrobat reader command to print the document on a specified printer. To do the same in word, it's a bit more complex, because you'll have to use DDE (dynamic data exchange). Consult the MSDN for further information, I haven't been using it before.
Related
I have created a site with a custom module built on top of OpenCart. It allows you to design a business card, brochure, or post card online (something like vistaprint but simpler) and generates a print ready file.
One of the requested features was a mail merge type feature for post cards. Basically the customer would create their design, then upload a csv file of the names and addresses they want the document mailed to.
My thought was after the order was placed a script on the server would go through the csv file, and create an image for each row. Basically inserting the mailing address onto the graphic and saving it as a copy. Once it was done with them it would bundle them into a pdf and send the printer a link to download the file.
That will work great if they are sending it to 100 people or less, but if they want to mail it to 10,000 people I don't see it working.
Does anyone have any experience generating a mass amount of graphics and giant pdfs? If so I would love their advice on how to implement it.
I have full control of the server, and can install or modify any software on it. It is Cent OS, with PHP, MySQL, and the works. I do not have any extra pdf extensions installed as I haven't needed them yet, but I can add them.
Other Notes:
- The resolution will be at 300dpi. Meaning each page of the pdf will be as much as 2,550 x 3,300px
- The final product doesn't have to be a pdf, it just needs to be a single file and printable
- I am currently rendering the graphics as a jpg or png
I do plan to post the module on OpenCarts extension directory after I have all of it working, so if it suits anyones needs it will be there once it is all working properly.
If you have access to the box install ImageMagick and then use "convert" application.
convert *.jpg pdf/export.pdf -density 960x570 -units PixelsPerInch
http://www.imagemagick.org/script/convert.php
I would like to use a receipt printer with my web based POS.. Before i go any further i know you can not force print a receipt from the browser and the only options are to do it via PHP, and cups, which is not an option or a Java Applet, Prefer no to..
My question is im looking at the Star Micronics TSP-100 and would like to send a PDF to it. I have looked all over and can not find if receipt printers will print standard PDF's..
Also if anyone has any experience with this any tips would be helpful.. Ie what page size do you set?
EDIT: The server platform is Linux, PHP / MYSQL and im using Yii with the epdf plugin. PDF generation is not the issue. It unclear if a receipt printer can print a pdf. Also what page properties should i use when setting up the document. Ie width / height.. Width i know is determined by the printer, but im curious to height.
You cannot force a receipt print from the browser but you can use an Active X control (in IE) and print the receipt locally.
What I did was:
1. generate the pdf on the server
2. call an Active X command to download the PDF using wget (this puts the file on the local machine.
objShell.run('cmd /K wget -P /pos/invoices/ http://url.com/pos/<?php echo $filename;?>',0,false);
call an Active x command to print the local PDF using Adobe command line
objShell.run('"C:\\Program Files (x86)\\Adobe\\Reader 11.0\\Reader\\AcroRd32.exe" /h /s /o /t "C:\\pos\\<?php echo $filename;?>"');
In order to print to your receipt printer, you just need to set it as default printer or change the Active x commands to include the printer name. I am still working on the paper size issue.
I realize you are using Linux so the Windows commands will not work but the process is the same.
Your question is not too clear. You did not mention which operating system are you using.
I think, you have two problems
Printing a PDF from PHP. I found this Adobe Reader Command Line Reference
Generating a PDF from a template. I can recommend wkhtmltopdf, which is exists for MS-Windows and Linux platforms. It uses WebKit to render page, so the source is plain HTML+CSS.
I was wondering is there any tutorial out there that can teach you how to push multiple files from desktop to a PHP based web server with use of Python application?
Edited
I am going to be writing this so I am wondering in general what would be the best method to push files from my desktop to web server. As read from some responses about FTP so I will look into that (no sFTP support sadly) so just old plain FTP, or my other option is to push the data and have PHP read the data thats being send to it pretty much like Action Script + Flash file unloader I made which pushes the files to the server and they are then fetched by PHP and it goes on from that point on.
I'm assuming you own the PHP server.
Use FTP. See here and here.
Make a file upload form with PHP, and use python to fill out the form. See this and this.
(Usually a bad idea) Use PHP to write small server that listens for data and then writes it to a file.
I think you're referring to a application made in php running on some website in which case thats just normal HTTP stuff.
So just look at what name the file field has on the html form generated by that php script and then do a normal post. (urllib2 or whatever you use)
I am working on a project that will end up printing receipts, my client uses a dot-matrix printer (some old version). He will need a system where receipt printing will be fast i.e. time efficient, and not opening a dialog box and choosing a printer...moreover the printer will be shared through a network.
The main problem is that all this should be done using PHP. the following are some thoughts of solutions.
Design a php script to write data to a text file then print the text file using a remote printer
-the problem is that I am having a hard time getting server side printing from PHP. Logically it seems to work.
Platform =====> WIN XP
Printer Location =====> Main server on a LAN N/W
What's the intended workflow before the user hit's enter?
What's the make and model of printer? This is important so that we can see if it needs any fancy escape codes sent to it?
Usually if you're printing then it would be sent from the client machine.
If printing from the server the data needs to be either sent to the server or needs to already be there and accessible. Is it already there in a database? Or are you sending a webform?
You say RCPT, is this a receipt?
Okay, so if you have the text file created on the server you should be able to copy the text file to lpt1: or 2: or whatever device it's defined as.
You need to know what the file's named as, or you could pass it on, but how about:
exec('c:\WINDOWS\system32\cmd.exe /c START C:\some_dir\print_me.bat');
I wish my users could select a directory from their PC and upload all files from this directory, so they could upload whole album(directory) instead of uploading every single file separately.
I would like to ask you if this is somehow possible using PHP or JavaScript and without using any framework.
thank you
First of all, PHP can't do anything to the user's local computer. Since it never runs there (unless the user's computer is the server also).
JavaScript runs on the user's local computer but isn't setup to handle things like this.
Java and Flash runs on the user's computer and can be setup to do exactly this.
Look at SWFUpload. I highly recommend it.
And if you want Java, check out RadUpload. The lite edition is free.
A thing to note, what these Flash and Java solutions both do is accept a file selection from the user and then send that to a PHP script which does the actual uploading.
It would probably make more sense for them to upload a .zip containing multiple images - which is possible in PHP.
I do not think it is possible as you describe it. Create a small utility which they can run on their PC that will do the job. Also check out how Facebook upload image works. They upload dozens of images at the same time.
Not possible using purely php/javascript. However, take a look at http://www.element-it.com/JavaPowUpload.aspx, it is a java-based file uploader that allows you to completely hide the interface, and, if you wish, power the whole interface via javascript. However, it is not free, perhaps not suitable for a personal project.
This may not meet your requirement of Javascript, but if you wish you could build your uploader object as an activex object and use CURL to actually perform the upload or do it as a Java applet.
I had built a Java applet based uploader for a client and I found resources on line and used that as my base for building the uploader.
SWFUpload, as mentioned in one of the answers you received is a good one.