pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Imran Akbar <imranakba...@gmail.com>
Subject Re: PDFBox Alignment for Existing PDF
Date Thu, 20 Nov 2014 16:00:40 GMT
Hi John,

The new code had a huge impact on the alignment, previously the Footer was
not displaying after implementing it with pdfbox 2.0 the Header and footers
text are not getting displayed.

I tried with the below code, still the results are same.

   PDFPrinter pdf = new PDFPrinter(this.document, Scaling.ACTUAL_SIZE,
Orientation.AUTO);

One more thing i noticed, am loading the component as an applet i see the
behavior is different on each machine, in some machines i see all the
details gets printed but shrinked. and in some it stretches removing the
headers and footers.

~Imran

On Thu, Nov 13, 2014 at 9:28 AM, John Hewson <john@jahewson.com> wrote:

> Yes, we could do with an example, there are multiple ways in which you can
> use PDFPrinter, it’s pretty flexible. For now here’s some code for simple
> usage:
>
> PDFPrinter printer = new PDFPrinter(document);
> PrinterJob job = PrinterJob.getPrinterJob();
> printer.silentPrint(job);
>
> -- John
>
> > On 11 Nov 2014, at 21:49, Imran Akbar <imranakbarin@gmail.com> wrote:
> >
> > John,
> >
> > it would be great if you could provide an example implementing it.
> >
> > Thanks,
> > Imran
> >
> > On Tue, Nov 11, 2014 at 9:15 PM, John Hewson <john@jahewson.com> wrote:
> >
> >> Sorry, I should have mentioned, we moved this functionality to the
> >> PDFPrinter class in 2.0.
> >>
> >> -- John
> >>
> >>> On 11 Nov 2014, at 08:13, Imran Akbar <imranakbarin@gmail.com> wrote:
> >>>
> >>> Tilman,
> >>>
> >>> I tried viewing the pdf from commandline the pdf displayed correctly.
> >>>
> >>> John,
> >>>
> >>> I downloaded 2.0 from the link [
> >>>
> >>
> http://repository.apache.org/content/groups/snapshots/org/apache/pdfbox/pdfbox-app/2.0.0-SNAPSHOT/
> >> ]
> >>> but i couldnt find the silentprint method available :(
> >>>
> >>>
> >>> Thanks,
> >>> Imran
> >>>
> >>>
> >>>
> >>> On Sun, Nov 9, 2014 at 8:11 PM, John Hewson <john@jahewson.com> wrote:
> >>>
> >>>> Printing in 1.8 has a number of bugs and limitations which have been
> >> fixed
> >>>> in the 2.0 trunk on SVN, so you might want to try that.
> >>>>
> >>>> -- John
> >>>>
> >>>>> On 9 Nov 2014, at 00:12, Imran Akbar <imranakbarin@gmail.com>
wrote:
> >>>>>
> >>>>> 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
> >>>>
> >>>
> >>>
> >>>
> >>> --
> >>> -- Imran Akbar
> >>
> >>
> >
> >
> > --
> >  -- Imran Akbar
>
>


-- 
  -- Imran Akbar

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message