You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by cenk dundar <ce...@yahoo.com> on 2013/09/22 16:46:10 UTC
I need help!!!! about Landscape Page Format printing
Hi,
I am sending second time, I havent any solution about this subject. I wish you may help me!
My problem is that;
I see Fixed problem that to print landscape page in 1.8.0 version. But I am trying with new version the problem is same. Is there any example to print landscape pdf page correctly.
Re: I need help!!!! about Landscape Page Format printing
Posted by Andreas Lehmkuehler <an...@lehmi.de>.
Hi,
Am 06.10.2013 00:44, schrieb cenk dundar:
> Hi Andreas,
>
> Have you find any solution about to print
> landscape format pdf page
>
> I sent the test pdf to you
>
> Thank you for your help
I can't reproduce your issue. It works fine for me using PrintPDF
BR
Andreas Lehmkühler
>
> --------------------------------------------------------------------------------
> *From:* Andreas Lehmkühler <an...@lehmi.de>
> *To:* cenk dundar <ce...@yahoo.com>
> *Sent:* Thursday, September 26, 2013 1:05 PM
> *Subject:* Re: I need help!!!! about Landscape Page Format printing
>
> Hi,
>
>
> > cenk dundar <cenkdundar@yahoo.com
> <ma...@yahoo.com>> hat am 23. September 2013 um 09:15 geschrieben:
> >
> >
> > There is a pdf file that included some of page is Landscape format. When I print this document landscape pages cannot be printed correctly. It is printed as portrait format.
> >
> Can you provide us with a sample pdf?
>
> > I see that this problem fixed with Ver 1.8.0. I am trying with last version. But The result is same.
> >
> > My test source code is below
> >
> > public static void main(String[] args) throws Exception {
> > String password = "";
> > String pdfFile = "D:/TestPdf.pdf";
> > boolean silentPrint = true;
> > String printerName = "HP";
> > /*for (int i = 0; i < args.length; i++) {
> > if (args[i].equals(PASSWORD)) {
> > i++;
> > if (i >= args.length) {
> > usage();
> > }
> > password = args[i];
> > } else if (args[i].equals(PRINTER_NAME)) {
> > i++;
> > if (i >= args.length) {
> > usage();
> > }
> > printerName = args[i];
> > } else if (args[i].equals(SILENT)) {
> > silentPrint = true;
> > } else {
> > pdfFile = args[i];
> > }
> > }*/
> >
> > if (pdfFile == null) {
> > usage();
> > }
> >
> > PDDocument document = null;
> > try {
> > document = PDDocument.load(pdfFile);
> >
> > if (document.isEncrypted()) {
> > document.decrypt(password);
> > }
> > PrinterJob printJob = PrinterJob.getPrinterJob();
> >
> > if (printerName != null) {
> > PrintService[] printService = PrinterJob.lookupPrintServices();
> > boolean printerFound = false;
> > for (int i = 0; !printerFound && i < printService.length; i++) {
> > if (printService[i].getName().indexOf(printerName) != -1) {
> > printJob.setPrintService(printService[i]);
> > printerFound = true;
> > }
> > }
> > }
> >
> > if (silentPrint) {
> > document.silentPrint(printJob);
> > } else {
> > document.print(printJob);
> > }
> > } finally {
> > if (document != null) {
> > document.close();
> > }
> > }
> > }
> >
> >
> >
> > Thank you for your help!
> >
> >
> >
> > ________________________________
> > From: Andreas Lehmkuehler <andreas@lehmi.de <ma...@lehmi.de>>
> > To: users@pdfbox.apache.org <ma...@pdfbox.apache.org>
> > Sent: Sunday, September 22, 2013 10:00 PM
> > Subject: Re: I need help!!!! about Landscape Page Format printing
> >
> >
> > Hi,
> >
> > Am 22.09.2013 16:46, schrieb cenk dundar:
> > >
> > >
> > > Hi,
> > >
> > > I am sending second time, I havent any solution about this subject. I wish you may help me!
> > Maybe you should give us more input first:
> >
> > What exactly did you do?
> > What did you get?
> > How about a sample pdf?
> >
> > > My problem is that;
> > > I see Fixed problem that to print landscape page in 1.8.0 version. But I am trying with new version the problem is same. Is there any example to print landscape pdf page correctly.
> >
> >
> > BR
> > Andreas Lehmkühler
>
>
> BR
> Andreas Lehmkühler
>
>
Re: I need help!!!! about Landscape Page Format printing
Posted by cenk dundar <ce...@yahoo.com>.
There is a pdf file that included some of page is Landscape format. When I print this document landscape pages cannot be printed correctly. It is printed as portrait format.
I see that this problem fixed with Ver 1.8.0. I am trying with last version. But The result is same.
My test source code is below
public static void main(String[] args) throws Exception {
String password = "";
String pdfFile = "D:/TestPdf.pdf";
boolean silentPrint = true;
String printerName = "HP";
/*for (int i = 0; i < args.length; i++) {
if (args[i].equals(PASSWORD)) {
i++;
if (i >= args.length) {
usage();
}
password = args[i];
} else if (args[i].equals(PRINTER_NAME)) {
i++;
if (i >= args.length) {
usage();
}
printerName = args[i];
} else if (args[i].equals(SILENT)) {
silentPrint = true;
} else {
pdfFile = args[i];
}
}*/
if (pdfFile == null) {
usage();
}
PDDocument document = null;
try {
document = PDDocument.load(pdfFile);
if (document.isEncrypted()) {
document.decrypt(password);
}
PrinterJob printJob = PrinterJob.getPrinterJob();
if (printerName != null) {
PrintService[] printService = PrinterJob.lookupPrintServices();
boolean printerFound = false;
for (int i = 0; !printerFound && i < printService.length; i++) {
if (printService[i].getName().indexOf(printerName) != -1) {
printJob.setPrintService(printService[i]);
printerFound = true;
}
}
}
if (silentPrint) {
document.silentPrint(printJob);
} else {
document.print(printJob);
}
} finally {
if (document != null) {
document.close();
}
}
}
Thank you for your help!
________________________________
From: Andreas Lehmkuehler <an...@lehmi.de>
To: users@pdfbox.apache.org
Sent: Sunday, September 22, 2013 10:00 PM
Subject: Re: I need help!!!! about Landscape Page Format printing
Hi,
Am 22.09.2013 16:46, schrieb cenk dundar:
>
>
> Hi,
>
> I am sending second time, I havent any solution about this subject. I wish you may help me!
Maybe you should give us more input first:
What exactly did you do?
What did you get?
How about a sample pdf?
> My problem is that;
> I see Fixed problem that to print landscape page in 1.8.0 version. But I am trying with new version the problem is same. Is there any example to print landscape pdf page correctly.
BR
Andreas Lehmkühler
Re: I need help!!!! about Landscape Page Format printing
Posted by Andreas Lehmkuehler <an...@lehmi.de>.
Hi,
Am 22.09.2013 16:46, schrieb cenk dundar:
>
>
> Hi,
>
> I am sending second time, I havent any solution about this subject. I wish you may help me!
Maybe you should give us more input first:
What exactly did you do?
What did you get?
How about a sample pdf?
> My problem is that;
> I see Fixed problem that to print landscape page in 1.8.0 version. But I am trying with new version the problem is same. Is there any example to print landscape pdf page correctly.
BR
Andreas Lehmkühler