Set paper margins size when printing ...

Hi,
I'm using the following code to print an image from a component :
     Settings pageSettings = new Settings();
     pageSettings.setXScaleAsFloat( 0.28f );
     pageSettings.setYScaleAsFloat( 0.28f );
     PagePrintable printable = new PagePrintable( pages[pagActual], pageSettings, false );
     PrinterJob printerJob = PrinterJob.getPrinterJob();
     PageFormat format = printerJob.defaultPage();
//     printerJob.pageDialog( format );
     format.setOrientation(PageFormat.LANDSCAPE);
     printerJob.setPrintable(printable, format);
     printerJob.print();
How can I define the paper margins ?
At this moment I have to use default one inch margins.
Thanks,
Alexandre Gil

You can render on your page in any place you like. In your paint method just use the Graphics.translate() method to set the upper and left margin and then use Graphics2D.transform() and a scaled AffineTransform to adjust the width and height of everything:
public int print(Graphics g, PageFormat format, int pageIndex) {
    Graphics2D g2d = (Graphics2D) g;
    g2d.translate(format.getImageableX(), format.getImageableY());
    AffineTransform at = new AffineTransform();
    at.scale(format.getImageableWidth()//*the width of your stuff*/, format.getImageableHeight()//*the height of your stuff*/);
    g2d.transform(at);
    // all your rendering goes here
}Of course you can use values other than format.getImageable* for the values.
Jeff

Similar Messages

  • Change paper size when printing

    How to change paper size when printing pdf? No option for paper size appear.

    That is a feature of AirPrint. If you do a Google search on "AirPrint paper size" you'll find documentation from major printer manufacturers. For example, this is copied from some HP documentation:
    What paper and media sizes are supported? 
    With AirPrint, paper and photo media sizes are automatically selected depending on the application you are using on your Apple device, your HP ePrint printer, and the region in which you are using AirPrint. You do not have the option to select different paper sizes.
    For example, from Apple’s Photo application, if the HP ePrint printer has a separate photo paper tray, AirPrint uses 4 x 6 inch photo media as the default paper size. If the printer does not have a separate photo paper tray, AirPrint uses letter-size paper. If you are printing from Apple’s Safaribrowser, letter-size paper is the default paper size in the US region, and A4 is the default paper size in Europe.
    AirPrint supports the following paper and media sizes:
    Letter
    Legal
    A4
    4 x 6 in photo paper
    A6 photo paper

  • How to set text size when printi from a web page

    can't increase text size when printing a web page

    If you're using IE, click on View, Text Size and then whatever size you'd like.  You'll see the changes on the screen and it should print out the same way.
    Hope that helps.
    Say Thanks by clicking the Kudos thumbs up. Please mark the post that solves your problem as an Accepted Solution so other forum users can utilize the solution.
    I am an HP employee.

  • Lightroom 2.5 Image Size When Printing

    I have searched and tried several approaches, but cannot get LR to adjust an image size correctly when printing. 
    For example, I have a Lab Test Page tif image that has a document size of 23" W x 29" H and a resolution of 180 ppi.
    I can use CSR 4 Image/Image Size to change this to 8" W x 10.5" H and a resolution of 320 ppi using resampling. The reduced image prints correctly in CSR 4 on 8.5" x 11" paper and results in .25" margins top and bottom. The same thing happens in LR 2.5 with the size reduced image.
    However, if I try to print the original image using LR 2.5 to automatically resize the image it does not work correctly. I have tried all sorts of combinations of settings to get it to reduce the image (as is done in CSR 4) and print with .25" top/bottom margins without success. The image fails to resize correctly.
    Is this a bug, a feature??, or operator error? Can anyone tell how to make LR 2.5 automatically resize so it prints correctly? I have tested this on other computers with the same results.
    Thanks
     

    Go to print module.
    Select Print to jpg.
    Set the resolution at 180 ppi.
    Other output settings, sharpening, paper profile as required.
    Set the margin sizes as required.
    Set the cell size to the size of the image
    Set the Custom File Dimensions to the size of the paper...29" x 23" in this case.
    You can drag the Cell size and the various borders around until you get exactly the lay out on paper you require. Then when finished hit print to file, name the file and the job is done.
    If you want to print a a different size, with a different resolution, on different sized paper, with different borders all this can be done in the print module and it is WYSIWYG so no guess work (or calculations) involved. Using LR rather than PS for this also has the advantage of using much better algorithms for upsizing images than PS and applying output sharpening for the specific media type you intend to print to, all using the RAW data

  • Print size does not default to form size when printing PDF form.

    So, we have created an interactive new client form for our firm. The form was created in LiveCycle Designer ES 8.2 and is set to legal size (8.5 x 14). After the form was completed and exported, it was filled out for testing and printed. During the printing process it was noticed that in the print dialog box, the dimentions for the form were wrong. It showed that the default document size was 8.5 x 11. Where and how is this changed in LC?
    A new form was created (starting from scratch) with the document settings set to legal again, and inside of LC in the PDF preview panel, I tried to print and the same thing occured.
    Please advise as how to set the document to its default size when printing without have to do it in the print dialog box.

    The print dialog doesn't display the forms dimensions but those of the currently selected paper format of your printer.
    If you change the page format in the printer driver the diemensions in the preview will change too.

  • CS5 & Manage Custom Sizes when printing.

    Every time I try to “manage custom sizes” when printing, Photoshop “quits unexpectedly.” I am using Photoshop CS5, and Epson 7800, and Mac Yosemite. I’ve done all the updates, and reinstalled the driver. Any ideas on troubleshooting?

    I am having the exact same problem with an Epson 3880.  I chatted with Epson support earlier today and they suggested that I uninstall the drivers and support software and reinstall.  I followed their instructions and the result was the same.  I did save my image file to a TIFF format and then opened it under Preview and when I used file->print and selected "manage custom sizes" it brought up the custom size menu as expected.  I also attempted this using Photoshop Elements 11 and the "manage custom sizes" menu appeared only in this case when I selected "Cancel" Elements crashed too.
    It is not clear to me how to proceed with kglad's recommendation to "shutdown running processes in a logical manner".  I don't know what a logical manner might be.
    Anyway, I have just done a complete uninstall of Photoshop CS5 and I'm about to reinstall it from the distribution DVD.  I think I'll test the "manage custom sizes" before I install the updates this time.
    I'd sure appreciate it if you come up with anything, that you would post it here.  Thanks
    So, I uninstalled Photoshop 5, restarted my iMac, and reinstalled Photoshop CS5.  When I attempted to Manage Custom Sizes, Photoshop CS5 blew up.
    I find that I can add custom sizes and manage them from Preview and then use them in Photoshop.  So, I guess that will have to suffice until someone comes up with a fix.  Given that Photoshop CS5 is no longer supported that will probably be never.
    Post here if something better comes along.

  • Set custom page size for printing

    I want to set a custom page size for printing some PDF three and four-page musical scores to roll paper on an Epson 1290 using Adobe Reader 9.3.4 on Ubuntu 10.04. The printer properties in the print dialog has a media size option, and one of the choices is "custom", but having chosen "custom", the dialog does not allow me to add the actual page size to the lpr printer command. I can see that when I choose "custom", the lpr command is
    lpr -P Stylus-Photo-1290 -o PageSize=Custom etc
    but what I need for a three page output, for example, is
    lpr -P Stylus-Photo-1290 -o PageSize=Custom.297x630mm etc
    and I can't see how to add the actual custom paper size. If I Ok the media size choice dialog with it just set to PageSize=Custom, I can see from the output preview in the print dialog that the actual page size that has been chosen is letter. The online Adobe doc for Reader 9 printing (http://help.adobe.com/en_US/Reader/9.0/content.html#heading2.3) says "For documents that are larger than the standard page size, go to File  > Page Setup.  Create a custom page size before you print your  document". The problem with that is that there is no "Page Setup" option on the File menu in the Unix version of Adobe Reader, only a "Print" option, which is where I already am.
    If I open the PDFs in Evince, it allows me to add the custom page sizes I want, but as Evince doesn't have the option to print multiple pages per sheet I can't use it either...

    Yes, it used to work, and the resize zoom bar used to work too (now its grayed out). I don't know if this is a "who's to blame for it" thing, but its not getting fixed and its pretty bad that no one seems to care enough even to respond. I found my own solution by opening it in Gimp. Just right click and select open with other ...Gimp and it will import into it. In the Gimp Print dialog, you have a scaling percentage in the "Page Setup" tab, and size settings in the "Image settings" plus loads of other stuff including multiple copies.

  • Margin problem when printing on ipad from pdf app

    On 4500g there is no top margin and very small left margin when printing from pdf printer app on my ipad. Where can i set margins before printing?

    Hello Leonie1938,
    Welcome to the HP Support Forums!
    If I understood correctly, you are printing from an iPad to the Officejet 4500 G510g using a .PDF printer App. If this is correct, what is the App name? I searched and found an App called PDF Printer for iPhone for $2.99, is this the App?
    If you are not using a HP App, all I can offer is to clean the rollers on the printer. This is best done by following steps here: The All-in-One Does Not Pick Up or Feed Paper, Solution four.
    Cheers,
    JERENDS
    I work on behalf of HP
    Please click “Accept as Solution” if you feel my post solved your issue, it will help others find the solution.
    Click the “Kudos Thumbs Up" to the left of the reply button to say “Thanks” for helping!

  • 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.

  • Text Size When Printing Comments Different Than On-Screen

    Hello.  We are supporting an end-user with an unusual problem.  They are able to make sticky comments fine and adjust the font size on screen.  However, when this user goes to print either to a physical printer or a PDF, the font size of the comment is different (smaller) than what is shown on screen.
    On-Screen Example:
    Print To PDF Example:
    Is there an option to match the text size of the printed version to that of the on-screen?  Even if the printed text size can be bumped up just a bit, it'd be greatly appreciated.  The font size when commenting on-screen is 18 Arial but it seems like the printed version is more like 10 Ariel.
    Thank you.

    Just tried the latest version of Adobe Reader and the same issue occurs.  Making the on-screen font size 70 in the Commenting Preferences field makes NO CHANGE when printed (comes out at about 10 / 12 point font).  Even the Print Preview doesn't show the larger font so there's some setting getting lost when you go to print.
    Talking to our client, this problem likely coincides with Adobe updates that were pushed out.  This is easily reproducible (anyone with an up-to-date version of Adobe Reader can do this) but doesn't seem to be a fix.
    Any help out there?

  • Problem with margins shifting when printing.

    I have an installation template on an 11x17 sheet with 3/8” margins. There is a “left” and “right” version on each side (basically mirrored) and the intent is that they align front to back when you hold the sheet up to the light. When we print a proof, two sided, on our laser printer, the drawings match when the single sheet is held up to the light, but the margins are no longer the same; each is offset by a 1/16” in the same direction. BUT when you print one sided on our printer and hold the 2 sheets back to back, the drawings are off by 1/8” because the margins are off by the 1/16' in different directions. This creates a problem when it is sent to the commercial printers as they are printing single sided to their printing plates. (The problem still appears in the exported PDF file the printers use)
    The problem is, I can’t get InDesign to stop shifting the content on the page that 1/16”!
    If I look at the page, the margin guides show the correct 3/8”on both sides.
    If I look at the Master page, the margin guides show the correct 3/8”on both sides.
    Under “Margins and Columns” in InDesign, I found the correct margins set (0.375 - 3/8”) all around,  with 1 column and a 0.1667” Gutter. Ha .. I thought I had found it! So I removed the Gutter and checked “Enabled Layout”, But when printed, same problem.
    I then though it must be on the master pages and found and did the same thing as above, still no luck!
    Then I created a new master page and set it up as above and reapplied the new master page, still no luck!
    I’m stumped!?! If we can’t get these margins correct we can’t send it to the commercial printer.
    Thanks in advance for any help!

    Well I don't know for a fact that it is, but the customer is a major International Fortune 500 Company and this is an Installation sheet printed and included in one of their product packages, so I would imagine it is an offset press.
    Besides, if the commercial printer was using a commercial Laser printer, can't they print 2-sided? There is no problem when it is printed 2-sided, the images align because both margins are offset in the same direction. It is only when it is printed 1-sided (one side to each printing plate) that the problem becomes obvious because the offsets are in the opposite directions. (BTW, it is B&W)

  • Need to enlarge print size when printing

    I have just set up a HP Envy 4500e all in one printer. I am using IE 11 and I have the text size set to maximum. When I print the print is so small I can hardly read it. How can I make the printer print larger text
    This question was solved.
    View Solution.

    Printing size is controlled by the software application that you are using to print.  Check the font size.  This includes your browser.
    Say thanks by clicking the Kudos Thumbs Up to the right in the post.
    If my post resolved your problem, please mark it as an Accepted Solution ...
    I worked for HP but now I'm retired!

  • Photos convert to thumbnail size when printing

    I am trying to print on an EPSON R300. When printing from iPhoto I select the size/layout that I want, but when I go to preview and/or print it doesn't not fill the page. Everything is getting downsized to "thumbnail" size. I've tried everything I can think of, including reinstalling the printing drivers, nothing is working. HELP!!!!

    2Xclone:
    Welcome to the Apple Discussions. Just to be sure we're on the same page here's the workflow I use to get a borderless 4x6:
    Steps for printing 4 x 6 prints from iPhoto:
    <li crop the photo to 4 x 6 beforehand in iPhoto's edit window.</li>
    in Page Setup select your printer, proper page orientation and paper size, i.e. 4x6 or 4x6 borderless
    click once on the picture you want to print to make sure it's selected.
    now click on the Print button in iPhoto.
    in the iPhoto print window, select your printer again, select Style = "Standard Prints", Size= 4x6 and click on One photo per page.
    click on the Print button.
    Is that how you're going about it?
    Do you Twango?
    TIP: For insurance against the iPhoto database corruption that many users have experienced I recommend making a backup copy of the Library6.iPhoto database file and keep it current. If problems crop up where iPhoto suddenly can't see any photos or thinks there are no photos in the library, replacing the working Library6.iPhoto file with the backup will often get the library back. By keeping it current I mean backup after each import and/or any serious editing or work on books, slideshows, calendars, cards, etc. That insures that if a problem pops up and you do need to replace the database file, you'll retain all those efforts. It doesn't take long to make the backup and it's good insurance.
    I've written an Automator workflow application, iPhoto dB file backup, that will copy the selected Library6.iPhoto file from your iPhoto Library folder to the Pictures folder, replacing any previous version of it. You can download it at Toad's Cellar. Be sure to read the Read Me pdf file.

  • MX 922 - "no paper" (but full) when printing from SOME applications

    I CAN print from my ipad "notes" application. I CANNOT print from a web page or my photos. The MX 922 says it is out of paper - BUT IT ISN'T. I don't get this error when printing from my ipad "notes" ap. I am frustrated and about to take it back to Costco.

    Hi djh,
    Please place paper in the upper cassette, making sure that the small size photo paper such as 4" x 6" (10 x 15 cm) or 5" x 7" (13 x 18 cm), or Hagaki are loaded.
    Please note that if you cut plain paper into small size such as 4" x 6" (10 x 15 cm) or 5" x 7" (13 x 18 cm) and try to print on it, the paper jam will occur.
    Once the paper is in place, align the paper guides with the both edges of the paper and the press the OK button.
    Please attempt to print.
    If you continue to have difficulties, please contact our support group using the following link:
    http://www.usa.canon.com/cusa/consumer/standard_display/contact_us_consumer
    Did this answer your question? Please click the Accept as Solution button so that others may find the answer as well.

  • Can't select "Plain Paper" or "Automatic" when Printing in iPhoto

    When attempting to print a picture to plain paper in iPhoto 6, the program will not let me select "Plain Paper" or "Automatic" in the "Paper Type" drop down.
    See if you can duplicate the problem on your Mac this way:
    1) select a picture within your iPhoto library
    2) File > Print
    3) Choose Advanced, then in the third drop down menu, choose "Paper Type/Quality"
    4) Within the "Paper" tab, drop down the menu called "Paper Type"
    5) Can you select "Plain Paper" and/or "Automatic"?
    Perhaps this is Apple's way of saying they don't want us to print on anything but picture quality paper?? I hope not. I just want to print out some lined paper for my first grader to practice on.
    Thanks,
    STEVE

    The default setting for me appears to be plain paper. iPhoto won't let me choose 'photo quality' and when printing photos on the default setting on photo paper dark areas appear blotchy and the colours are too harsh. I'm using a HP 1205 all-in-one printer/scanner/copier, and the HP people seem baffled by this. The same printer, when connected to my former iBook computer, allowed me to choose different paper types.

Maybe you are looking for

  • Report for All PO by All User

    Please advise where in SAP can I go in to run a report of all purchase orders placed by all users exept EKKO Table. Please note that I need to see a report and say I dont have access to open EKKO Table. Kindly Reply ASAP. Thanks Rajendra

  • Getting Skype working on my Mac mini

    I have an old-ish Mac Mini (can't remember how old, but a couple of years - 'About this Mac' says 'PowerMac 10.2), which I now would like to set up to use Skype. I have regular speakers plugged into the headphone port, but I can't figure any way to p

  • Help! Down-converting 720p HD to DVD

    Just finished a project using FCP 5 and Motion 2 in 720p60 HD. I did not use any HD video but built the whole project out of high resolution stills with pans and zooms with basic text moving over the top. Since this is going to be a promotional piece

  • How do I call a function from another file?

    In MainView.m I have one function -(void)goTell; I want to be able to call the function from SecondView.m. How do I do this? I have declared the function in the MainView.h and added #include MainView.h to SecondView.m, but it still doesn't work. This

  • Version Name to File Name

    I have been able to maintain the info that I want in "Version Name", and would now like to move that to the "File Name" field. I have not been able to find a technique in Aperture to make this change. I could export, then import with the new file nam