QB64.org Forum

Active Forums => QB64 Discussion => Topic started by: Juanjogomez on December 05, 2018, 11:32:16 am

Title: Issue _PRINTIMAGE (Resolved)
Post by: Juanjogomez on December 05, 2018, 11:32:16 am
Hello
I'm programming on a computer with windows 10 64 bits and I'm doing a program that should print a document in the printer. I am using the _PRINTIMAGE example of Qb64 wiki and the document is printed perfectly with the printer and with PDF Creator.
I have tried the program in another computer that I have with Windows 7 sp1 and the page is white, both in the printer and in PDF Creator. In contrast, the preview comes out perfectly.
Could it be a _PRINTIMAGE error?
Thanks
Title: Re: Issue _PRINTIMAGE
Post by: Pete on December 05, 2018, 01:21:38 pm
Odd that going backwards to Win 7 would create a problem. It is usually the other way around. Questions that might help developers...

1) Do both computers share the same printer?

2) Do you have the same version of QB64 installed in both computers?

3) Is access to printing the same. In other words are both printed over network, usb, etc.

Pete
Title: Re: Issue _PRINTIMAGE
Post by: Petr on December 05, 2018, 03:08:53 pm
Hi. I have none problem with _PRINTIMAGE and HP wirelless laser printer in Windows7 SP1, 64 bit. Is printer, which you use set as default?

I was still thinking - check in the preview to select the option to automatically adjust the print size. If PrintImage started the printer, it looks like the print is out of the printable area on the paper
Title: Re: Issue _PRINTIMAGE
Post by: Juanjogomez on December 05, 2018, 03:38:08 pm
Hi, both computer have the same version of qb64 as I use the program from a folder I have created in Dropbox.
The printer is connected via network to both computers.
The printer is set as the default one and when I use PdfCreator as the default printer it also prints a blank page, I have also tried selecting the "adjust to paper size" setting in the printer but the result is the same.

Thank you
Title: Re: Issue _PRINTIMAGE
Post by: Juanjogomez on December 07, 2018, 07:00:55 am
_PRINTIMAGE need some windows plugin to pass the screen to the printer? It is the only thing that occurs to me.
I do not know what to do to make it work on that computer
Title: Re: Issue _PRINTIMAGE
Post by: Petr on December 07, 2018, 03:05:31 pm
Hi. I think, not  need extra plugin. Try clear the print queue, turn the printer off and on. If it does not help, try to check if the white font color is not set. If not, what do you see if instead of _PRINTIMAGE something& use SCREEN something&? Can you send a program?
Title: Re: Issue _PRINTIMAGE
Post by: Petr on December 07, 2018, 03:09:53 pm
Try use _NEWIMAGE (210, 297, 32) for A4 format.
Title: Re: Issue _PRINTIMAGE
Post by: FellippeHeitor on December 07, 2018, 09:35:50 pm
Too low resolution, ain’t it?
Title: Re: Issue _PRINTIMAGE
Post by: Petr on December 08, 2018, 04:35:47 am
Hi Fellippe, if I can rely on the correctness of the help for the PRINTIMAGE statement, it is stated that, I quote:

"The image may be stretched disproportionately using normal screen sizes. To compensate, use a _NEWIMAGE screen that is proportional to the paper size. e.g. A 640 X 900 SCREEN page is roughly the same as 3 times a 210mm X 297mm paper size."

So I figured the basic resolution in the ratio of 1: 1 would be what I wrote - 210x297

Definitely, if the source code is added here, I'd like to look at it later. I'm still working on the bathroom, I added her photo to the thread of the Christmas theme. I like to try it, but - it's strange that Windows 10 works as it does, but Windows 7 does not. Rather, I have encountered the opposite problem.
Title: Re: Issue _PRINTIMAGE
Post by: FellippeHeitor on December 08, 2018, 04:47:24 am
By relying on the correctness of the help you’ll actually create a _NEWIMAGE(640, 900, 32) which is proportional to A4 paper (which is 210 x 297 millimeters in size). But even 640x900 is small resolution for quality printing. My point is that 210x297 will produce bad quality results.
Title: Re: Issue _PRINTIMAGE
Post by: Petr on December 08, 2018, 04:54:46 am
I try it :-D

Juanjogomez: Try this very easy source, if it print to paper text "Test" in black to white background. Works correct for me:

Code: QB64: [Select]
  1. a = _NEWIMAGE(640, 900, 32)
  2. CLS , _RGB32(255, 255, 255) 'white background
  3. COLOR _RGB32(0, 0, 0), _RGB32(255, 255, 255)
  4. PRINT "Test"
  5.  

If is just set COLOR _RGB32(0,0,0), is printed black quad without readable text. This output can be see if you use SCREEN a instead of _PRINTIMAGE.
If is used COLOR _RGB32(0, 0, 0), _RGB32(255, 255, 255), so as in program, then SCREEN show correct output and _PRINTIMAGE print correctly.

Aha! With other tests, I found that the 210x297 resolution returns a three times larger print output than the screen. This means I have misunderstood the text in the Help. I am sorry for my poor knowledge of English.
Title: Re: Issue _PRINTIMAGE
Post by: Juanjogomez on December 09, 2018, 05:43:15 am
Hi Petr and everyones,

a = _NEWIMAGE(640, 900, 32)
_DEST a
CLS , _RGB32(255, 255, 255) 'white background
COLOR _RGB32(0, 0, 0), _RGB32(255, 255, 255)
PRINT "Test"
_PRINTIMAGE a

That program prints a blank sheet.

As I mentioned, it only happens with a computer. I have tried on 3 computers connected to the same printer, and even with another printer, and it works fine, except with that computer. As I mentioned, it has Windows 7 SP1 64 bits. In another computer with windows 7 SP1 of 32 bits and another one with windows 10, they work perfectly.

It is not a program problem, but the _PRINTIMAGE command, which does not work on that computer.
Title: Re: Issue _PRINTIMAGE
Post by: FellippeHeitor on December 09, 2018, 07:04:26 am
Please try this, both on the computer that's doing fine and on the one that doesn't seem to like _PRINTIMAGE:

Code: QB64: [Select]
  1. LPRINT "Test"

Let me know if it works.

Another thing to try: run your program in admin mode on the faulty machine. Does it make any difference?
Title: Re: Issue _PRINTIMAGE
Post by: Juanjogomez on December 09, 2018, 01:21:54 pm
Hi FillippeHeitor,

I try run the program in admin mode and print a blank page.

LPRINT "Test" print a blank paper
Title: Re: Issue _PRINTIMAGE
Post by: Pete on December 09, 2018, 01:29:40 pm
Well unless the printer's out of ink, I give up.

Anyway, if it won't process _LPRINT then the problem isn't _PUTIMAGE.

Pete
Title: Re: Issue _PRINTIMAGE
Post by: FellippeHeitor on December 09, 2018, 01:41:33 pm
The thing is that LPRINT also uses _PRINTIMAGE internally.

All _PRINTIMAGE really does is stretch the image you pass to it to fit the size settings that Windows reports for the current default printer.

QB64 doesn't deal with drivers or anything too deep. It just makes an api call and passes it an image.

If running in admin mode didn't give the expected results, I can only think of something misconfigured on your machine, as QB64 does exactly the same procedure, a native one from Windows API, no matter the OS version you're running.

Possible troubleshooting step:
- Reinstalling printer drivers
Title: Re: Issue _PRINTIMAGE
Post by: Pete on December 09, 2018, 02:08:16 pm
Really? Well makes sense, as LPRINT was needed to keep QuickBASIC compatibility. I actually thought that might be the case before I posted, which leads me to go back to my old saying... It's alright to talk out of your hat. Just make sure you're not sitting on it at the time! Now if you will excuse me, this hat won't unflatten itself you know and as far as this printer problem is concerned, it's a real head scratcher. I hope the driver is the issue so it gets resolved.

Pete
Title: Re: Issue _PRINTIMAGE
Post by: Juanjogomez on December 10, 2018, 02:31:00 am
Well I'm sorry to say that it was not a problem with the printer driver. It also does not work with another inkjet printer that is connected to the network, nor with PDFCreator, which does not need a printer driver.
In the end I will have to format the computer and install Windows 10, if there is no other solution
Title: Re: Issue _PRINTIMAGE
Post by: SMcNeill on December 10, 2018, 03:40:10 am
I can’t see why it’d work with Win10 and not Win7.  QB64 uses the same system calls for both. 

Some possible causes: https://social.technet.microsoft.com/forums/windows/en-US/043866b4-409d-4a54-b02c-0bbadfa10609/windows-7-printing-blank-pages

Another site suggests to:
Check printer settings and verify that the printer outputs in RAW format and not in EMF format. To do this, please refer to the following steps:

1) Click the Start button and click Control Panel.
2) Click View devices and printers under Hardware and Sound.
3) Right click HP Photosmart All-In-One C7250 Printer and click Printer properties.
4) Click the Advanced tab, click to clear the Enable advanced printing features check box, and then click OK.

(Probably not your printer type, but yours might have a similar setting.)



And here’s a few ideas:  https://helpdeskgeek.com/windows-7/ie-print-preview-blank/




Seems like a missing “Low” folder could be causing the problems, or an integrity level setting.
Title: Re: Issue _PRINTIMAGE (Resolved)
Post by: Juanjogomez on December 24, 2018, 10:40:07 am
I have reinstalled Windows 7 64 bits and it works fine. It would have been unconfigured.
thanks to everyone
Title: Re: Issue _PRINTIMAGE (Resolved)
Post by: FellippeHeitor on December 24, 2018, 10:43:30 am
Good to hear!