xsharp.eu • ReportPro 2.x .NET (X# version): PDF creation in non-interactive mode
Page 1 of 1

ReportPro 2.x .NET (X# version): PDF creation in non-interactive mode

Posted: Tue Apr 13, 2021 12:43 pm
by Bernhard Mayer
Dear fellow X#'ers!

Currently ReportPro 2x needs at least two environmental prerequisites to get to work: A VO based owner as well as a default printer.

Do you think it might be possible to change the printing process for the creation of PDFs so that both prerequisites are no longer required?

The problem is that we are using more and more "background" tasks for our applications which create RP PDFs, and sometimes there are errors when creating handles in non-interactive sessions where we don't have an idea how to get rid of them although the user accounts launching the tasks ought to have default printer settings as well as enough privileges to create VO windows.

Best regards,
Bernhard

ReportPro 2.x .NET (X# version): PDF creation in non-interactive mode

Posted: Wed Apr 14, 2021 7:16 am
by robert
Bernhard,
I am really not sure if this can be done without owner and printer.

For the owner you could probably create a "fake" object. We are already wrapping the owner object in a RpReportOwner object inside the PtrDevice class for performance issues (so we can cache method info ).
One place where the owner is used is for the Progress Dialog. But we could probably suppress that when no owner is specified.

The printerdevice is a different thing. The whole printing in Rp2 is done through the PtrDevice object. This object gets the default printer and reads the paper bin names etc.
- this object also allocates the device context that is used for the printing, preview and export
- this device context is passed to all objects in the report
- the output is then saved page by page to a meta file
- after that the meta file is "played" and the preview or export pages are created from the info in the meta file.

In theory we could skip the step of the meta file and directly produce the PDF but that would require a major change.
I do not see that happen in the near future.

Robert

ReportPro 2.x .NET (X# version): PDF creation in non-interactive mode

Posted: Wed Apr 14, 2021 7:36 am
by Bernhard Mayer
Hi Robert!

Thank you for the information resp. for the confirmation of my thoughts that it cannot be done easily as the question originally did come from some colleagues of mine (and I said 'no' :-)).
Meanwhile I got kind of familiar with the RP source code to a certain degree but there's always the chance that I miss something.

BR,
Bernhard