Please start a new thread for off-topic questions. -- John
> On 26 Jan 2015, at 19:26, Thamizh Thomas <[email protected]> wrote: > > Hi All, > > I have a requirement to read tamil pdf document and store the content in > db. When I read the document using Pdfbox, the characters are junked and > not readable. I suppose this problem to be with fonts used. Can you help me > to resolve this? > > Below is my code: > > PDFTextStripper pdfTextStripper = new PDFTextStripper(); > String page = ""; > for (int i = pageNo; i <= pages.size(); i++) { > pdfTextStripper.setStartPage(i); > pdfTextStripper.setEndPage(i); > > pdfTextStripper.setFonts(pages.get(i).getResources().getFonts()); > page += pdfTextStripper.getText(document); > } > > Awaiting for your reply. > > On Tue, Jan 27, 2015 at 4:12 AM, John Hewson <[email protected] > <mailto:[email protected]>> wrote: > >> Hi, >> >>> PageFormat pf = job.defaultPage(); >> >> PrinterJob#defaultPage() creates a new page, it can’t be used to modify >> the default, see: >> >> http://docs.oracle.com/javase/6/docs/api/java/awt/print/PrinterJob.html#defaultPage() >> >> <http://docs.oracle.com/javase/6/docs/api/java/awt/print/PrinterJob.html#defaultPage()> >> < >> http://docs.oracle.com/javase/6/docs/api/java/awt/print/PrinterJob.html#defaultPage() >> >> <http://docs.oracle.com/javase/6/docs/api/java/awt/print/PrinterJob.html#defaultPage()> >>> >> >> The PageFormat which will be used for the job is controlled by the >> Pageable instance, >> i.e, this line: >> >>> job.setPageable(printer.getPageable()); >> >> >> That’s a PDFPageable instance, which PDFPrinter creates for you. To >> specify a custom >> Paper, you need to pass it to PDFPrinter , we provide a constructor which >> you can use: >> >> PDFPrinter(PDDocument, Scaling, Orientation, Paper) >> >> Call this with Scaling.SHRINK_TO_FIT and Orientation.AUTO. >> >> -- John >> >>> On 26 Jan 2015, at 13:31, Josh Nankin <[email protected]> wrote: >>> >>> When I print a PDF using the below code, the PDF appears smaller in the >>> result than the original file. How do I solve this? >>> >>> Input: http://joshnankin.com/input.pdf >>> What prints: http://joshnankin.com/whatPrints.pdf >>> >>> >>> Code: >>> >>> PDFPrinter printer = new PDFPrinter(PDDocument.load(new >>> File("input.pdf"))); >>> >>> PrinterJob job = PrinterJob.getPrinterJob(); >>> PageFormat pf = job.defaultPage(); >>> Paper paper = new Paper(); >>> paper.setSize(612, 792); >>> double margin = 0; >>> paper.setImageableArea(margin, margin, paper.getWidth() - margin, >>> paper.getHeight() - margin); >>> >>> pf.setPaper(paper); >>> job.setPageable(printer.getPageable()); >>> job.setJobName("test"); >>> job.printDialog(); >>> try { >>> job.print(); >>> } catch (PrinterException e) { >>> System.out.println(e); >>> } >> >> > > > -- > ----- > > *Thanks* > > * Thamizh Thomas A* > * SemTech* > * Bosco ITS*

