Problem with PageFormat when printing
Hi.
I use the following class to print large JPanels, but I have a problem with the PageFormat. For example:
I want to print a JPanel called labelPanel, so I write "PrintUtilities.printComponent(labelPanel);". It will now print this Panel on multible Pages, so I can put them together to see the whole Panel. This works fine, BUT I can't change the PageFormat. When the printDialog pops up I can choose a printer (this works), but if I change the page format (for example from "letter" to a bigger size) the PageFormat object stays the same as always, some kind of defaultFormat I think.
pf.getImageableWidth() always has the same value and I dunno why that doesn't work. Everything works, except changing the format of the page...
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.print.PageFormat;
import java.awt.print.Printable;
import java.awt.print.PrinterException;
import java.awt.print.PrinterJob;
import javax.swing.RepaintManager;
public class PrintUtilities implements Printable {
private Component componentToBePrinted;
public static void printComponent(Component _c) {
new PrintUtilities(_c).print();
public PrintUtilities(Component _componentToBePrinted) {
componentToBePrinted = _componentToBePrinted;
public void print() {
PrinterJob printJob = PrinterJob.getPrinterJob();
printJob.setPrintable(this);
if (printJob.printDialog())
try {
printJob.print();
catch(PrinterException pe)
System.out.println("Error printing: " + pe);
public int print(Graphics g, PageFormat pf, int pageIndex) {
int response = NO_SUCH_PAGE;
Graphics2D g2 = (Graphics2D) g;
disableDoubleBuffering(componentToBePrinted);
Dimension d = componentToBePrinted.getSize();
double panelWidth = d.width;
double panelHeight = d.height;
double pageHeight = pf.getImageableHeight();
double pageWidth = pf.getImageableWidth();
int linePages = (int)Math.ceil(panelWidth / pageWidth);
int rowPages = (int)Math.ceil(panelHeight / pageHeight);
int totalNumPages = linePages * rowPages;
if (pageIndex >= totalNumPages) {
response = NO_SUCH_PAGE;
} else {
g2.translate(pf.getImageableX(), pf.getImageableY());
g2.translate(-(pageIndex % linePages) * pageWidth, -((pageIndex / linePages) % rowPages) * pageHeight);
componentToBePrinted.paint(g2);
enableDoubleBuffering(componentToBePrinted);
response = Printable.PAGE_EXISTS;
return response;
public static void disableDoubleBuffering(Component c) {
RepaintManager currentManager = RepaintManager.currentManager(c);
currentManager.setDoubleBufferingEnabled(false);
public static void enableDoubleBuffering(Component c) {
RepaintManager currentManager = RepaintManager.currentManager(c);
currentManager.setDoubleBufferingEnabled(true);
}
Does no one know a solution? Oo
Similar Messages
-
Problem with colors when print to pdf in FM9
Hi,
we have some problems with printing colors to pdf with FM9.
The FM document contains (1) eps file with a green box and (2) a rectangle created with FM graphic tools, filled with the same green color values (91/0/60/44)
In FrameMaker the two colors really looks different, but so what, in the PDF both colors (eps) and rectangle got the same correct green color.
Ok, the were different in creation, so they were CMYK and RGB, but your print shop could manage that.
Now in FM 9:
(1) If I do a "save as PDF" and switch OFF "convert CMYK to RGB" the resulting PDF is the same as from FM8 (correct)
(2) If I print to PDF via distiller and define the job options to "convert all colors to CMYK" the resulting rectangle green is very different from the eps green.
I tried different job options, the best result was "convert all colors to CMYK", other options just very more ugly.
Does someone of you know a solution for your problem? Help is very appreciated. I could send example files if necessary.
Thanks in advance.
PKPK-ulm wrote:
But we want to use the print option, using the distiller.
Pia,
this last sentence needs some explanation, I think. Why do you want to use the print option?
Using the print option, you still go the same route as FrameMaker Win always did, which is using the RGB-only Windows postscript driver. Now, with FM9, you have the option to get CMYK colors directly to PDF, as defined, without any color conversion. And it *does* work, as long as you restrict your documents to either CMYK colors or spot colors coming from the FM libraries.
So, again: why do you want to use the print option?
On a sidenote: I'm not sure if I interpret your username correctly, but if you are able to understand German, you'll find some in-depth color tests made with FM9 here: http://www.hilfdirselbst.ch/foren/FM_9_und_Farben_in_PDFs____getestet_P387800.html
Bernd -
Problems with alignment when printing a mail merge envelope in Word 2013
I am using Mail Merge in Word 2013 to print approximately 100 envelopes, size #10 landscape (9.5" x 4.12"), with a return and recipient address. But when it goes to print, the alignment is completely wrong: it prints the recipient address
at the "top" of the envelope, and the return address is completely cut off. I have everything set up correctly in the document file and can preview each one of my envelopes. Everything looks great on the screen, but the envelopes will
not print correctly.
I have verified Word's printer feed method (by going to Envelopes > Feed > Printing Options) so that it matches how the blank envelopes are sitting in my printer tray. I have verified in both Word and on my printer setup that the #10 envelope
is the correct paper shape/size. I have verified the document's orientation (landscape) and the margins. However, the envelopes still do not print in alignment with how they appear on the screen. I've tried changing the printer feed method
and the position of the envelope, but it prints the same way every time -- regardless of which feed direction I choose in Word. The recipient address is always too high up on the envelope, and the return address is completely cut off.
On a hunch, I inserted a plain sheet of 8.5" x 11" paper and printed the "envelope" on that. Sure enough, Word prints the document as if the envelope were glued to the upper right corner of the sheet of paper. (As in, if I
attached the #10 envelope to the upper right corner of the sheet of paper, all of the fields would be correctly aligned.)
How do I fix this and get the envelopes to print correctly? Please remember that I have tried changing the printer feed method (the direction the envelopes go into the printer) on Word, which has no effect on how the document ends up printing.
Thank you for your help!Hi,
We would suggest that you do any of the following:
Update your printer driver.
Go back to the
Printing Options
tab of the Envelope Options
dialog box, and make adjustments to the printing options. Print the envelope again. Repeat this process until you discover a configuration of printing options that yields the results that you want.
You may also follow this article steps to Create and print a single envelope test if it works:
http://office.microsoft.com/en-us/word-help/create-and-print-a-single-envelope-HA102145290.aspx#BM2
Best regards,
Karen Hu -
having a problem with dates when I send my numbers doc to excel. dates are all out and that they have to cut and paste individual entries onto their spreadsheet. Any idea how I can prevent this.
I'm using Lion on an MBP and Numbers is the latest versionMay you give more details about what is wrong with your dates ?
M…oSoft products aren't allowed on my machines but I use LibreOffice which is a clone of Office.
When I export from Numbers to Excel and open the result with LibreOffice, the dates are correctly treated.
To be precise, dates after 01/01/1904 are correctly treated. dates before 01/01/1904 are exported as strings but, as it's flagged during the export process, it's not surprising.
Yvan KOENIG (VALLAURIS, France) mardi 3 janvier 2012
iMac 21”5, i7, 2.8 GHz, 12 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.2
My iDisk is : http://public.me.com/koenigyvan
Please : Search for questions similar to your own before submitting them to the community
For iWork's applications dedicated to iOS, go to :
https://discussions.apple.com/community/app_store/iwork_for_ios -
Problems with your HP printer after upgrading to Windows 8.1
If you are experiencing problems with your HP printer after upgrading to Windows 8.1 please click on the below link and install the HP Print and Scan Doctor and run the utility to fix the issue.
www.hp.com/go/tools.
I was an HP employee
If I have helped you solve your issue please mark it as solved
**Say Thanks By Clicking on the Kudos Star**Hi.....my laserjet 1536dnf mfp was working perfectly with win 8 pro....then I installed win 8.1 pro and now the computer ,which is part of a network,can not communicate with the scanner of the printer--it prints just fine. On another computer (running win 7 ) on the same network, the scanner and all other printer functions work just fine.
I have tried installing the latest drivers from HP......scanner still not "communicating" with computer.....also temporarily disabled firewall.....please help...all the best -David G (gossat) -
I have a problem with itunes when I sync the saved music and want to sync my iphone 5 ios 7.0.6 no longer passes the music thing is that just stays on "waiting for sync" and not worry please help are more than 400 songs that do not want to hear who are wi
Plawexki wrote:
... do you know if the contacts, photos, messages etc will be wiped?
Yes... Everything will be Wiped and Replaced with what is currently on Your Mac.
SYNCING with iTunes
See here > http://support.apple.com/kb/HT1386
From Here > http://www.apple.com/support/iphone/syncing/
You may find this information of interest...
Have a read here...
https://discussions.apple.com/message/18409815?ac_cid=ha
And See Here...
How to Use Multiple iDevices with One Computer -
Problems with navigation when deploy application on WebLogic 10.3
Hi! I have problems with navigation when I deploy my application on Weblogic server 10.3. In my application I have two pages. One page where I can see the records. In this page I have button Create with action to secound jspx page. When I press this button then the first form (where I could see all records) is empty - the create operation worked, but navigation to second page not. Navigation rules is in adf task flow. In default server all works correct. Where is the problem?
Maybe when I deploy my application I need specialy deploy adf task flow or somewhere write something? If so, then can you explain me where? Any suggestions what to do.
Best regards!I have in log:
2009.26.3 20:12:52 oracle.adfinternal.controller.faces.lifecycle.JSFLifecycleImp
l setLifecycleContextBuilder
WARNING: ADFc: Replacing the ADF Page Lifecycle implementation with 'oracle.adfi
nternal.controller.application.model.JSFDataBindingLifecycleContextBuilder'.
2009.26.3 20:12:52 oracle.adfinternal.controller.util.model.AdfmInterface initia
lize
INFO: ADFc: BindingContext is present, using ADFm APIs for DataControlFrames.
2009.26.3 20:12:52 oracle.adfinternal.controller.metadata.provider.MdsMetadataRe
sourceProvider <init>
INFO: ADFc: Controller caching of MDS metadata resources ENABLED.
2009.26.3 20:12:52 oracle.adf.controller.internal.metadata.MetadataService$Boots
trap add
INFO: ADFc: Loading bootstrap metadata from '/WEB-INF/adfc-config.xml'.
2009.26.3 20:12:54 oracle.adf.share.security.providers.jps.CSFCredentialStore fe
tchCredential
WARNING: Unable to locate the credential for key AUGI in D:\bea\user_projects\do
mains\base_domain\config\oracle.
2009.26.3 20:12:54 oracle.adf.share.jndi.ReferenceStoreHelper throwPartialResult
Exception
WARNING: Incomplete connection information
Edited by: Debuger on Mar 26, 2009 11:18 AM -
My HP OFFICEJET 8500 PRO was working just fine wirelessly until I installed the Windows 8.1 update from the Microsoft. Now I cannot print at all. I get an error that says, "windows cannot print due to a problem with the current printer set up". I have tried reinstalling and a ton of other solutions to no avail. Can someone PLEASE Help!
Hello there, @jesseangelique ,
Welcome to the Community!
I would love to help you with the printing issue you're having, since the Windows 8.1 that was done.
Please run the Print and Scan Doctor. Write me back with the results or post a screen shot of the results and I will have a look at them.
This diagnostic tool will check for any conflicts that could be causing the issue. The tool will show you a report at the end. If there was a problem that the tool could not fix, you will notice it in the results.
Also, let me know which Officejet 8500 Model you have:
HP Officejet Pro 8500 All-in-One Printer - A909a
HP Officejet Pro 8500 All-in-One Printer - A909b
HP Officejet Pro 8500 Premier All-in-One Printer - A909n
HP Officejet Pro 8500 Wireless All-in-One Printer - A909g
Hope to hear from you!
R a i n b o w 7000I work on behalf of HP
Click the “Kudos Thumbs Up" at the bottom of this post to say
“Thanks” for helping!
Click “Accept as Solution” if you feel my post solved your issue, it will help others find the solution! -
Problem with countinuous paper printing in dot matrix printer
Hi All,
I have problem with dot matrix printer (Devise Type EPESCP) while printing continuos printing. If i am printing 2 or more than that prints at a time, 2nd page is printing 5 lines up.
I have developed one smartform for this and i have used A4 size page format.
I have tried to change the Printer initialization code to 86 lines for DINA4. Still no change in continuous printing.
Printer initialization
Reset after exit
Cover page
First Page
Start of even page
Start of odd page
Start of page
End of first page
End of even page
End of odd page
End of page
Start of line on an even page
Start of line on an odd page
Start of line
End of line on an even page
End of line on odd page
End of line
Printer initialization
# reset
\e\0x40
# select character table 3 -> PC 437 character set
\e\0x74\0x03
# set line spacing 6 LPI
\e\0x32
# set page length 86 lines
\e\0x43\0x46
# cancel bottom margin
\e\0x4F
# set left margin to 0
\e\0x6C\0x00
# select LQ quality
\e\0x78\0x01
# select non-proportional spacing
\e\0x70\0x00
Can any one help me.
Thanks,
VishnuHi Vishnu,
Above you have the following commands:
set line spacing 6 LPI
\e\0x32
set page length 86 lines
\e\0x43\0x46
46 HEX = 70
So the above settings mean 70 lines at 6 LPI = 11.66 inches.
So is the paper length 11.66 inches? If not, you should adjust the settings accordingly.
Regards,
Aidan -
Problem with Photoshop Elements Printing
I have been using Photoshop Elements for a couple of years now and know it pretty well. Today while attempting to print, a strange problem came up: After going through the protocol to make a print, just before the image prints PE does a very fast auto correction that basically ruins all the color correction I have made on the image. How do I disable this function?
Hi and thanks for your reply. I checked the settings under "Print", "More Options", then "Color Management" and it only has "Print Space", none of the three options that you said I should have. Am I looking in the wrong place?
Date: Mon, 3 Sep 2012 11:14:57 -0600
From: [email protected]
To: [email protected]
Subject: Problem with Photoshop Elements Printing
Re: Problem with Photoshop Elements Printing
created by 99jon in Photoshop Elements - View the full discussion
Check your color management by clicking More Options in the print dialog There are basically three options:1) Printer Manages Color2) Elements Manages color3) No color Management Make sure everything is consistent e.g. if you choose Elements manages color make sure color management is switched off in the print driver.
Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/4669848#4669848
To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/4669848#4669848. In the Actions box on the right, click the Stop Email Notifications link.
Start a new discussion in Photoshop Elements by email or at Adobe Forums
For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746. -
When attempting to use Lightroom external editor program to edit a photo in Photoshop Elements 10, the photo does not open / appear on photoshop elements screen. I don't have any problem with this when using Photoshop Elements 6 or Photoshop CS. I'm using a Mac with Mountain Lion OS. Any solutions?
Adobe now hides the editor - what looks like it is not - you want the editor hidden in the support folder - see http://forums.adobe.com/message/3955558#3955558 for details
LN -
Hi, recently purchased macbook 13", I have problem with sound when connect to my LG Smart tv with sound system. When i change sounds effect on my sound system also LG its all go quiet didn't have this problem with my laptop. Any advise ?
Some progess I see. To be honest, i would not waste your time with trying to connect using wireless.
You are likely to get poor connections and dropping out.
If its working using a cable, then there is no need to bother with giving me the network settings, bu see how it goes, because sometimes giving the TV a static IP address can give better results.
There is an example of a couple of powerline adapters on the diagram below. Just ignore the network switch unless you want to connect other devices which are near to the TV.
http://forumhelp.dyndns.info/networking/powerline3.jpg
I will monitor the subject line of this thread, should you want to post any more information.
There are some useful help pages here, for BT Broadband customers only, on my personal website.
BT Broadband customers - help with broadband, WiFi, networking, e-mail and phones. -
Cannot print due to a problem with the current printer
Cannot print (anymore) due to a problem with the current printer is the message I get every time I try to print something out. I tried to reinstall the printer's software, I changed the cables, but nothing happened. It seems to be something related to the printer setup utility. Any big idea on how to solve this? I was printing without problems until this afternoon. I have a HP Laserjet 1022 and sometimes I use Adobe Acrobat Writer. None is currently working.
Thanks for any help.
Power Book G4 Mac OS X (10.3.9)I just had the opererational system (10.3.9) reinstalled . Back to normality again.
-
I have a problem with Safari: when it opens and I go on google, it opens a page that says: please update internet explorer!
What should I do?It's a scam. Have a look at this thread:
https://discussions.apple.com/thread/6058094?tstart=0 -
Problem with SDO_relate when using polygons with holes.
I'm having a problem with sdo_relate. I'm trying to extract all elements from a point table (bdtq_batim_p) that are inside a specific polygon from another table (SDA_MUNIC_SS). The spatial index for both table have been rebuilt and the data from both table is valid.
When I do a count on the query, I know the answer should be 1422 elements (Counted in ArcGIS). However, sdo_relate gives a smaller number of elements in the result set.
The query :
SELECT count(distinct t.identifiant) FROM bdtq_batim_p t, SDA_MUNIC_SS s WHERE s.mus_co_geo = '48015' and sdo_relate( t.SHAPE,s.SHAPE,'mask=anyinteract querytype=window') = 'TRUE'
returns 282 elements. The query with mask=inside, SDO_Anyinteract() and SDO_inside() all give the same result.
I did a test with the following query and the result is 1422 (which is the good result).
SELECT count(distinct t.identifiant) FROM bdtq_batim_p t, SDA_MUNIC_SS s WHERE s.mus_co_geo = '48015' and SDO_WITHIN_DISTANCE( t.SHAPE,s.SHAPE,'distance=0') = 'TRUE';
It's important to note that the polygone (from SDA_MUNIC_SS) that is used for this query have holes in it. I have the same problem with all the polygons from the SDA_MUNIC_SS table that have holes in it. For the polygon without holes, the results are the same for the 2 queries.
My question are :
Why are the result from the two queries different? A query with a buffer of 0 should always return the same result as a query with Anyinteract.
Is there a known problem with SDO_RELATE when using a polygon with holes in it?
Do you have any idea how to solve my problem.Since i don't have much control on the version of Oracle and Patches that we use in the system, we used a workaround that detects the polygons with holes and uses the SDO_WITHIN_DISTANCE( t.SHAPE,s.SHAPE,'distance=0') = 'TRUE' operator in those case. We saw a slight decline in performance but it now returns the right results. When the system will be patched, we'll come back to the original version and see if the problem is solved.
Maybe you are looking for
-
Workflow for exporting xml from Excel and importing into table in InDesign
Hello, I have worked out how to get data from a .xlsx into a table in InDesign. However, the workflow is still a little clunky and I am looking for way to automate the process further. My current workflow is as follows (files can be download here: ht
-
I'm using OSX 10.9.3. I use Mail on all my devices. In the email signature I have my two phone numbers. Is it possible to make them live so that recipients can click on the numbers to call me, straight from the email? thanks Juliet
-
Javascript funciton in WAD created to generated bookmark not working !
Hi Gurus I have a written a javascript to get the bookmark ID generated in child window using standard funciton module SAP_BW_URL CMD='BOOKMARK'. after that the Host URL is changed with the COporate Portal URL and the child window is closed. Any dou
-
Transaction IView -- SAP GUI for Windows
Hi, I have created a transaction iview -- sap gui for windows in my portal. Even thought i logoff from my portal, sap gui session that is opened is not closed. Can any one please suggest me a way to stop sap gui session also when i logoff from my por
-
Hello, In jdeveloper 10.1.3.1 I created a simple stateless session bean with one method. I exposed the method through Web Service Endpoint interface and created ejb-jar deploy profile. I can successfully deploy produced ear file to oc4j (at deploy ti