1. Robbie Bible
  2. PowerBuilder
  3. Wednesday, 14 July 2021 20:00 PM UTC

For a long time, we've used a third party tool (ImagN from Pegasus Software) to view and print images within our application.  We're dealing with a lot of low quality images and it helps tremendously with strong support for different ways to enlarge an image (standard zoom, zoom to a selected area, magnify).  It also provides a way to easily move an image around the view port as well as a rather unique way to print images that uses PowerBuilder's own Print functions allowing us to print multiple images to the same print job.

The vendor has closed shop, so no upgrade is available.  I don't believe PowerBuilder's Picture or InkPicture objects will be adequate replacements, so we are looking for a solution that would provide the same capabilities described above.

I've looked at the documentation for "Image Viewer CP ActiveX Control", and it doesn't appear to support printing to an open print job.

Is anyone aware of a product suitable for this?

 

Toan Nguyen Accepted Answer Pending Moderation
  1. Tuesday, 16 May 2023 01:46 AM UTC
  2. PowerBuilder
  3. # 1

Hello Everyone,

In my PB2017R3 application, we have a picture window and need to support image rotation. I was able to get Roland Smith's canvas application and migrated to PB2017.

I copied the instant variables and function prototypes for GDIPLUS.DLL to my window.

However, I received errors when trying to save the window object due to Illegal data type errors.

I was able to fix the illegal data type: RECT error by using 'str_rect' in place of RECT. 

I don't know how to fix the errors for other illegal data types like GDIplusStartupInput, GDIplusStartupOutput. str_rectf,

ImageCodecInfo, etc.

I attached the screenshot to show the error.

Am I missing an .h file or some file?

I can run Roland's canvas application after migrating it to PB2017R3 with no issue.

I appreciate any helps from anyone from the community.

Thanks in advance,

Tony

 

Attachments (1)
Comment
  1. Roland Smith
  2. Tuesday, 16 May 2023 12:42 PM UTC
RECT is a structure imbedded in u_canvas. The others are in u_cst_picture.

Why are you copying code into a window? It would be better to just copy my objects into a library and place u_cst_picture on the window.
  1. Helpful
  1. Sivaprakash BKR
  2. Wednesday, 17 May 2023 04:29 AM UTC
If you could try PB 2022, PDFbuilder could be one option. I think you can open and write as many dws to the pdf file and close it.

  1. Helpful
There are no comments made yet.
Robbie Bible Accepted Answer Pending Moderation
  1. Tuesday, 20 July 2021 13:54 PM UTC
  2. PowerBuilder
  3. # 2

As Roland Smith mentioned, his Canvas app uses GDI Plus Windows API functions.  Specifically for printing, it uses CreateDC() to open a print job.  While this returns an unsigned long just like PowerBuilder's PrintOpen() and for the same purpose, the two don't seem to be interchangeable.  I can't, for example, print a datawindow to the job opened by CreateDC() and I can't use WinAPI to print to a job opened by PrintOpen().

Besides just printing an image, we need to print a datawindow followed by multiple images within the same print job.

Has anyone had any success getting PowerBuilder's print system to play nicely with these Windows APIs or otherwise accomplishing the requirement in the previous sentence?

Comment
  1. Miguel Leeuwe
  2. Tuesday, 20 July 2021 14:30 PM UTC
For the print part, would it be possible to get everything on a PDF and then print the PDF? You'll probably have to use some kind of pdf library and or .Net DLL.

Just a suggestion.
  1. Helpful
  1. Robbie Bible
  2. Tuesday, 20 July 2021 14:57 PM UTC
I appreciate the suggestion, but I think we'd still need to be able to print dw & images to the same print job, assuming the PDF is produced by a print driver. I've considered printing each to separate PDFs and then combining those into one large PDF. I'm just trying to avoid as much as possible multiple steps like that, especially involving different toolkits. The more moving parts in the implementation, the more likely there will be at least occasional issues in production.
  1. Helpful
  1. Miguel Leeuwe
  2. Tuesday, 20 July 2021 16:45 PM UTC
Hi Robbie, my suggestion was exactly what you already thought about. Produce one single (end)pdf file which holds all you need.

good luck!
  1. Helpful
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Friday, 16 July 2021 14:42 PM UTC
  2. PowerBuilder
  3. # 3

I have a free example app that can display and print most types of images:

https://www.topwizprogramming.com/freecode_canvas.html

It makes use of GDI Plus Windows API functions. It has Zoom, Rotate and Fit functions as well.

Comment
  1. Robbie Bible
  2. Monday, 19 July 2021 15:53 PM UTC
Wow! Thanks Roland. I think this is going to be tremendously helpful. With just a few minor changes, I've got this working under PowerBuilder 2019 R3. From this point forward, maintaining this tool should be easier since the VM is pbvm.dll without any version indication in the filename.
  1. Helpful
  1. Roland Smith
  2. Monday, 19 July 2021 16:45 PM UTC
Glad you pointed that out, I have to update all my examples that refer to the PBVM.
  1. Helpful
  1. Roland Smith
  2. Monday, 19 July 2021 19:54 PM UTC
I updated Canvas and have tested with PB 2019 GA, PB 2019-R3, and PB 2021. All the other examples that use PBVM were already updated.
  1. Helpful
There are no comments made yet.
Bruce Armstrong Accepted Answer Pending Moderation
  1. Thursday, 15 July 2021 18:56 PM UTC
  2. PowerBuilder
  3. # 4

I did a code sample a while back showing how to wrap visual .Net control for use in PowerBuilder.  The particular code I used for the demo displays TIFF files:

https://blogs.sap.com/2014/04/12/how-to-use-net-visual-controls-in-powerbuilder-classic/

You've have to extend it to add the print capability.

 

Comment
  1. Robbie Bible
  2. Friday, 16 July 2021 14:32 PM UTC
Thanks Bruce, I'll definitely consider this route.
  1. Helpful
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Thursday, 15 July 2021 15:17 PM UTC
  2. PowerBuilder
  3. # 5

In powerbuilder 10.5.2 the richtext edit control allowed to import a TIFF picture using the InsertPicture() function.

Current versions (2019 R3), regretfully no longer seem to support the TIFF format (according to the PB help file at least).

Not sure if that would have been a partial solution anyway.

regards.

Comment
  1. Robbie Bible
  2. Thursday, 15 July 2021 15:53 PM UTC
I've tried displaying a TIFF using PB 2013 R3 and instead of the image rendering, I just got a blank space where the image should be.
  1. Helpful
  1. Miguel Leeuwe
  2. Thursday, 15 July 2021 15:56 PM UTC
hmm so it didn't even give you an error. I don't know what was wrong with the older RTE. They were so much better than the current versions.

regards.
  1. Helpful
  1. Miguel Leeuwe
  2. Thursday, 15 July 2021 15:58 PM UTC
My suggestion would be to see if there's any open source C# controls you might be able to wrap as an activeX and use that in powerbuilder. (or work with the one Chris suggested, but I understood that it doesn't support TIFF? maybe you could first convert TIFF to some other format?).

regards.
  1. Helpful
There are no comments made yet.
Robbie Bible Accepted Answer Pending Moderation
  1. Thursday, 15 July 2021 14:41 PM UTC
  2. PowerBuilder
  3. # 6

Chris,

I would love a solution built entirely with native PB controls, and I've experimented with this, but it does appear to meet our requirements.  Right off the bat, we need to support TIFF images in addition to other common image formats such as JPEG and PNG, but PB does not seem to support TIFF.  While the datawindow's zoom feature is cool, we're really looking for something more than a simple zoom.  It also seems that printing would require some finagling to get even close to a viable solution.

Comment
  1. Chris Pollach @Appeon
  2. Thursday, 15 July 2021 18:30 PM UTC
Hi Robbie;

Yes, I had he same issue with TIFFs on a previous project but used ImageMagicK to convert them to JPEG's "on the fly" for viewing and if modified, used the the new JPEG binary back into the Blob column or, I could convert the JPEG back to TIFF again if required - again, using ImageMagicK.

Regards ... Chris
  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 14 July 2021 20:11 PM UTC
  2. PowerBuilder
  3. # 7

Hi Robbie;

   FWIW:  Over the past decade I have built / retrofitted these type of Apps to use either:

  • Picture Control       // And/Or
  • Ink Control           //  And/OR
  • Image Data Window (TableBlob) // And/or
  • Ink DataWindow

I love the DWO's for this as all the content (ie: Images) are then are "Zoom-able"!    ;-)

As far as Image manipulation, I typically use the free open source ImageMagick software (or its super fast cousin GraphicsMagick). I just call it via the RUN() command although, they do have an ActiveX as well. Food for thought.

http://en.wikipedia.org/wiki/ImageMagick

HTH

Regards ... Chris

 

Comment
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.