Keeping line and text together on report

19 views
Skip to first unread message

Jørn Berget

unread,
Feb 26, 2025, 2:42:41 AMFeb 26
to Migrated By Firefly

Hi,

We have a report where we are printing out items. For each item there might be some additional RTF-text. We want to have the item-line and the text on the same page, and we need to find out if there is enough space to print both. If there is not enough space, we put in a page break.

In Magic we printed the RTF-text to NULL and got the length of the text. We could then decide to print the item-line and text if there’s enough space, or if we needed to put in a page break first.

This is still working, but the print is slow when there are many lines.

Is there another solution to this?

 

Profiler when checking the length of the text:

ProfilerWithCheck.jpg

 

Profiler without checking the length of the text:

ProfilerWithoutCheck.jpg

 

And here’s how we are defining the PrintWriter:

public ENV.Printing.PrinterWriter CreateNewPriterWriter(string name, bool randomFile, Bool landscape = null, string filepath = null, Shared.Theme.Printing.ReportSection header = null, Shared.Theme.Printing.ReportSection footer = null)

{

            var p = new ENV.Printing.PrinterWriter()

            {

                Name = u.MlsTrans(name),

                PrinterName = randomFile

                                    ? null

                                    : ProM.Shared.Printing.Printers.Printer1.PrinterName

                Landscape = landscape == null ? false : (bool)landscape,

                Copies = hAntallEksemplarer,

                PrintDialog = !randomFile && !hEgendefValgt && hSkriveutEpostLagre == "S" && hVisUtskriftsdialog && !hForhaandsvisning && u.Counter(1) == 1,

                PrintPreview = hForhaandsvisning && hSkriveutEpostLagre == "S" && !randomFile,

                TotalPagesPlaceholderToken = "!TotalPages",

                Pdf = u.IniGet("[Pro-M]UseStandardPDF").Left(1) != "N" && (hSkriveutEpostLagre != "S" || randomFile),

                FileName = Filename(),

                PageHeader = header,

                PageFooter = footer,

            };

}

 

Regards

Jørn Berget

 

Jørn Berget

unread,
Feb 26, 2025, 3:25:13 AMFeb 26
to Migrated By Firefly
Hi again,

Forget this message. 

The reason was that the PrinterWriter was created for each count, and the print used ENV.Printing.PrinterWriter.FindIOByName. 
When using ENV.Printing.PrinterWriter.FindIOByName when checking the length of the text, the time was redused to 68ms.

Jørn

Reply all
Reply to author
Forward
0 new messages