Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Bullzip pdf printer. Interruption to service 2

Status
Not open for further replies.

AndrewMozley

Programmer
Oct 15, 2005
621
1
18
GB
I have been running Bullzip for several years within VFP. Several forms within an application offer the option of producing a report to printer, to Excel or to pdf.

The section of code to do this (slightly simplified) is :

Code:
   oBullzip = CREATEOBJECT("BullZip.PDFPrinterSettings")
   lBullType = TYPE('oBullzip')
   IF lBullType <> "O"
      MESSAGEBOX("Not able to fire up the Bullzip PDF printer;  Please check that it is installed on this machine, or contact Software Support.")
      RETURN .F.
      ENDIF
   oBullzip.SetValue("output", .zOutFileName)
   oBullzip.SetValue("ShowSettings","Never")
   oBullzip.SetValue("ConfirmOverwrite","No")
   oBullzip.SetValue("Showpdf","No")
   oBullzip.SetValue("Statusfile",lStatusfile)
   oBullzip.WriteSettings(.T.)

   SET PRINTER TO NAME "Bullzip PDF Printer"
   REPORT FORM &lRepName NOCONSOLE TO PRINTER

This has now ceased to work on my development machine, either when I am running the application by starting it in a VFP session or when I am running the application as a built .exe. The resultant report is resolutely sent to the default printer.

It does however continue to work on client machines which also have Bullzip installed. I feel that I must have made some change on my development machine.

Can anyone offer suggestions as to how I can track down and correct this fault. Or - if I need to re-install Bullzip - how to do that; - it is a few years since I first did this! I have tried putting in a break point (SET STEP ON) into the code above. I can see that a variable oBullzip is created, but cannot drill down into it.

Bullzip is certainly still installed on my machine. If I ask to send a report to printer (either within my application or from another application, like WORD), that works fine. And from the VFP command window, if I execute APRINTERS(aListP), ‘Bullzip PDF Printer’ appears in the resultant array.

Several persons (e.g JRB-Bldr) have been very helpful in the past.

Thank you
 
I don't see how your code could fail to use "Bullzip PDF Printer", unless the name changed.

Check Windows printers&scanners setting about the printer name andwhile you're there you may also check whether an option introduced in Windows 10 is active: Let Windows manage my default printer.

It shouldn't matter much, as you explicitly set printer to name, which is exactly what to do. You just need to assure this printer name really is as you use it, or else this SET PRINTER is disregarded and the default printer is used.

Chriss
 
Do you have some error handling enabled?

I sometimes switch from handling an error (my USUAL() procedure) to deliberatley ignoring a possible error (in case the OS gets to it first, like checking for a file
that is on a drive that isn't available or deleting a file that is locked).

If you are doing the latter, it could be that you have an error you can't see... so issue an ON ERROR before your code to call Bullzip perhaps?

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.
 
Hi Andrew,

Check with getprinter() what printers your VFP application can see.
Look carefull for any changes in the printer name.

Regards, Gerrit
 
Andrew,

Have you made any changes to the report itself? Is it possible that the last time you saved the report within the report designer, you had a tick against "Printer Environment" (in the Report menu)? If so, untick it.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Mike Lewis has an important point, because even if nothing like a Bullzip update changed the printer name, SET PRINTER TO NAME also doesn't force this printer if the report has its printer environment ticked and uses another printer, which usually is the default printer at time of creating or changing the report.

So in short, if you want to let SET PRINTER TO NAME have effect, your reports must have no printer environment saved to them and you need to ensure the printer name is exactly as used.

Chriss
 
Thank you all for your guidance, which is much appreciated. I am working through these suggestions and will report back. It is taking me a bit of time because of inconsistent behaviour between running the program in my development environment and running it as an exe in an other folder.

I certainly did have problems a couple of years ago when I had a report with the printer environment ticked.

Will report back. Andrew
 
The Printer Environment was indeed the problem. As mentioned I had made the same mistake before.

It was just that on this occasion I had observed the problem in two separate places : one was a general print utility which offers the options of output to screen, printer. Excel or pdf. And the other was a specific form which allows you to 're-print' a sales invoice and email it to a customer. And so I had thought it was a wider change to my system settings.

I wonder if I should include a check in each of these to warn that the report.frx/frt has got that option ticked. Suggestions welcome.

Thank you all very much; I feel I should make a donation to the Rest home for distressed VFP programmers.

Andrew Mozley

 
Glad to hear that you have got it working, Andrew.

I wonder if I should include a check in each of these to warn that the report.frx/frt has got that option ticked.

Sounds like a good idea. But who would you warn? And when? Not at run time, as it's not something within the user's purview. A design-time tool that would look at every FRX in the project and check to see if the setting is ticked? That would be very useful. It must be possible, although off-hand I've no idea how.

I feel I should make a donation to the Rest home for distressed VFP programmers.

Well, speaking as the senior resident of the aforementioned home, I would have to second the motion. (Only kidding.)

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
I’m not sure that you come into the category of distressed or even indigent!

In the matter of checking, I would quite like to do this at runtime (before issuing the REPORT FORM command). I have tried opening the report (.frx/.frt) as a .dbf table, but I cannot see exactly what field (or part of a field) holds that setting.

Had thought that it might be the ‘Environ’ field within the objtype = 1 record, but that doesn’t seem to be it – it doesn’t change even after I have edited the report layout.
 
Andrew,

With nothing else pressing on a dark Scottish afternoon, I thought I would give this a shot. I think I've got it figured out. But I'll start a new thread for this, as it could be of interest to a wider audience.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
I think I also found a way.

VFP offers a few reports on the FRX structure, meaning of the fields, and to make a long report short, for VFP9 reports TAG2 is empty when you untick Save printer environment and non-empty (contins some binary "garbage" I think whatever printer driver is associated can make sense of).

So as it will still be known to many, that you remove what was stored as printer specific information meant to clear the Expre field of an FRXes first record, now applies to TAG2.

Chriss
 
Thanks for that, Chris. I posted my program in thread184-1813473 before I saw your reply. In fact, my program only indicates which report have Printer Environment set and which ones have it clear. It doesn't attempt to change the setting, although that would be easy to do.

In fact, I just remembered that I wrote an article about this back in 2000 (see in which I wrote that to remove the printer settings, you should delete the contents of Expr, Tag and Tag2 (that was before VFP 9.0). Pity I didn't think of that before I wrote the program.

Mike



__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Andrew,

You mentioned that you would like to run this check at run time, but in my opinion the time to do it is just before you build the project. At that point, it is not too late to go back to the report designer and change the setting. There is no point in doing it any later than that, as there would be no chance of the setting getting changed before the user runs the report.

By the way, I think the Environ field relates to the data environment rather than the printer environment. (Not completely sure about that.)

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Thank you Mike

In fact I do not bind the report formats (.frx/.frt) into the built .exe.

The reason is that I allow users to change the layout of their reports. Instead, at installation time, I put them into folder reports, a subfolder of their HOME folder at run-time. They then have another subfolder replocal of their HOME directory, and any reports which they modify (or – more likely – I have modified for them) are placed in replocal.

At run-time both replocal and reports are on the PATH. So if they have customised reports, these are chosen in preference to those in the default reports folder.

But you are right - the usual cause of the problem is that I may have tinkered with one of my standard reports, or failed to uncheck that option in the report designer. So I could have a utility of the sort you have suggested, to check all the report definitions in a folder.
 
There's one more thing to think of if you want to clean up the printer environment. This is an excerpt from a function I use for that purpose:
Code:
	pr_expo=expr
	IF 'ORIENTATION=1'$pr_expo
		pr_expn='ORIENTATION=1' && Laying
	ELSE
		pr_expn='ORIENTATION=0' && Standing
	ENDIF
	IF 'PAPERSIZE=8'$pr_expo
		pr_expn=pr_expn+CHR(13)+CHR(10)+'PAPERSIZE=8' && A3
	ELSE
		pr_expn=pr_expn+CHR(13)+CHR(10)+'PAPERSIZE=9' && A4
	ENDIF
	IF 'COLOR=2'$pr_expo
		pr_expn=pr_expn+CHR(13)+CHR(10)+'COLOR=2' && Color
	ELSE
		pr_expn=pr_expn+CHR(13)+CHR(10)+'COLOR=1' && B/W
	ENDIF
	REPLACE tag  WITH '' ;
	       ,tag2 WITH '' ;
	       ,expr WITH pr_expn
 
Thank you very much Dan.

Your guidance about clearing tag and tag2 in the Type 1 record does the trick, and that appears to clear the checkbox on 'Save Printer environment'. So the user is once again able to send output to the printer - pdf or whatever - that he wants.

Thanks again for your polite and clear guidance. Have a belated star!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top