1. Teegala Rajesh
  2. PowerBuilder
  3. Wednesday, 18 October 2023 11:56 AM UTC

Hi All,

We have more than 200 psr files and need to generate pdf based out of them using datastore, Along with this we have a scenario where we need to merge 2 psr’s for each pdf (i.e. 100 pdf files to be created out of 200 psr’s).

we are storing these psr files in datastores. Previously we used Print function using ‘Amyuni PDF convertor’ to print pdf documents,as we have merge and save features available in PB now, we wanted to remove the dependency of external printer but this is causing a performance degradation.

Old  implementation: ds_merge.Print (False, False)(i.e. ds_merge is Datastore)

New implementation: ds_print.save(“D:\save_3A.pdf”) (i.e. ds_print is  PDFDocument)

We also tried the multi-threading to implement, it did not give us proper result.

Below are the links we tried:

A Multi-Threaded Data Retrieval Example - Appeon Community

https://community.appeon.com/index.php/articles-blogs/tutorials-articles/2-powerbuilder/339-free-my-gui-multi-threading-in-powerbuilder

Is there any possibility for processing this files in parallelly, so this can help us in increasing the performance.

Please suggest the best approach on this.

Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 18 October 2023 15:28 PM UTC
  2. PowerBuilder
  3. # 1

Hi Teegala ;

  The 3rd party tool that PB uses "under the hood" to drive the NativePDF feature basically cancels the performance efficiency of the SaveAs (PDF) feature in a multi-threaded App as it now behave more like "single threaded".

   I would suggest creating a batch PB App that takes two PSR file names as arguments. Then produces a PDF from those using a DataStore approach. The use the new PDF Builder in PB 2022 R2 to "stitch" the two PDF's together as required would be a key feature to use here (IMHO):  https://docs.appeon.com/pb/whats_new/PDF_Builder_enhancements.html

   Once the above batch PSR => PDF batch App EXE is ready, I would create another "Controller" PB App that uses the Run() command to call the batch PSR processing app passing a list of the PSR's to combine into one PDF. This technique should allow each batch App EXE to "bind" to a processor based on the O/S's decision. Thus, you can now have say for example 6 batch App exe's working simultaneously on 12 PSR's very efficiently as each batch App would have their own NativePDF internal thread working with them as well.

  The final "icing on he cake" for this architecture would be to replace the PB Run() command with a Run&Wait approach as in this free code: https://www.topwizprogramming.com/freecode_runandwait.html

   This would now allow the "Controller" App to monitor the sub-Apps and start a new one once a pair of PSR's were converted. Thus in fact, your controller App would now have a "governor" type capability as to the number of batch PSR Apps running at any time underneath it.

Food for thought.  HTH

Regards ... Chris

Comment
  1. Teegala Rajesh
  2. Thursday, 14 December 2023 09:57 AM UTC
Thanks Chris,

We tried the approach, it helped us. Thanks for your suggestion.
  1. Helpful
  1. Chris Pollach @Appeon
  2. Thursday, 14 December 2023 13:35 PM UTC
Hi Teegala;

I am super glad that this approach worked for you ... You are most welcome!

Regards ... Chris
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.