pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tilman Hausherr <THaush...@t-online.de>
Subject Re: PDFBox Alignment for Existing PDF
Date Sun, 09 Nov 2014 12:05:32 GMT
Hi,

To be sure that it is really a printing problem (which I doubt), please 
try to view the page with the command line application:

https://pdfbox.apache.org/commandline/#pdfReader

https://pdfbox.apache.org/downloads.html

Does it display the way you expect it?

Tilman

Am 09.11.2014 um 09:12 schrieb Imran Akbar:
> Hi all,
>
> I am trying to load a pdf from URL/FIle and do a silent print by choosing
> the default printer. it prints but the printed output is having issues in
> the alignment, if documents contains Footers, they are getting stripped off
> and not getting printed. is there a way to set the printing properties
> before we print the document when loading an existing document. Please find
> my below code,
>
> ******
>
> public class PrintPdf {
>
>      public static PrintService choosePrinter() {
>          PrinterJob printJob = PrinterJob.getPrinterJob();
>          if (printJob.printDialog()) {
>              return printJob.getPrintService();
>          } else {
>              return null;
>          }
>      }
>
>      public static void printPDF(String fileName, PrintService printer)
>              throws IOException, PrinterException {
>          PrinterJob job = PrinterJob.getPrinterJob();
>          job.setPrintService(printer);
>
>          PDDocument doc = PDDocument.load(fileName);
>
>          doc.silentPrint(job);
>      }
>
>      public static void main(String[] args) throws IOException,
> PrinterException {
>
>          printPDF("http://localhost/IS1330900025_3705.pdf", choosePrinter());
>      }
>
> }
>
> ****
>
> - Imran
>


Mime
View raw message