Printing some text on A4 size paper
Hi friends, I am trying to print a simple text on my printer using java, I have included the code for printing in an action event of
a button as follows:
private void sim_printActionPerformed(java.awt.event.ActionEvent evt) {
PrintJob pjob = getToolkit().getPrintJob(this,"ppk",(Properties)null);
Graphics pg = pjob.getGraphics();
Font times = new Font("arial",Font.PLAIN,12);
pjob.getPageDimension();
pg.setFont(times);
FontMetrics tm = pg.getFontMetrics(times);
pg.drawString("Hello World",20,20);
pg.dispose();
pjob.end();
it works well for the first time when i click the button, when i repeat once again I receive a list of null pointer exceptions and there are no further printouts. Please tell me how to get print copies whenever I click the button at any time. Also suggest me some more examples if any, My aim is only to print the data entered by the user in the text boxes.
thanks in advance.
Message was edited by:
prasad_khode
Message was edited by:
prasad_khode
After trying variuos things I wrote another program to understand the problem, Now the program is as follows
package sample;
import java.awt.*;
import java.awt.print.*;
public class SamplePrint implements Printable {
static public void main(String args[]) {
PrinterJob pjob = PrinterJob.getPrinterJob();
Book book = new Book();
book.append(new SamplePrint(), new PageFormat());
pjob.setPageable(book);
boolean if_print = pjob.printDialog();
if (if_print) {
try {
pjob.print();
} catch (PrinterException e) {
System.err.println("Printing error: " + e);
public int print(Graphics g, PageFormat format, int pageIndex) {
g.drawString("Hello world",100,100);
return Printable.PAGE_EXISTS;
The program works fine only once that is first time after starting the system and I get the required output on the paper. But while executing the same program once again the exception is raised, that is as follows.
�Printing Error: java.awt.print.PrinterException: Printer is not accepting job.�.
If I want another print copy I have to restart the PC and the same thing continues. The following information might help you on which I am experimeting.
OS: Win XP.
Jdk1.5
Printer: HP Deskjet 3940.
Any help is greatly appreciated.
Similar Messages
-
How to print some text in BOLD in a classical report
Hi,
I need to print some selected text in BOLD in classical report.
Went through SDN forum...came across some suggestions like using class cl_dd_document and its functions..
The problem is that one of its function "add_text" allows to highlight text...but the display function "display_document" requires a container to display, whereas mine is a simple classical report...am i wrong somewhere..or is there any other method to do the same...
Thanks!!Hi Deepti,
I am not sure that is possible on a classical report ntu you can use colors to highlight a part of the report output in order to check the various options you have with format is to check F1 on format.
Regards,
Himanshu -
Firefox "print" prints some text on top of other text. How can I fix it?
I want to print a webpage with a travel itinerary on it. The itinerary is quite long, exceeds the page height and overflows onto the next page. Unfortunately the information below the itinerary is then printed on top of the itinerary information on the overflow page.
I have tried the same page in Chrome, Safari and IE 10 and it prints correctly in all of them.
I use a css (print.css media='print') to control some of the print output.
Can anyone help please?
Application Basics
Name: Firefox
Version: 24.0
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0
Extensions
Name: DownloadHelper
Version: 4.9.14
Enabled: true
ID: {b9db16a4-6edc-47ec-a1f4-b86292ed211d}
Name: easy Xdebug
Version: 1.5
Enabled: true
ID: [email protected]
Name: Firebug
Version: 1.11.2
Enabled: true
ID: [email protected]
Name: Live HTTP headers
Version: 0.17
Enabled: true
ID: {8f8fe09b-0bd3-4470-bc1b-8cad42b8203a}
Name: Page Speed
Version: 1.12.9
Enabled: true
ID: {e3f6c2cc-d8db-498c-af6c-499fb211db97}
Name: DivX Plus Web Player HTML5 <video>
Version: 2.1.2.145
Enabled: false
ID: {23fcfd51-4958-4f00-80a3-ae97e717ed8b}
Name: FreeHDSport.TV
Version: 1.2
Enabled: false
ID: [email protected]
Name: Translate This!
Version: 2.0
Enabled: false
ID: jid0-k75TfRGfOXPHfEZmJ9cKu5eCgLc@jetpack
Important Modified Preferences
accessibility.typeaheadfind: true
accessibility.typeaheadfind.flashBar: 0
browser.cache.disk.capacity: 358400
browser.cache.disk.smart_size_cached_value: 358400
browser.cache.disk.smart_size.first_run: false
browser.cache.disk.smart_size.use_old_max: false
browser.places.smartBookmarksVersion: 4
browser.startup.homepage_override.buildID: 20130910160258
browser.startup.homepage_override.mstone: 24.0
dom.mozApps.used: true
dom.w3c_touch_events.expose: false
extensions.lastAppVersion: 24.0
gfx.blacklist.webgl.msaa: 4
network.cookie.prefsMigrated: true
places.database.lastMaintenance: 1382955114
places.history.expiration.transient_current_max_pages: 104858
plugin.disable_full_page_plugin_for_types: application/pdf
plugin.importedState: true
plugin.state.ovshelper: 0
print.macosx.pagesetup-2: PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPCFET0NUWVBFIHBsaXN0IFBVQkxJQyAiLS8vQXBwbGUvL0RURCBQTElTVCAxLjAvL0VO
print.print_bgcolor: false
print.print_bgimages: false
print.print_colorspace:
print.print_command:
print.print_downloadfonts: false
print.print_duplex: 0
print.print_evenpages: true
print.print_in_color: true
print.print_margin_bottom: 0.5
print.print_margin_left: 0.5
print.print_margin_right: 0.5
print.print_margin_top: 0.5
print.print_oddpages: true
print.print_orientation: 0
print.print_page_delay: 50
print.print_paper_data: 0
print.print_paper_height: 11.00
print.print_paper_name:
print.print_paper_size_type: 1
print.print_paper_size_unit: 0
print.print_paper_width: 8.50
print.print_plex_name:
print.print_resolution: 0
print.print_resolution_name:
print.print_reversed: false
print.print_scaling: 1.00
print.print_shrink_to_fit: true
print.print_to_file: false
print.print_unwriteable_margin_bottom: 57
print.print_unwriteable_margin_left: 25
print.print_unwriteable_margin_right: 25
print.print_unwriteable_margin_top: 25
privacy.cpd.offlineApps: true
privacy.cpd.siteSettings: true
privacy.donottrackheader.enabled: true
privacy.sanitize.migrateFx3Prefs: true
privacy.sanitize.timeSpan: 0
security.csp.enable: false
security.OCSP.enabled: 0
security.warn_viewing_mixed: false
storage.vacuum.last.index: 1
storage.vacuum.last.places.sqlite: 1381489144
user.js Preferences
Your profile folder contains a user.js file, which includes preferences that were not created by Firefox.
Graphics
Device ID: 0x fd5
GPU Accelerated Windows: 1/1 OpenGL
Vendor ID: 0x10de
WebGL Renderer: NVIDIA Corporation -- NVIDIA GeForce GT 650M OpenGL Engine
windowLayerManagerRemote: false
AzureCanvasBackend: quartz
AzureContentBackend: none
AzureFallbackCanvasBackend: none
JavaScript
Incremental GC: true
Accessibility
Activated: false
Prevent Accessibility: 0
Library Versions
NSPR
Expected minimum version: 4.10
Version in use: 4.10
NSS
Expected minimum version: 3.15.1 Basic ECC
Version in use: 3.15.1 Basic ECC
NSSSMIME
Expected minimum version: 3.15.1 Basic ECC
Version in use: 3.15.1 Basic ECC
NSSSSL
Expected minimum version: 3.15.1 Basic ECC
Version in use: 3.15.1 Basic ECC
NSSUTIL
Expected minimum version: 3.15.1
Version in use: 3.15.1Hi midnig-
I found this article on troubleshooting print issues:
http://mzl.la/MCCq7H
I see that you have covered some of the basic troubleshooting tips- but you might try resetting the printer. Here are some other suggestions:
- If you have made changes to Advanced font settings like increasing the minimum/default font size then try the default minimum setting "none" and the default font size 16 in case the current setting is causing problems.
- Tools > Options > Content : Fonts & Colors > Advanced > Minimum Font Size (none)
Make sure that you allow pages to choose their own fonts.
- Tools > Options > Content : Fonts & Colors > Advanced: [X] "Allow pages to choose their own fonts, instead of my selections above"
It is better not to increase the minimum font size, but to use an extension to set the default page zoom to prevent issues with text not being displayed properly.
- You can use an extension to set a default font size and page zoom on web pages.
Default FullZoom Level: https://addons.mozilla.org/firefox/addon/default-fullzoom-level/
NoSquint: https://addons.mozilla.org/firefox/addon/nosquint/ -
How do I get my printer to work with odd size paper.
I'm trying to print a retun address on an envelope 5 3/4" x 4 3/8" and apparently I need to have a paper setting in my printer match the paper size in Word.
Maryannebrabander,
Your comment " ... It was printing great until I did this upgrade." brought to mind a thought:
If you're ever in the SIlicon Valley area of California, specifically Mountain View, CA, I strongly recommend a visit to the Computer History Museum there. This page from the Museum website shows a Calcomp plotter advertisement from 1969:
http://www.computerhistory.org/revolution/mainframe-computers/7/161/689
My question to you is should the iPhone be able to print to the Calcomp plotter? If not, exactly how old would you have a printer (or plotter) be before you dropped support for it? If you ever do drop support, then that would occur at some discrete time - one day it would work, then something would be updated and it would no longer work. -
Print ABAP List to Ledger size paper
Having a problem getting ALV to print to Ledger.
I've create a Page format ZLEDGER (11x17)
a Format Type ZLEDGERALV
Assigned this to my Device Type., and copied the Actions for 65x255 Format
I assigned my Device Type to an OUtput type where I;ve set my default paper tray to Tray 4, and Assigned ZLEDGER to Tray 4.
When I attempt to print, the printer asks for "Letter" on on Tray 4.
Any ideas.
MikeHowever, I've tried this before, and it did not work.. the only time I was able to get the the command &l6A recognized is if I put it in the First Page file.
enter PJL mode and switch to PCL language
\e%-12345X@PJL\r\n
Set Paper size 11x17
#\e&l6A
#\i<HPLJ4:ZLEDGER:SETUP>
#=================
Support Devices
imagePASS S1
#=================
Staple
#=================
Upper left in Portrait and Upper Right in Landscape(default)
#@PJL COMMENT CANPJL SET STAPLE = ONEUPLEFT\r\n
Upper right in Portrait and Lower Right in Landscape
#@PJL COMMENT CANPJL SET STAPLE = ONEUPRIGHT\r\n
Lower left in Portrait and Upper Left in Landscape
@PJL COMMENT CANPJL SET STAPLE = ONELOWLEFT\r\n
Lower right in Portrait and Lower Left in Landscape
#@PJL COMMENT CANPJL SET STAPLE = ONELOWRIGHT\r\n
Two left in Portrait and Two Top in Landscape
#@PJL COMMENT CANPJL SET STAPLE = TWOLEFT\r\n
Two right in Portrait and Two bottom in Landscape
#@PJL COMMENT CANPJL SET STAPLE = TWORIGHT\r\n
#=================
Hole Punch
#=================
Left in Portrait and Top in Landscape
#@PJL COMMENT CANPJL SET PUNCH = LEFT\r\n
Top in Portrait and Right in Landscape
#@PJL COMMENT CANPJL SET PUNCH = TOP\r\n
#================
Output Bin
#================
Upper tray
#@PJL COMMENT CANPJL SET OUTPUTBIN = FINISHER1\r\n
Lower tray
#@PJL COMMENT CANPJL SET OUTPUTBIN = FINISHER2\r\n
#===============end
@PJL ENTER LANGUAGE=PCL\r\n
\e&l6A
reset
\eE
Landscape mode
\e&l1O
ECMA-94 Latin 1 character set
\e(0N
Skip perforation region on
\e&l1L
set vertical spacing
#\e&l7.8C
set top margin
\e&l1E
set line spacing
\e&l8D
set bottom margin
\e&l65F
Define 2 macros: Macro 1 will select Normal font
Macro 2 will select Bold font
Start of MACRO 1:
\e&f1y0X
select pitch 12, height 8
\e(s0p12h8v0s0b3T
set horizontal spacing
\e&k12H
End of MACRO 1:
\e&f1y1X
Start of MACRO 2:
\e&f2y0X
select pitch 12, height 8
\e(s0p12h8v0s3b3T
set horizontal spacing
\e&k12H
End of MACRO 2:
\e&f2y1X
Execute Macro 1 to set normal font:
\e&f1Y\e&f2X
Macros for drawing of frames.
\e&f470y0X\e(10U\e&k5H\xC5\e(0N\e&k5H\e&f470y1X
\e&f460y0X\e(10U\e&k5H\xC4\e(0N\e&k5H\e&f460y1X
\e&f461y0X\e(10U\e&k5H\xB3\e(0N\e&k5H\e&f461y1X
\e&f462y0X\e(10U\e&k5H\xDA\e(0N\e&k5H\e&f462y1X
\e&f463y0X\e(10U\e&k5H\xBF\e(0N\e&k5H\e&f463y1X
\e&f464y0X\e(10U\e&k5H\xC0\e(0N\e&k5H\e&f464y1X
\e&f465y0X\e(10U\e&k5H\xD9\e(0N\e&k5H\e&f465y1X
\e&f466y0X\e(10U\e&k5H\xC3\e(0N\e&k5H\e&f466y1X
\e&f467y0X\e(10U\e&k5H\xB4\e(0N\e&k5H\e&f467y1X
\e&f468y0X\e(10U\e&k5H\xC2\e(0N\e&k5H\e&f468y1X
\e&f469y0X\e(10U\e&k5H\xC1\e(0N\e&k5H\e&f469y1X
#<RSPO0060 - end of gene -
Print some text before include in sapscript
Helllo Friends,
There is one standard include in sap script for example
INCLUDE &VBDKA-TDNAME& OBJECT VBBK ID 0001 PARAGRAPH HT
i want to print text before this like
'packsize ' INCLUDE &VBDKA-TDNAME& OBJECT VBBK ID 0001 PARAGRAPH HT
pls tell how is it possible
Regards,
Sunnytry like this by specifying character format..
<c1>'packsize '<c1> <c2>INCLUDE &VBDKA-TDNAME& OBJECT VBBK ID 0001 PARAGRAPH HT<c2> -
Printer won't recognize custom size paper
i have a Photosmart Premium C309g that was working fine up until recently. it will not recognize a custom sheet paper that is 3.75" x 9.00. i was able to print 50 wedding invitations for my daughter and when i had to print 25 more the printer does not recognize the paper, i keep getting an error that reads out of paper. if i put a full sheet in the printer it will print. i have also had this issue with trying to print response cards that are 4.00 x 3.75". I have reloaded the HP drivers for this printer, i have bought a new Windows office program and still nothing works. Any ideas would be helpful.
Welcome to the forum! Check out this document which goes in-depth on troubleshooting paper feeding issues: 'Out of Paper' Error Message Displays and the Product Does Not Pick Up or Feed Paper
Best of luck!
-SeanS
-------------How do I give Kudos? | How do I mark a post as Solved? -------------------------------------------------------- -
Need to print some text only in last page in SAP script
Moved to correct forum by Moderator. General wasn't right either.
Hi All.
I need to print "Remarks" only in last page of sap script.
Can anyone please help me on this.
Thanks
Senthil kumar V.
Edited by: Matt on Nov 21, 2008 7:38 AMHi,
you have 4 possibilities.2 at non main window, 2 at main window.
at non main window.
1. /: IF &PAGE(C)& = &SAPSCRIPT-FORMPAGES(C)&
remarks
remarks
remarks
/: ENDIF
2, /: if &NEXTPAGE& ='0'.
remarks
remarks
remarks
/: ENDIF
at main window
3. Add the remarks at the last item of the main which is printed
4. add a new item to your main (/E)
put your remarks in it.
Change your program in such a way this item will print as last one.
like
/E REMARKS
remarks
remarks
remarks
and in sapscript program add logic at the end.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'REMARKS'
EXCEPTIONS
element = 1
window = 2.
I am sure this will do. Make a choice.
Gr., Frank -
How to print both letter and legal size docs at same time with two trays
I have an HP Laser Jet P2055dn printer. How can I print both letter and legal docs at same time?
Not quite sure what you mean by "print both letter and legal docs at same time".
If you mean that sometimes you want to print a document on Letter size paper, and at other times you want to print a different document on Legal sized paper, then all that is neccessary is to ensure that:
The printer knows what Paper Size (e.g. Letter or Legal) is present in each tray; on many LaserJet devices, the size is detected automaticaly by sensors in each tray (except for the drop-down tray), but some devices may require that you set the size via front panel menus, or (for network models) via the Embedded Web Server equivalent.
You may also need to specify what Paper Type (e.g. Plain or Letterhead) is present in each tray, in order to distinguish between two or more trays which have the same paper size loaded.
Within your appllcation / print preferences, ensure that you select the required combination of size and type for the document.
But if you mean how do you print a document with some pages on one size of paper, and other pages on a different size, this may only be possible with bespoke applications and/or printer drivers. -
How to print some data in alv which is not in table.
hi all,
Please can any one tell me how to print some text in the existing alv program to the second line of every record.
the header is there but it is empty.In the data,
there are two lines printing for a normal alv.the same text should be printed in every second line of each record.Please reply soon.its urgent.This is not possible in ALV.
When you say some text I assume the text is not in the same columnar format as the list is.
ALV supports only a columnar format (except for subtotals).
You can add the text to the ITAB by parsing the text to the record. It is not going to look good if you do that. -
How to print hardcode text in alv
hi folks,
i am working on a report to display data using ALV.
i want to print some text and its correspodning value. (corresponding value is calculated value).
i am able to print calculated value using fieldcatalog but unable to understand how can i print the text(which is a hardcoded text).
ex:
statement value
select* 0
using macros 1
in my example select* and using macros are hard coded texts so can anyone tell me how can i print do this.
thanks in advance.hi
thanks for the reply.
my report has got 14 stmnts and has 14 error message types.
earlier it text was hardcoded and displayed correspondingly but now we want to remove write statements.
so i am not able to understand how can i send the hardcoded text as the output is not in the desired way.
i want to know how can i add into fieldcatalog record by record i.e. stmnt1, value-1 record
stmnt2,value-2nd record and so on. as this would definitely solve my problem -
Printing standard text with TAB
Hi Folks,
I am very new to SAP Scripts and need some help here. I am printing some text using Standard Text object (using INCLUDE statement in sapscript). But now I want to print the text after a TAB. I tried with below syntax but no luck.
/: ,,INCLUDE ZTEXT OBJECT TEXT ID ST
Request you to please suggest some approach.
Thank you.
Regards,
SudThanks Christian !
Yes, m using SO10 for creating this text.
But as u suggested, I cannot use tab in ZTEXT, because this will affect the alignment for all the other scripts where I am using this ZTEXT.
For every other script, I do not need this extra tab before the ZTEXT. Only for this one script I want to intorduce a Tab before printing this ZTEXT.
Any other approach?
Thanks
Regards,
Sud -
Printing bold text in char mode report
Hi all,
I have developed a character mode report. I am able to print some text in big letters and some in condensed. But I am not able to print some text in bold. What printer cde should be used for printing in bold. Please help.
Thanks in advance
MurthyTanikella,
The escape codes might be different for different printers. You might need to check with the printer documentation and use that appropriately in the deflt.prt file of reports or the .prt file you use in desformat
Please refer to character mode printing chapter of
http://otn.oracle.com/docs/products/reports/files/pbr_uxprt.pdf
Thanks
The Oracle Reports Team -
Printing with HP Advanced Photo Copy paper
Model 6210xi
Regardless of what I do, the printer will not feed this paper. It prints fine on regular paper. I want to print some photos on photo quality paper. What to do?I do not have an answer, but I do have the same problem.
-
Printing on Letter size paper, Margin issues!
I am working from a Dell Optiplex 755 with Windows XP, Illustrator CS2 and an HP 4345 printer.
The problem is summarized in the below paragraphed points:
We print on an 8.5x11 sheet of paper, with artwork sized for 8.5 x 11 exactly. The artwork contains 4 quarter page images to be cut into flyers, which each have 1/4" margins all the way around them. There is a back side as well, created with the same specifications. We wish to print these flyers duplex from high quality PDF files that we created in Illustrator.
When the print comes out, the right hand margin of the sheet is larger than the top, bottom, and left margins.
The top, bottom, left margins= 0.166"; this doesn't effect the top, bottom, and left sides of the artwork, as the .25" margin we setup on the artwork is greater than the .166" margin of the print area.
However, the right hand margin= 0.306"; this means that the right side of the artwork gets cut off by .056" (.306-.25")
In order to fit all of the artwork on the page, we can either shift the Page Tiling Print Area over slightly, or we can select the print option "Shrink to Fit". However this is a problem because we are printing the two sides as a duplex (printed both sides), and the tiled artwork on the front won't line up what is printed on the back because of the larger right margin. Therefore if the sides don't line up when we go to cut, the information is going to be cut off on the opposite side to the one we are cutting.
The printer setting for 8.5x11" paper "Letter" is what we believe to be creating the offset margin. (We checked the specifications for a Letter print, and the standard margins were identical to the ones we see exhibited in the print outs, 0.166" vs. 0.306")
We understand that there might be a way to set up your own custom print setting through Adobe Acrobat/ Photoshop/ Illustrator for a specfic type of print job, allowing you to control the print margins, but we are not familiar with the process.
Can you think of any other possible causes and/or solutions for the problems that are described?Thanks for the feedback Karen! I'm not sure that the setup process is pricesly the same in illustrator but I've got some screenshots of how the artwork is setup to give you an idea.
This is the artwork shown with the Rulers included to show the size of the artboard and where the guides are set for the margins I want:
http://i5.photobucket.com/albums/y198/tcperry/Alanis-Tiled-Artwork-with-g.jpg
This is the artwork shown with the Print Area shown by selecting View>Show Page Tiling:
http://i5.photobucket.com/albums/y198/tcperry/Alanies-showing-print-area.jpg
So I think that the artwork is correctly setup, however the problem lies in the printing area that seems to be predetermined by the printer setting 'Letter' for 8.5x11" paper (see the dotted line on the second screen shot).
I see what you're talking about when you say 'centered on page' and yes we have Auto-Rotate and Center selected in the Page Handling options when printing from PDF. However it will still just chop off the artwork that comes within .306" of the right side of the page. Is there anyway around this .306" margin that seems to be set by the printer?
Maybe you are looking for
-
STATUS_UPDATE error to update USER STATUS - Update termination error
Hi All, I am using status_update FM in sales order user exit MV45AFZZ in a perform routine for updating user status in line item for sales order. There are 4 custom statuses created for the sales order line item. 1,2 3, and 4 by configuration. My job
-
Getting Error - CREATE_CASH : ORA-01403: no data found
When i use api AR_RECEIPT_API_PUB.CREATE_CASH in loop then i get error 'CREATE_CASH : ORA-01403: no data found' for second record. AR_RECEIPT_API_PUB.CREATE_CASH(p_api_version => 1.0 ,p_init_msg_list => fnd_api.g_true ,p_commit => fnd_api.g_true ,p_r
-
How do you get ringtones that you have purchased before back on your phone for free
How do I download ringtones again on your phone if you purchaced them before?
-
File -- Export in oracle apps forms- headings missing and order incorrect
We have a custom form for our custom billing processes. It lists all the draft invoices that are ready to be released along with multiple custom fields. When the user tries to export the data in this form, tsv file is saved. We have the following iss
-
HT201359 why i cant use my apple id ?
help me plz i cant use my apple id