You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Frank Malenfant <fr...@verbois.com> on 2016/07/08 18:56:37 UTC
Bad file orientation in printer
Hi,
As I have done many times before without any problem, I am trying to use
the PrintPDF command line tool to send a PDF (see attached file) to a
printer which is a Zebra ZT230. It is a label, so I generated a media sized
PDF file using PHP�s ezPDF like I do since 10 years, configured the default
settings for the Zebra printer in Windows Server 2012 (see screenshot below)
and used pdfBox v2.0.2 (also tried v1.8.10). The label is 4 inches wide x 2
inches long, but it prints like it�s rotated 90� counter-clock-wise and on
the right. Here is what I�ve tried so far before I reached your community.
1. I printed the PDF directly through Acrobat, it printed Well.
2. I tried to generate a label that is rotated to match the behaviour
of the printer (rotating the PDF file by 90�), it acted as if I rotated it
by 180�, it�s still not displaying the content with the good orientation on
the media.
3. I changed the definition of my PDF file from 2 x 4 (with portrait
orientation) to 4 x 2 (with landscape orientation), same result as #2
4. Modified the default printer settings from �Portrait� to
�Landscape�, no difference at all
5. Changed the media size in the default printer settings from 4 x 2
to 2 x 4, no difference at all
So, I�m pretty sure I�ve ruled out my PDF generator from the equation (+
I�ve been using it to generate labels like these for years on Windows Server
2008 and CentOs 7 servers), I also know from printing through Acrobat that
the printer behaves well and that the printer settings are OK. I really
don�t know why pdfBox could be working differently on this machine but it
looks like the only likely option left.
Is there anyway I could force some settings or orientation through pdfBox
using the Command line tools or do you have any ideas for a fix I could try?
Please help me, I�ve struggling with this for hours and I�m getting pretty
frustrated although I made sure to rule out as much possibilities as I could
think before I contact you.
Many thanks,
Sorry it�s in French, I translated some words to help you understand
Frank Malenfant
Analyste / Responsable T.I.
Verbois
140, L.P. Lebrun
Rivi�re-du-Loup, QC G5R 5W8
T: 418.868.0500 #222 - F: 418.868.0055
S.F. : 1.888.775.0500
<http://instagram.com/verbois.admin?ref=badge> Instagram_24.
<http://www.facebook.com/creationsverbois> facebook
<http://fr.pinterest.com/jrverbois/> pinterest
Re: Bad file orientation in printer
Posted by Tilman Hausherr <TH...@t-online.de>.
Am 08.07.2016 um 20:56 schrieb Frank Malenfant:
>
> Is there anyway I could force some settings or orientation through
> pdfBox using the Command line tools or do you have any ideas for a fix
> I could try?
>
I added an orientation parameter to the PrintPDF tool, it will be
available within hours
https://repository.apache.org/content/groups/snapshots/org/apache/pdfbox/pdfbox-app/2.0.3-SNAPSHOT/
However I'm having a weird effect here, stuff is cut off on the left.
Alternative:
Use PDFToImage to convert to PNG and print that one somehow.
Tilman
Re: Bad file orientation in printer
Posted by Tilman Hausherr <TH...@t-online.de>.
Your file didn't go through, although I have it (as moderator).
I tried printing on an ordinary printer and it was always 90 rotated,
even with two other java products.
What worked is this code:
PrinterJob job = PrinterJob.getPrinterJob();
job.setPageable(new PDFPageable(document,
Orientation.PORTRAIT, false, 0));
if (job.printDialog())
{
job.print();
}
Don't know if this works with your printer. I remember having heard such
problems before.
You could also try replacing the 0 with 200 or 300.
Tilman
Am 08.07.2016 um 20:56 schrieb Frank Malenfant:
>
> Hi,
>
> As I have done many times before without any problem, I am trying
> to use the PrintPDF command line tool to send a PDF (see attached
> file) to a printer which is a Zebra ZT230. It is a label, so I
> generated a media sized PDF file using PHPs ezPDF like I do since 10
> years, configured the default settings for the Zebra printer in
> Windows Server 2012 (see screenshot below) and used pdfBox v2.0.2
> (also tried v1.8.10). The label is 4 inches wide x 2 inches long, but
> it prints like its rotated 90 counter-clock-wise and on the right.
> Here is what Ive tried so far before I reached your community.
>
> 1.I printed the PDF directly through Acrobat, it printed Well.
>
> 2.I tried to generate a label that is rotated to match the behaviour
> of the printer (rotating the PDF file by 90), it acted as if I
> rotated it by 180, its still not displaying the content with the
> good orientation on the media.
>
> 3.I changed the definition of my PDF file from 2 x 4 (with portrait
> orientation) to 4 x 2 (with landscape orientation), same result as #2
>
> 4.Modified the default printer settings from Portrait to
> Landscape, no difference at all
>
> 5.Changed the media size in the default printer settings from 4 x 2 to
> 2 x 4, no difference at all
>
> So, Im pretty sure Ive ruled out my PDF generator from the
> equation (+ Ive been using it to generate labels like these for years
> on Windows Server 2008 and CentOs 7 servers), I also know from
> printing through Acrobat that the printer behaves well and that the
> printer settings are OK. I really dont know why pdfBox could be
> working differently on this machine but it looks like the only likely
> option left.
>
> Is there anyway I could force some settings or orientation through
> pdfBox using the Command line tools or do you have any ideas for a fix
> I could try?
>
> Please help me, Ive struggling with this for hours and Im getting
> pretty frustrated although I made sure to rule out as much
> possibilities as I could think before I contact you.
>
> Many thanks,
>
> */ Sorry its in French, I translated some words to help you
> understand/*
>
> Frank Malenfant
>
> *Analyste / Responsable T.I.*
>
> *Verbois*
>
> 140, L.P. Lebrun
>
> Rivire-du-Loup, QC G5R 5W8
>
> T: 418.868.0500 #222 - F: 418.868.0055
>
> S.F. : 1.888.775.0500__
>
> */__/*
>
> Instagram_24 <http://instagram.com/verbois.admin?ref=badge>.facebook
> <http://www.facebook.com/creationsverbois>pinterest
> <http://fr.pinterest.com/jrverbois/>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
Re: Bad file orientation in printer
Posted by Tilman Hausherr <TH...@t-online.de>.
Am 08.07.2016 um 20:56 schrieb Frank Malenfant:
>
> Is there anyway I could force some settings or orientation through
> pdfBox using the Command line tools or do you have any ideas for a fix
> I could try?
>
Oops, I missed that line. You want something for the command line tools.
Is the problem that you're not a java dev and needs something to be
called from the command line?
Tilman