Saving a report's output to high definition graphics files(s)

Hi all,

instead of printing I want to create high definition graphics from a report output to save them on disk. This should then be printed via a shell command (in linux) to circumvent the need of displaying PageSetup Dialogs every time. But no matter what I do I only get files with the current screen resolution of 72 dpi and a size of w559x H783 points. Here’s the code I put together until now:

Dim ps As New PrinterSetup If rpt.Run(rs, ps) Then If rpt.Document <> Nil Then Dim saveFolder As FolderItem saveFolder = SpecialFolder.Temporary If saveFolder <> Nil Then Dim saveFile As FolderItem For i As Integer = 1 To rpt.Document.PageCount saveFile = saveFolder.Child("MyReport" + Str(i) + ".png") rpt.Document.Page(i).Save(saveFile, Picture.SaveAsPNG) Next // output the file to printer via shell command Var s As Shell s = New Shell s.Execute("lp /" + saveFolder.Name + "/" + saveFile.Name) If s.ErrorCode <> 0 Then MessageBox("Error code: " + s.ErrorCode.ToString) End If End If End If End If

It saves and prints the file but the output is rather bad because of its low resolution.

Has anybody got a hint for me?

Cheers
Harvey

Hi Heinrich,

this is a known bug for years. Sadly Xojo hasn’t spent any love to their report engine for over a decade. Pray that we will get something better, wenn they refresh their UI next year. You probably can use BKeeney Shorts.

There is a feedback ticket for this bug. Since I’m on the road right now, I can’t look it up.

Maybe change the printer resolution (Vertical and Horizontal) to 300 (300 dpi) ?

Check the Language Refrence for the details.

@Martin: this is rather discouraging (again). Thanks for the information. BKeeney Shorts seems to an alternative but we are a non-profit organization in health business and there is simply no (more) cash for things like this (which should be possible OOTB as far as I think).
Edit: BKeeney Shorts is not available for Linux :stuck_out_tongue:
@Emile: Thanks for your input (again) :wink:
Believe me, I already tried a lot in this direction. It is all about not displaying any printer dialogs to the user. And displaying the dialog and letting the user choose the printer (ever and ever again) seems to be the only way to get a graphics object with higher resolution :frowning:
And I read the Docs more than once. There are faults in the online docs and the Printing and Reporting Examples don’t even run.

You can use DynaPDF’s graphics integration in our DynaPDFMBS class in MBS Xojo DynaPDF Plugin to make a PDF for the report. Then you can render the PDF to any resolution needed.

Is your DynaPDFMBS class FREE for the non-profit organization?

I don’t know the details.
But we can always offer academic or non profit discounts.

agree, without the use of the PageSetup popup the default is 72dpi and it can not change by using the settings string :frowning:
i had add a new feedback with example project.

[quote=490191:@Emile Schwarz][code]Var s As String
Var pageSetup As PrinterSetup
pageSetup = New PrinterSetup

pageSetup.MaximumHorizontalResolution = 300
pageSetup.MaximumVerticalResolution = 300[/code][/quote]
it not help, its still lowres. 2019r3.1 win desktop.

Try with 2018r3

You can save the PrinterSetup.Settings string the first time around and reuse it for later printing. That way, you only display the printer dialog the first time.

(Not tested on Linux)

[quote=490200:@Tim Hare]You can save the PrinterSetup.Settings string the first time around and reuse it for later printing. That way, you only display the printer dialog the first time.

(Not tested on Linux)[/quote]
it does not work in 2019r3.1, the
page save is 72dpi.

What is the Feedback # ?

This is all about Linux - and it’s a no go still. I’ve submitted the simplest demo project possible, but this will end up in the same realm as other, important Linux issues.

[quote=490202:@Markus Rauch]@Tim Hare You can save the PrinterSetup.Settings string the first time around and reuse it for later printing. That way, you only display the printer dialog the first time.

(Not tested on Linux)

it does not work in 2019r3.1, the
page save is 72dpi.[/quote]

Try on 2018

@Emile: MaximumHorizontalResolution and MaximumVerticalResolution have no influence on the actual settings, its only a maximum that will not be exceeded.

@Ivan and markus: PrinterSetup.Settings does not work on linux - and never has (at least as long as I use Xojo - which is for some time now…). Even the online docs say so :frowning:

Linux seems to be very low priority - and it has been the cause why I choose Xojo/RB in first place…

your issue with image output i had also at windows 10.

As it seems, Tim already did. Tim? Do you have the feedback number at hand?

I don’t quite understand. PDF is not builtin but rather a printer itself so we hit the same problem there.

AFAIK, NO !

The user have to select a PDF virtual printer before been able to generate the PDF file.

And, this is an OS built in feature (in macOS for many years, in Windows 8/8.1 ?, 10, and I do not know the Linux status, sorry).

I mean Printing to PDF, not generate a PDF; the later have to be implemented by Xojo (this is different even if in the end, a pdf file will be created).

Yes, I know. But… the whole thread is about avoiding the printer setup dialogs on each and every print (see my very first posting). And printing to pdf does not make a difference here, it displays the same dialogs :frowning:
Meanwhile I have tested to circumvent this by saving the printer setup and graphics files generated by PageSetupDialog() and OpenPrinterDialog() to global Vars for later reuse during runtime. But this holds the print until the app is closed - no idea why.

If I wouldn’t be bold I had lost my hair until now :wink: