WYSIWYG Printing

I am not exactly new to XoJo.
I have written a few programs over the years as a hobby that relate to my part-time work as a sound engineer.

My “real” job is as a commercial software developer for a forms processing company. We have a legacy program that was written in a combination of straight C, VB6, and C#. I am thinking about rewriting it using Xojo but I have a few questions.

First, how well does Xojo do WYSIWYG? It is very important to be able to create and print a form exactly as it appears on the screen. I need to be able to measure the distance of some text on the form within a few TWIPS.

Using the Windows RichText Control, I am able to accomplish a lot of what I do using windows messaging. Is that possible in Xojo (if still necessary)?

The next requirement is that I can call a windows DLL. I don’t think that will be a problem. The way it works now, the “real work” is done by our proprietary Windows DLL and that won’t change. The current VB part is used kind of as a wrapper around the DLL along with form creation, database creation, reading and writing data, and reporting

Lastly, the form processing part (much later in the project) creates Microsoft Access databases for data storage. Is that possible in Xojo? I need to be able to create dynamic databases (different db for each form), write the data and query that data to create reports.

The original program took years to write. This is a huge undertaking. I’ll be starting off with a few simple prototypes before I take the plunge.

Thank you in advance for any advice you might have.

-Marty

Printing is a bone of contention on Windows… always has been.
In very general, you can open a printer, and ask it how big the page is, and what the resolution is.
GetStringWidth is the kind of call you can use to establish the size of text.

I personally still use a quite old technique: I create a page-shaped picture and assemble all output on that, but at a greater size than the 72hpi version of the page you get ‘by default’
Then I throw that at the printer.

I find PDF is a more understandable output - you tell it what size the page is,
Dimensions are all in 72dpi, co-ordinates are decimal values.

Switch from Access databases to SQLLite databases - the ability to use these is built in to Xojo and they are easy to use.
You also don’t need Access installed to make your app work.
However, you may find that isnt suitable if ‘reporting’ is using the built in reporting tools from Access

If VB can call your DLL, Xojo can too -( it will be a C DLL as opposed to one with C++ headers)
Build for 32bit though - the DLL may not play nice with a 64bit build.

You can achieve accuracy to a single dot on the printer. Typically 1/300 inch or better on laser printers. But you have to do the math yourself. I have done very complex reports and can display on a canvas for preview, then print the exact same thing on a printer at whatever resolution the printer supports.

Again: it’s not exactly easy, but it is possible. I may have spent 6 months perfecting my printing subsystem.

I first tried to use the xojo report classes, but rapidly found that it is not flexible enough.
so I started my own printing system, with a window class as a superobject
and like Tim, some months later I have a full printing system, to print the way I want.
It’s completely usable, and I still have some possible improvements in mind…
it’s a lot of work, but it’s self-rewarding, and you learn a lot doing like this.

[quote=411602:@Jeff Tullin]
I find PDF is a more understandable output - you tell it what size the page is,
Dimensions are all in 72dpi, co-ordinates are decimal values.[/quote]

Does Xojo support PDF Files natively or do you use the PDF Printer in Windows? Third party?

[quote=411602:@Jeff Tullin]
Switch from Access databases to SQLLite databases - the ability to use these is built in to Xojo and they are easy to use.
You also don’t need Access installed to make your app work.[/quote]
I’m not sure if switching is an option. Some customers use the data directly. The current version does not require that Access is be installed, but it does require MDAC for the Jet Engine.

Thank you all for your replies.

No

I personally use DynaPDFMBS plugin.
But for your purposes, you can easily use a lighterweight system, such as this one: (others are available)

http://www.rdS.com/gpdf/index.html

Thanks, Tim but how do you determine the printer’s supported resolution. The printer object in Xojo returns 72 X 72, doesn’t it?
Does Xojo support using a Handle to a Device Context to replicate the printer’s metrics elsewhere?

Thanks in advance

The only “printing” I do these days is by creating PDFs… In a web app they can be displayed in browsers and in a desktop simply launched (as long as a PDF viewer is installed, and who does not?)

I use the PDF classes provided in the Einhugur plug in pack… The PDF capabilities are no where near as extensive as DynaPDF , but they meet my needs and IMO the price (And renewal price!) is very good for what you get.

The other plugins provide a LOT useful functionality. Off the top my head they include common controls that should be but are not included in Xojo, extensive encryption capabilities , compression , barcode production and reading, the ability to create and read excel spreadsheets without excel (not as extensive a libPDF but again meets my needs), lots of picture processing stuff and some other things.

You hear more about Monkeybread plugins here… IMO while there is some overlap overall and Monkeybread has more functionality in it’s complete set, much of that tends to be at lower abstraction level than I am comfortable with and I don’t need.

I find Einhugur meets my key needs, for me in general is easier to use, and is cheaper for me given what I actually use.

  • karen

[quote=411803:@Martin America]Thanks, Tim but how do you determine the printer’s supported resolution. The printer object in Xojo returns 72 X 72, doesn’t it?
Does Xojo support using a Handle to a Device Context to replicate the printer’s metrics elsewhere?

Thanks in advance[/quote]
While printing was somewhat broken for a few releases, afaik it’s working again. You get the resolution in the printersetup and the graphics object is dimensioned larger or smaller based on the resolution. But I haven’t tried it on the latest release. For a variety of reasons, I am still using an older version.

Using the RichText Control with VB6, I can call FormatRange with a printer’s Device Context and print documents as good as Microsoft Word. To say my first attempt at printing with Xojo is a disappointment would be an understatement.

Anything other than printing to a default printer in Xojo is terrible at the moment. I would shudder if I had to implement a program that required a good set of printing features.

All I can suggest is going here <https://xojo.com/issue/51559>, watching the video and add this to your feedback Top Cases and hope its implemented sooner rather than later. Its currently ranked 71st. If this can climb the ranks is might be looked at seriously.

As for getting the DPI of the target printer I made a post about it here. I don’t know if its been changed, fixed or implemented recently as I only tend to get involved in printing if someone has a problem with it so I’ve not got a working project to test things.

All I can say regarding printing in Windows is good luck :slight_smile:

I’ll second this opinion.

My app does a huge amount of printing, and beginning in 2017 Xojo changed their Windows printing implementation. As of 2018R3 most of it now works, but printing anywhere within the printable area on the page is really tough because using the Page Setup dialog to get the page info returns the area determined by the margins the user inputs into that dialog, when what’s needed is the complete page, as it does on the Mac.

Sometime in the next few months, I am going to have to find a way around this problem, so far I haven’t found a solution - even when using MBS plugins. I may have to dig into Windows declares…:frowning:

Maybe Paul should do a webinar on how to do printing properly? After how many webinars isn’t it time to tackle some of the real issues that people have? Maybe Greg or Joe would like to do one?

Well, for WYSIWYG printing, it is possible on xojo 2016r4.1. For Xojo 2017 and on, they broke the printing framework.

Reports are a joke on any version.

For Access you can use the native ODBC, or The MBS Xojo SQL Plugin.

I was just thinking the same thing as I was navigating to this thread to see if anyone had replied. I do find some of the webinars useful but I think they are geared more toward the beginners. They are a good review but they never seem to tackle the more advanced topics. Maybe they figure the seasoned programmer will figure it out for themselves. At this point, I’m glad I asked before diving in. Maybe I should stick with C#. It’s a great language too.

@Martin America The best I have seen in WYSIWYG editing (there is no printing involved) is “custom-editfield” by Thomas Tempelmann, who is a well known developper for Xojo. It is also surprisingly fast. I think that transposing it to printing should not be too difficult.

It’s 21st now, a few more points and it’ll break into the top 20. Nice.

Here we go… 18th.

here we go bis : rank 14th

12th now. Hopefully they can get this fixed soon!