I have a project in which I am using a Raspberry Pi to print ticket to a thermal printer.
It is pretty much the same principle as in this video.
Tickets are generated from templates that may include text and images. Both text and images are dynamic, for example I may want to print the current time. I receive the template as a .psd from a designer and the thermal printer takes bitmap data. The Raspberry Pi communicates to the printer with a python library. Everything must be done locally as cloud access is not guaranteed. Performance is important.
I investigated several options:
Latex + ImageMagick
Webkit + Phantom.js
Pillow (Python Imaging Library), especially the module ImageDraw
The first option is not quite satisfying because Latex generates a pdf file and then ImageMagick is very slow to convert it to a .png.
The second option is seducing but if I am not mistaken, I would need to start a server locally.
The third option would be great because it will be pure python, but requires to build a basic typesetting system on top of PIL.
Has anyone been confronted to a similar problem ?
Related
I am testing around with EDK2 by Tianocore (https://github.com/tianocore/edk2) and I can build BIOS images as well as UEFI Applications and drivers but when it comes to building a UEFI capsule, I am not sure how to go about doing this.
https://uefi.org/sites/default/files/resources/UEFI%20Fall%202018%20Intel%20UEFI%20Capsules.pdf this points to some ideas but I am not sure the exact path to take here.
I see two possibilities:
https://github.com/tianocore/edk2/tree/master/FmpDevicePkg this is the package mentioned in the PDF link above and the PDF also mentions an integrated build pipeline for making a capsule. It also mentions a standalone python script which is option two.
https://github.com/tianocore/edk2/tree/c640186ec8aae6164123ee38de6409aed69eab12/BaseTools/Source/Python/GenFds there are standalone scripts to make these images and artifacts like capsules and headers at this location but I am unsure if these are intended to be used as is or only as a part of a larger build pipeline.
My end goal here is to produce a UEFI capsule and place UEFI drivers inside it as the payload so any tips or help would be appreciated.
I'm converting pdf to images using a nodejs package: https://www.npmjs.com/package/pdf2images-multiple
This works successfully in docker on two different local machines which both have Graphic Cards. However when I try to run this on a server in Google Cloud (which does not have a GPU). The following error occurs for particular pdf pages that have graphs:
error: message=Failed to convert page to image, killed=false, code=1, signal=null, cmd=gm convert -density 150 -quality 100 -sharpen 0x1.0 -trim '/usr/src/app/1161115-30-1kabyqq.2bteimgqfr.pdf[7]' '/usr/src/app/pdfimages1161115-30-10uod6h.siy6pyzaor/1161115-30-1kabyqq-7.png', stdout=, stderr=gm convert: "gs" "-q" "-dBATCH" "-dMaxBitmap=50000000" "-dNOPAUSE" "-sDEVICE=pnmraw" "-dTextAlphaBits=4" "-dGraphicsAlphaBits=4" "-r150x150" "-dFirstPage=8" "-dLastPage=8" "-sOutputFile=/usr/src/app/gmxHC5iw" "--" "/usr/src/app/gm0tibSq" "-c" "quit" (child process quit due to signal 11).
gm convert: Postscript delegate failed (/usr/src/app/1161115-30-1kabyqq.2bteimgqfr.pdf).
I've created an AWS instance with a GPU and this error does not occur. Looking to see if there's an Environment Variable that would be able to skip the GPU variant in GhostScript at least until Google Cloud gets GPUs or some alternative that I'm not seeing here.
The command in the error message called GraphicsMagick has documentation saying it doesn't use any GPU techniques.
http://www.graphicsmagick.org/FAQ.html#are-there-any-plans-to-use-opencl-or-cuda-to-use-a-gpu
Ghostscript does not need, and indeed is not capable of using (beyond using X to display the bitmap) a GPU. There is some SIMD code, but you can compile without that, obviously I have no idea how the Ghostscript you are using was compiled.
For Linux, its often impossible to move a binary from one box to another, because the ABI differs between the two systems in terms of things like the C runtime. Also, if the executable has been compiled with shared libraries (many distributions insist on doing this) then differing versions of the shared libraries might cause problems.
My guess is that, rather than the presence or absence of a GPU, there is some significant difference between the Google Cloud Linux and the AWS Linux.
The best way to deploy Ghostscript on Linux is to build it from source on the machine you intend to use, this is especially true if you intend to put it on multiple machines with different configurations.
I am looking for some tool or library (.NET version will be perfect) I could use to convert some big PDF files (over 200MB) to TIFF in the product we are developing for our client.
I need tool I could call from the command line or a library that I could use in the .Net application.
I have tested ghostscript, and it works perfect but according to its license, we cannot use it.
Do you have any experience with free or commercial products we could use for it? Could you recommend something?
Thanks in advance!
As you explicitly ask for commercial software as well, callas pdfToolbox performs this task. I'm affiliated with this company / product so draw your own conclusions about quality / price. However, the software:
works perfectly on the command-line
exports to PNG, JPG or TIFF (or rasterized PDF)
exports to either grey, RGB or CMYK
supports smoothing and overprint preview (important when you're in graphic arts, likely less so if not)
is available on Mac OS X, Windows, Linux and Unix
Send me a private message if you want to know more.
Gnostice PDFOne .NET has a PDFDocument.SaveAsMultiPageTiff() method that you can use.
http://www.gnostice.com/nl_article.asp?id=215&t=Convert_A_Multi-Page_TIFF_To_PDF_Using_PDFOne_NET
I am putting together a very simple device for developing C++ applications on the go. Something like a a psp, size wise, with a small keyboard to write code and LCD screen for the output. This device has also a DVI out, so I can output to screen too.
Now, I am looking for a very lightweight C++ IDE for X11 (the device runs on a Linux variant of OpenEmbedded); something that is able to work decently on both the DVI monitor but mainly on the small lcd screen (it is a 4.3 inch screen with a 480x272 resolution).
I am aware that anything under 1024x768 is just pure joy for pain lovers, but the device will be used only in particular situations; when a laptop/netbook is not feasible.
While using the DVI out, I have no problems running Gnome, the screen is big enough to allow me to work comfortably. the problem is that it won't scale very well on the 480x272 screen.
The first idea was to use nano and g++, without even loading X11, but I need to have something with code completion and a minimal UI to do the standard operations (build, run, debugging step by step, breakpoints), if possible. The memory is not that big (256 Mb), so the smaller the IDE, the better it is.
What would you suggest, other than the approach via text editor and g++ ? I am new to the embedded linux world, I use Eclipse on Ubuntu, but that one is incredibly huge and on such small device would just kill it. On Windows I would use Dev-C++, while on Mac I use either code:blocks or Xcode, but I don't really need all these features for the device.
Thanks in advance
I had the same problem, developing on an ODroid (http://hardkernel.com) running Linux on an ARM processor. For a while I used Netbeans, but it was too heavy, so I finally gave up and wrote my own open source IDE for the purpose.
https://github.com/amirgeva/coide
I have to make a hardware project using a microcontroller, memory, screens, etc.
Is it possible to make an independent PDF / documents reader, which is capable of running on battery power?
Please note I don't want to use any technology which needs licensing. It must be all freeware readers, etc., and programing language can be assembly, C, Flash or any.
I have submitted proposal of PDF reader project (independent hardware). Many say it's impossible. What should I do?
Reading and displaying a PDF document is quite a "high level operation".
You should start with a microcontroller starter kit, with an ARM9 processor or something similar. Then install a Linux operating system on it, include a standard display driver and run an X server. Then you should be able to find a Linux based PDF reader with X drivers.
To 2nd another comment here, I would say that you're not going to to do this with a microcontroller, you're going to need to get some more powerful ARM CPU like an ARM9, Cortex-A8 or similar with a decent amount of RAM.
You'll probably need something that's capable of running Linux if you want to start with pieces of software that won't require writing quite a large volume of software from scratch.
Note that for commercial devices that are out there, including the Kindle, run Linux, and aren't based on a micrcontroller.
You might be best off getting something like a BeagleBoard, attach a display to that, and start from there with an X-based PDF viewer.