Solved

Media Object Graphic Size in Report Designer

  • 15 January 2021
  • 6 replies
  • 564 views

Userlevel 5
Badge +11

When I add a dynamic media object into the table cell in RepeatPage, the graphic size always stays at its original size.
Does anyone have an idea?

<table-body>
<data>/tns:DENER_SATIS_TEKLIF_FORMU_REP_REQUEST/tns:DENER_SATIS_TEKLIF_FORMU_REP/tns:LINES1/tns:LINE/tns:TECHNICAL_MEDIAS1/tns:TECHNICAL_MEDIA</data>
<table-row>
<properties>
<keep-together>auto</keep-together>
<keep-with-next>auto</keep-with-next>
<keep-with-previous>auto</keep-with-previous>
</properties>
<table-cell>
<properties>
<hyphenate>true</hyphenate>
<number-columns-spanned>1</number-columns-spanned>
<text-align>center</text-align>
</properties>
</table-cell>
<table-cell>
<properties>
<display-align>center</display-align>
<text-align>center</text-align>
</properties>
<external-graphic>
<properties>
<_default-logotype>true</_default-logotype>
<_explicit-path>true</_explicit-path>
<dynamic_image_on_DB>true</dynamic_image_on_DB>
<fallback_path>/tns:DENER_SATIS_TEKLIF_FORMU_REP_REQUEST/tns:PROCESSING_INFO/tns:PROCESSING_ATTRIBUTES/tns:DEFAULT_LOGOTYPE</fallback_path>
<file_extension>gif</file_extension>
<height>1cm</height>
<image_bind_variable>tns:ITEM_ID</image_bind_variable>
<image_sql_stm>select media_object from media_item_tab where item_id = :1</image_sql_stm>
<keep_aspect_ratio>true</keep_aspect_ratio>
<left>0cm</left>
<runtime_path>/tns:DENER_SATIS_TEKLIF_FORMU_REP_REQUEST/tns:DENER_SATIS_TEKLIF_FORMU_REP_ARCHIVE_VARIABLES/tns:VARIABLE[tns:NAME='rhSysLogo']/tns:VALUE</runtime_path>
<runtime_path_DB>vldtimg:getDBImageAndPath($designtime_path,$designmode,'select media_object from media_item_tab where item_id = :1',tns:ITEM_ID,'','','','')</runtime_path_DB>
<src>DENER/DENER_SATIS_TEKLIF_FORMU_REP/img.png</src>
<top>0pt</top>
<width>1cm</width>
</properties>
</external-graphic>
</table-cell>
<table-cell>
</table-cell>
</table-row>
</table-body>

Have a nice day!

icon

Best answer by ChanakaAmarasekara 18 January 2021, 12:17

View original

This topic has been closed for comments

6 replies

Userlevel 7
Badge +15

Hi,

 

If you insert an image to a table cell then it will insert the image while keeping it aspect ratio. It till be the original image size. 

If you want a smaller image then resize the row height or cell width or resize the original image.

Regards,

Chanaka

Userlevel 5
Badge +11

Hi @ChanakaAmarasekara,

 

Thanks for the answer. But it didn’t solve my problem.

When I create a nested table, I can change the graphic aspect ratio as much as the width of the corresponding cell.

 

How do you think I can stretch the graphic width or height?

 

Userlevel 7
Badge +15

You need to work with the cell width and the row height. For example, if the width is  greater than the height it will keep the aspect ratio according to the height.

Userlevel 5
Badge +11

@ChanakaAmarasekara  Can you explain with an example?

Userlevel 7
Badge +15

This is the IFS logo image that you get in the Report Designer Tool. This is a square image and when you increase or decrease the cell width the cell/row height is increased/decreased automatically. You can see this in the design time as well.

This is a rectangular image and only increasing the cell width. The height is auto increased to keep the aspect ratio.

The example for static images on disk.

 

For images fetched from the database, it will take the original image size that is stored on the database. This is because you just add a place holder image at design time in the layout. So there is no way to tell which exact size you want at runtime when the PDF is generated. In your case you might want it to be smaller, but in some other case they might want it to be the exact side. Therefore the original size is taken. So the image in the database needs to be correct in that scenario.

Hope this helps to clear out things.

 

 

 

 

Userlevel 5
Badge +11

Hi @ChanakaAmarasekara 

It was definitely the answer which I was looking for. Thanks..

For images fetched from the database, it will take the original image size that is stored on the database. This is because you just add a place holder image at design time in the layout. So there is no way to tell which exact size you want at runtime when the PDF is generated. In your case you might want it to be smaller, but in some other case they might want it to be the exact side. Therefore the original size is taken. So the image in the database needs to be correct in that scenario.

 

Kind regards.