Giter Club home page Giter Club logo

cupsffi's People

Contributors

huerlisi avatar jslabovitz avatar kbrock avatar markglenn avatar mykhi avatar nehresma avatar rafagf1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

cupsffi's Issues

All Print Jobs

Great work, and thanks for the gem, but I don't see any way to get all of the jobs for a printer. This is needed for managing the queue and editing jobs that weren't created in the application.

Close the connection after printing

I just need to inform you that you should document that for remote printing closing the connection is required because if the connection didn't get closed this will eventually freeze your app server. I have experienced this with PUMA as app server.

The strange thing when I read the code the close method already exist but there not mention to use it in the documentation.

Is this an active project?

Hello,
Is this still an active project? There are some forks of this code in Github that have some additional options added. Are you willing to accept code contributions from others and include it in here for updates to this library?

ArgumentError while printing jasper generated pdf.

I'm using cupsffi to print a document that is generated on a jasper server.

I'm using rest-client to interact with the jasper server rest api.

After I run and fetch the report I get the following output:

"%PDF-1.4\n%\xE2\xE3\xCF\xD3\n3 0 obj\n<</Length 58/Filter/FlateDecode>>stream\nx\x9C+\xE4r\n\xE126S02Q\bI\xE1r\r\xE1\n\xE42R\xF0\x02\t\x1A*\x18\x00!\x8843P\b\xC9\xE5\xD2w3T0\x04\xB2\xD2\xB844C\xB2@J\x01h;\v\xDB\nendstream\nendobj\n1 0 obj\n<</Group<</Type/Group/CS/DeviceRGB/S/Transparency>>/Parent 4 0 R/Contents 3 0 R/Type/Page/Resources<</ProcSet [/PDF /Text /ImageB /ImageC /ImageI]/ColorSpace<</CS/DeviceRGB>>/Font<</F1 2 0 R>>>>/MediaBox[0 0 76 60]>>\nendobj\n5 0 obj\n[1 0 R/XYZ 0 70 0]\nendobj\n2 0 obj\n<</BaseFont/Helvetica/Type/Font/Encoding/WinAnsiEncoding/Subtype/Type1>>\nendobj\n4 0 obj\n<</ITXT(2.1.7)/Type/Pages/Count 1/Kids[1 0 R]>>\nendobj\n6 0 obj\n<</Names[(JR_PAGE_ANCHOR_0_1) 5 0 R]>>\nendobj\n7 0 obj\n<</Dests 6 0 R>>\nendobj\n8 0 obj\n<</Names 7 0 R/Type/Catalog/ViewerPreferences<</PrintScaling/AppDefault>>/Pages 4 0 R>>\nendobj\n9 0 obj\n<</Creator(JasperReports \(assay_label_small\))/Producer(iText 2.1.7 by 1T3XT)/ModDate(D:20130422184845+01'00')/CreationDate(D:20130422184845+01'00')>>\nendobj\nxref\n0 10\n0000000000 65535 f \n0000000139 00000 n \n0000000405 00000 n \n0000000015 00000 n \n0000000493 00000 n \n0000000371 00000 n \n0000000556 00000 n \n0000000610 00000 n \n0000000642 00000 n \n0000000745 00000 n \ntrailer\n<</Root 8 0 R/ID [<40528028e4bc756ecf16988a0ab9401e>]/Info 9 0 R/Size 10>>\nstartxref\n912\n%%EOF\n"

When I try to print this with the "application/pdf" mime_type I receive "ArgumentError: string contains null byte"

I went to cups to see if the job was created, and it is, although is showed as "held" and with size of 0Kb.

If I try to print again, right after the first error, I get a "RuntimeError: Undefined error: 0" and I can no longer see the printer after I call "CupsPrinter.get_all_printer_names". Only if I restart my rails console I'm able to get the printers configured on the cups server.

Thanks.

Printer options that is not key=value pair

Hello there,
I've been using CUPS in a project and I am running into a few issues that couldn't figure it out yet.
How can I send the option '-o landscape' to the printer using the 'print_file' method?

In the documentation it only refers to examples that are key, value pairs ({'InputSlot' => 'Upper', 'PageSize' => 'A4'}).

I tried many different ways but I always get an error.
I know the printer supports it because my files prints correctly when I use 'lpr' command line.

Thanks,
Helio

Support PPD attributes, page size

Your CupsFFI library has been very useful to me. However, I needed a way to fetch PPD attributes, as well as page size. So I added the code. I'd not worked with FFI before, so I may have done some things wrong, but it's working already for me.

I'm trying to send you a patch, but I can't seem to attach one here, or include it without it being marked up. How should I send it to you?

How to print number of copies

Howdy,

Loving this gem, thanks! I'm having trouble changing the number of copies to print.

I've tried:

@printer = CupsPrinter.new(params[:name], hostname: @hostname, 'copies' => 2)
@printer.print_file('./public/test.pdf') 

and

@printer = CupsPrinter.new(params[:name], hostname: @hostname, copies: 2)
@printer.print_file('./public/test.pdf')

and various other combinations including passing copies to the print_file method.

Thanks for any help!

ffi Loaderror on require 'cupsffi'

Hello.
I was checking out your gem and ran into the following error, right after gem install cupsffi ( whihc build jsut fine)
I'm getting a load error on require 'cupsffi'.

I'm running fine under cups gem or from the command line.
Using rvm ruby 1.9.2p290 and Cups 1.5.0 on a Debian 6 x64 system

Here is an error:

            LoadError: no library specified
            from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/ffi-1.0.11/lib/ffi/library.rb:150:in `ffi_libraries'
            from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/ffi-1.0.11/lib/ffi/library.rb:228:in `attach_function'
            from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/cupsffi-0.0.5/lib/cupsffi/lib.rb:176:in `<module:CupsFFI>'
            from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/cupsffi-0.0.5/lib/cupsffi/lib.rb:25:in `<top (required)>'
            from /usr/local/rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
            from /usr/local/rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
            from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/cupsffi-0.0.5/lib/cupsffi.rb:3:in `<top (required)>'
            from /usr/local/rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:59:in `require'
            from /usr/local/rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:59:in `rescue in require'
            from /usr/local/rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
            from (irb):1
            from /usr/local/rvm/rubies/ruby-1.9.2-p290/bin/irb:16:in `<main>'

Expected behavior or a bug?

Hi.

I'm playing around with cupsffi. In my setup CUPS server is remote and i'm printing from a client server that runs my Rails app.

cupsffi - automatically picked up connection from /etc/cups/client.conf and a list of all printers

I setup my printer in config ( using configatron ) like so:

configatron.printers.it = CupsPrinter.new('1-ITD-PRINT1')

Here is the issue.
After I start my rails console and do some test printing it works fine. But if I do something else and then come back to printing in a few minutes it seems that is timed out and I can't get it to do anything: print, list printers, or jobs

The only way to restart connection is either restart the app, or recreate connection specifying the server

configatron.printers.it = CupsPrinter.new('1-ITD-PRINT1', {hostname: 192.168.1.38})

Now I can print again. Until I leave printing for a few minutes and then the connection is timed out again.

When it becomes an issue:
well in development - for sure - but I can just recreated the connection.
But it may be an issue in some of the rake tasks - I have some long runing tasks - reports, updates, and some of them do a fair amount of printing, with some idle periods between the jobs. Right now I'm sending system commands, but I'd like to avoid that - so I'm tryuing out cupffi

So is this supposed to happen?
If so where is the time out set and is it possible to control it?
If the connection is lost, do I need to destroy the printer object / close connection? I don't want to pollute memory with a bunch of unwanted and unused printer objects.

Thank you!

No page numbering from printer

This may or may not be a cupsffi problem. When we print we normally get page numbers, but with cupsffi I cannot get the page numbers to appear. Cups.org talks about a prettyprint option, but it comes back as invalid whenever I try to pass it.

printer.print_file(printable.pdf_file, 'prettyprint' => 'prettyprint')

Any suggestions?

Support passing generic CUPS options to print jobs

First of all: great gem, loving it!

I've tried passing {'copies' => 40} to a .print_datacall, but got a message that this option is not supported by the printer.

Digging in the source code, I found out, that you validate the options against the PPD. But copies seems to be a generic option, available in all printers. Simply disabling the option validation did work: I've been able to pass the copies option and the printer respected it.

I'm no CUPS specialist and thus not sure if there are any other such generic options.

Not printing .prn

I am trying to print .prn file using this gem, but its treating prn file as text file.

Please suggest

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.