Closed tresf closed 8 years ago
It appears that changing the orientation
setting for PDF's currently does not work.
I had to use an image to test how the orientation
setting currently functions.
var size = { width: 3.3, height: 1.1};
var config = qz.configs.create('Microsoft XPS Document', { orientation: 'landscape', units: 'in', size: size });
Using the PDF above, I was not able to view any differences between forcing landscape
or portrait
However, when I tried doing the same thing with an image, we can see that the image is rotated
Then, when I changed the page dimensions, I got:
Note: Even after adding a printer with the above dimensions to my operating system, and using the original image that was designed for that size, I was unable to get rid of the gap at the bottom of the image.
I was unable to get rid of the gap at the bottom of the image.
Right, because the dimensions were off by a considerable margin when compared to the label mentioned.
Here's an illustration showing it fixed to a 3:1 ratio...
GREEN: stretch width to be proportional BLUE: shrink height to be proportional
changing the orientation setting for PDF's currently does not work.
Confirmed, except mine does portrait orientation every time (using PDFCreator, not XPS).
Upstream convo: https://issues.apache.org/jira/browse/PDFBOX-2922
@bberenz I've spent some time reading up on this and I'm not sure how best to approach the force-orientation in code.
It looks like PDFBox is internally forcing a swap of dimensions when width > height to avoid the exception thrown by the MediaSize
class when this condition is met.
We manage to skirt around this issue with image printing by using the MediaPrintableArea
class, but as we have no control over the pdf printing logic I'm not sure there is anything we can do here.
The XPS printer is a bit .. loose anyways. Have you seen any of the results when using an actual label printer with PDFs?
@bberenz using PDFCreator
, this auto-rotates as documented. We have some options...
To quote the relevant portions from the developer...
If you want to customise the orientation, then you don't want to use
PDFPageable
. The purpose of aPageable
interface is to let the source document determine its own layout. If you want to do something custom, then skip thePageable
and use aPrintable
directly.
I do much prefer the standard behavior, but how much work is the Printable
portions he speaks of? Can we use Printable
if orientation is provided and fallback onto Pageable
if not?
This bug report has been re-titled and migrated to https://github.com/qzind/tray/issues/12.
This bug report has been re-titled and migrated to https://github.com/qzind/tray/issues/12.
Placeholder for testing, configuration and output for
99010
(1.1in x 3.3in, 28mm x 89mm) Dymo label format.Related: #177
Sample label: (landscape) 3.3in x 1.1in.pdf
Sample label: (portrait) 1.1in x 3.3in.pdf