-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to print PDF in landscape #2
Comments
Hello, Did you manage to fix that issue? Having the same issue here. macOs 10.13.4 Tried all possible options:
|
@slawkens I did not, unfortunately. I managed to get the PDF in landscape by using a external library ( |
Thanks for your valuable input. But, I wasn't satisfied with that workaround, requiring me to invest more time to modify my existing code, so I investigated more time into fixing this issue. So, after trying many workarounds, I finally ended changing cups LogLevel to debug and watching the valuable logs file..
Then I checked generated log. It gave me valueable information about attribute that was not valid.
It indicated that value should have 4 bytes. Ok, so let's try to modify our code to provide 4 bytes value as parameter :) I've read how to convert php int to be 4-bytes here: https://stackoverflow.com/questions/26184947/convert-int-into-4-byte-string-in-php $value = pack('N', 4);
$job->addAttribute('orientation-requested', $value); Where 4 is our value for landscape. That was the trick and it did the job! Hope it helps someone. |
Thanks for the feedback 👍 |
There's no real handling of enum values in the Smalot\Cups\Builder class, it just passes the value straight through (see the todo note on line 197 of src/Builder/Builder.php). This patch will encode and pass through numeric values and throw exceptions on non-numeric ones. A more complete implementation would require pulling out the various possible enum values from RFC 8011 and having resolving those. |
This partially fixes smalot#2, but a complete fix will require handling the non-numeric values for enum fields. A table of those could be pulled from RFC 8011.
Hi,
Thanks for your package, it worked out of the box without too much issues! 👍
I'm trying to print a PDF in landscape to a Zebra printer.
I've tried to add an attribute
landscape = true
andorientation-requested = 4
but it fails.Guzzle exception says:
Bad Request
Cups error log shows:
IPP read error: IPP enum value not 4 bytes
If I don't supply the attribute the label is printed but in portrait. I've also tried to use the
0x04
syntax but it returns the same error.Any pointers?
Ubuntu 14.04
Cups 1.5.3
PHP 5.6.33 (Yeah I know, I know)
My code:
The text was updated successfully, but these errors were encountered: