Printing a PDF page in A4 size resizes to A5

Hi,
I am trying to print a PDF file, which somehow succeeds; However the printed page shows the PDF in A5 format. the same pdf printed with acroread32 shows in expected A4 size. Can anyone imagine why? Here is the code:
private void printPdf(File file) throws Exception {
        // set up the PDF reading
        RandomAccessFile raf = new RandomAccessFile(file, "r");
        FileChannel channel = raf.getChannel();
        ByteBuffer buf = channel.map(FileChannel.MapMode.READ_ONLY, 0, channel.size());
        PDFFile pdfFile = new PDFFile(buf); // Create PDF Print Page
        // Create Print Job
        PrinterJob pjob = PrinterJob.getPrinterJob();
        PageFormat pf = PrinterJob.getPrinterJob().defaultPage();
        Book book = new Book();
        PDFPrintPage pages = new PDFPrintPage(pdfFile);
        book.append(pages, pf, pdfFile.getNumPages());
        pjob.setPageable(book);
        // Set print attributes:
        PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
        aset.add(MediaSizeName.ISO_A4);
        try {
            // Send print job to printer
            if (pjob.printDialog(aset)) {
                pjob.print(aset);
                Log.Debug(PrintJob2.class, "Document '" + file + "' printed.");
        } catch (Exception e) {
            throw e;
        } finally {
            raf.close();
    }My guess is that it has to do with PageFormat, but i don't know how to change that?
Best wishes,
Andreas

Hi,
Fixed by setting the paper size manually:
Paper paper = new Paper();
        paper.setSize(594.936, 841.536);
        paper.setImageableArea(0, 0, 594.936, 841.536);
        pf.setPaper(paper);However odd imho

Similar Messages

  • How can I print a pdf in the actual size with a page border?

    How can I print a pdf in the actual size with a page border? (2 pages per sheet preferred)
    I usually print pdfs of books at a copy shop and they turn out fine.
    The problem comes when I try to print the same books at home.
    I use Adobe Acrobat X with the same settings: "multiple pages per sheet" (2x1) and page border. But the pages are slightly shrunken when printed. I think this is because my printer can't print as closely to the margins. Still, two pages should be able to fit on one sheet in actual size. Are there any layout settings that I can play with to find a better fit, besides portrait and landscape?
    If I select page scaling "none," I'm able to print the pdf in actual size, one page per sheet. But there's no option to add a page border.

    I have a test with some questions (multiple choice, FIB, matching, etc). I have just one button to submit all the answers, and after submiting the student can see his score and review the test to know where he failed. He can't answer again. However, he can change the answer multiple times before submiting.
    "if i turn on success/failure captions the student will see them while answering" - before submitting
    "if i turn them off he wont know what's the right answer" - after submitting
    My results page is the default. I didn't use any variable. When i go to the results page after reviewing the test all the entry boxes are "wrong".

  • I print 2 pages to pdf and file size is 600k, I print 1 additonal page and file size goes to 6M, what would cause this (graphics are same on all pages)

    I print 2 pages to pdf and file size is 600k, I print 1 additonal page and file size goes to 6M, what would cause this (graphics are same on all pages).
    I know the colour graphic shading in the document that causes the issue of larger file size, but it doesn't make sense that printing 1 additional page with same information as first 2 pages would cause this.

    I print 2 pages to pdf and file size is 600k, I print 1 additonal page and file size goes to 6M, what would cause this (graphics are same on all pages).
    I know the colour graphic shading in the document that causes the issue of larger file size, but it doesn't make sense that printing 1 additional page with same information as first 2 pages would cause this.

  • Cant print single PDF pages

    Trying to print single PDF pages, forced to print all pages sent via email.
    Dialog box has greyed out page selection portion.
    Samsung Galaxy S4.  
    HP App loaded from Google Play.
    HP 4500 Envy.
    Thank you
    Thurston

    Hi Thurstonthe3rd,
    When sending an email, the eprint server will consider the full document as the print job and will print all the pages of the document. This is expected behavior.
    If you want to print selected pages from your pdf first save that page as a seperate pdf and then emailthe saved pdf to the printers email ID to print.
    Regards,
    Oliver
    "Although I work for HP, I'm speaking for myself and not on behalf of HP"--Please mark the post that solves your problem as "Accepted Solution"
    "Say "Thanks" by clicking the Kudos Star in the post that helped you.

  • Margins problem when printing to PDF (Pages '09 v4.0.3 build 766)

    Hi,
    I don't know if this is connected to the latest Mac OS X v10.6.4 update, but some of my machines exhibit a very curious behaviour.
    + multiple pages A4 document
    + choose File > Print, click on "Save as PDF", under the PDF button
    ++ set pages 6 & 7 to print
    ++ set 2 pages per spread, so as to have Pages shrink the A4 document to somewhat A5, and have the two pages side-by-side on the same sheet
    ++ save the PDF
    Then, when I open the PDF with Preview, the margins are all wrong (i.e. too big, there's too much white running around).
    And from Preview's inspector, I can tell that the Page Size is set to US Letter, although in Pages both the document size AND the Printing Format are set to A4.
    The most curious part of the story is that my MacPro, my work MacBook Pro 13 and a white MacBook exhibit the problem, whereas my personal iMac 27" DOES NOT.
    And they are all running Mac OS X v10.6.4, with ALL the most recent updates, and the exact same version of Pages!!!
    I suspect that something has been changed in a framework somewhere, but I cannot figure out what it is...
    Any idea is welcome!
    Thanks,
    K2r

    I can do the same in TextEdit (although it's even more painful to control the margins!!).
    My problem is not that Pages won't put pages on one sheet; It's that the generated PDF does not respect the sheet physical size (A4 vs. US Letter), thus adding wider margins all around the document.

  • Word document won't 'print' to PDF on proper paper size

    I have a document in MS Word that's on a 5.5x8.5 page size. If I do a Save As, the resulting PDF uses the proper paper size, but it also shows color--which I don't want for this particular document.
    When I do Print and choose Adobe PDF, I can choose Black/white which is great, but I'm struggling to get it to use the right paper size. I've tried ever combination I can think of in the Default Setting and Adobe PDF Page Size options, but can't get it to show anything but 8.5x11.
    Any thoughts on how to get the right paper size using Print to PDF?

    Is this a Word document generated by Adobe's RoboHelp product or just a document generated directly in Word?
    If the latter, you are asking in the wrong place. Even if you are using RoboHelp, this looks more like a question to ask in the Acrobat forums.
    http://forums.adobe.com/community/acrobat
    See www.grainge.org for RoboHelp and Authoring tips
    @petergrainge

  • Print multiple pdf pages to one sheet of paper

    I want to print a 70 page pdf file but don't want 70 pages.
    I want 4 of the pdf pages on one sheet of paper, and I would really like to double side.
    This is what I'm working with (and not having any success in getting what I want)
    Help?
    Printer: HP Officejet 6500A Plus all in one
    PDF version 4.0.65
    Windows 7
    This question was solved.
    View Solution.

    Hi,
    That can be done easily using the Booklet feature of the printer driver.
    Open the PDF in Adobe Reader, then clcik on File > Print.
    Click the Properties button.
    Within the Layout tab check the radio option next to Booklet, you may keep the draw borders box checked or uncheck it as you prefer.
    Regards,
    Shlomi
    Say thanks by clicking the Kudos thumb up in the post.
    If my post resolve your problem please mark it as an Accepted Solution

  • Adobe Reader-Printing 2 PDF Pages On One

    Hi - I am using Adobe Reader version 9 in Windows Vista. I am trying to combine two pdf pages into one page via a pdf printer. The pages are small enough that two can fit on one page. I can get two onto one page but each of the pages is smaller than I want them to be. Is there any way to make the output larger? I would like each of the pages to print larger and there to be less white space. Thanks!

    You can not do those tasks with Reader. Reader is a view program only, though some filling of forms and such is possible. To edit a PDF, you have to purchase Acrobat.
    If I have misunderstood your question it may be that I use Acrobat and not Reader. In that case, ask your question in the Reader forum (link at the top of this forum).

  • FF hangs when printing a PDF page

    CRTL P brings up print options- printer Can0n iP1800. When OK is selected Progress Box shows "Printing MisCommands.PDF" and hangs at 0%complete. Must select "X" out FF which brings up the Program Not Responding box
    https://docs.google.com/a/scc-ems.us/MiscCommands?command=save_print_settings&docID=0AddSHXnoIKORZGd3bnZ2cnBfNTNkNXc1OTV4aA&print=1

    Thanks for checking.  It is clearly something about my system that is
    causing the hang.  In the cases I ran it stopped on photo 11 of about 30
    and that was repeatable.  Using another set of photos it stopped on
    something like 16 of 30 or so photos. That was also repeatable.
    It clearly is a problem on my configuration.
    I have uninstalled 64 bit Lightroom and installed 32 bit LR 2.7 as I had
    done with LR 2.6.
    Let me know if you could use more information.
    Thanks,
    Gary

  • Printing a PDF larger (twice normal size)

    Hello all,
    I have a PDF I wanna print out. When I print it it's 1 pg long.
    I want to double its size & print it over 2 pages.
    I have tried the following:
    in PREVIEW.app--increasing Page Setup print size to 200%. This just centers the PDF and leaves off the top & bottom of the PDF.
    in GraphicConverter--same thing. Same results. (If I convert to JPG it gets jaggy (due to anti-aliasing) and preints out looking like cr*p)
    Any other ideas?
    Thanks,
    John Boyarsky
    7th & 8th Grade Math & Yearbook Guy
    Randy Smith Middle School
    (I seem to be good at these questions no one can answer... I've got 3 unresolved ones with no good answers for any of them...)

    As usual, it's a problem no one else has. (Story of my life on Computer troubles-- makes me a great Beta Tester!)
    Never figgered this out before updating to Leopard, which works.
    Thanks
    John

  • When I print a web page, the font size is always the default (which is good for screen reading, but too big for printing), even when I use Text Zoom to make it smaller.

    How can I change the font size when printing web pages?

    When you zoom in, it is like using a magnifying glass - the underlying image remains unchanged, as you have found out.
    You may be able to enlarge the bird to some extent without distortion and without pixilation by resampling.
    Go image menu>resize>image size. Be sure that "constrain proportions " is checked in the dialog.
    More on this from the help menu:
    Photoshop Elements Help | Resizing
    If you google  this topic, you will get many hits.

  • Is it possible to print a pdf page displayed in browser?

    I have a servlet that will send a pdf file to the browser (IE), (i set the content type to "applicaction/pdf"). Now I need a way to create a print button to allow user that option, seems the browser print button is not satisfactory. Can a pdf be embedded in a web page somehow? Sounds like I would be dealing with 2 different reponse types "application/pdf" and "text/html"..I think the print button would call a method doing some extra things other than what the browser print button does. Is this possible? Thank you

    Can you post me example how to displaying pdf in browser?
    Thankss..

  • How do I print multiple (PDF) pages per sheet in Lion?

    The printing interface has changed in preview, and whereas there used to be an option to print multiple pages per sheet, there's now only an option to print multiple copies per sheet. The latter is of no use to me, whereas printing multiple pages per sheet was very useful since I often print large documents.

    Well, in Snow Leopard I used to print PDFs from Preview, and if I recall correctly, where it now says 'copies per page', it used to say 'images per page'. So of course, I now have a couple of printouts with two copies of each page per sheet.
    But the preview tab and then the option 'layout' works. I don't understand why this interface had to change though.
    Message was edited by: Sebastian0883

  • Unable to Print a .pdf less than 100% size

    I used to be able to print out the address book at 75% or 80% to make a smaller booklet.  Now it prints at 100% no matter what percent is entered.

    Thanks.  That used to work on my Intel Mini.  I have OSX 10.6.8 on a MacBook and on an Intel Mini.  Both ignore any percentage I enter.  It just prints full size 8x10 pages.  Maybe there's something in Preferences somewhere, but I can't find it.  Or maybe a newer OSX update messed it up.

  • How do I print a PDF file to poster size on Mac

    Hi,
    Is there a way to print (on a Mac computer) a PDF file that is in Acrobat Reader to tile it to print in several sheets.  (This would be like printing to a PC, using the Poster setting.) The original file is a single sheet that needs to be enlarged to 4 sheets by 4 sheets to make a large poster that will be pieced together.  I do not know what type of Mac computer our customer is using. 
    Thanks

    Not with Reader no. You would need the full version of Acrobat.
    Have they looked to see if Mac Preview can do it?

Maybe you are looking for

  • Pages can´t open files saved in iCloud

    I can´t open any file save to iCloud I tried a workaraound: I couldn´t open a file save to iCloud from my iPad. I opened it from icloud.com and downloaded it to my iMac. Opened the downloaded file, and everything semed ok. I then closed the dokument

  • Help in SQL required

    Please find the below query I am getting Revenue and cost I have to calculate GP and GP% Details Value Revenue 100 Cost 50 Gross Profit (Revenue-Cost) Gross Profit % ((Revenue-Cost)/Revenue)*100 -- query for GM details drill down page (at service lin

  • OAM11g R2 Internet Identity Services Integration with Facebook fails

    Hi, I have configured OAM11g R2 to use Facebook as an Internet Identity Provider by following the steps mentioned in the link : http://docs.oracle.com/cd/E27559_01/admin.1112/e27239/oicconfiginetidentitysrvcs.htm#BEIDCHAJ Below are the quick steps I

  • Transaction to see result of inbound idoc ( XI to SAP R3) ?

    Hi, may i know the transaction to  see whether the inbound idoc has created the record ? i'm sending idoc from XI to ECC. Farah

  • Student and Teacher Edition für Berufsschüler?

    Guten Abend, wie aus meinem Titel würde ich gerne wissen ob ich auch als Berufsschüler bezugsberechtigt bin zum Kauf der Student and Teacher Edition. Ich hoffe es hat jemand bereits Erfahrung mit dem Thema sammeln können. Vielen Dank Malte