Dynamics AX 2009报告中的图像显示问题保存为pdf

时间:2012-07-09 18:49:11

标签: pdf dynamics-ax-2009

当我将原生Dynamics AX 2009报告保存为pdf或pdf-embed时,它不会正确显示报告中的图像,即标题部分中的公司徽标。图像变得非常扭曲,灰暗且重复。

另一方面,如果我以HTML格式导出图像,图像就会正常显示。 有没有人遇到类似的问题。

请注意,我使用报告打印对话框打开时出现的“文件”选项将报告保存为pdf。

任何帮助都将受到高度赞赏。

2 个答案:

答案 0 :(得分:0)

Issue will go if the image format used is one of the following
1. 24bit Bitmap
2. TIFF

答案 1 :(得分:0)

我在AX 2009中找到了解决此问题的解决方案:

Bitmap getImageBitmap(ItemId _itemId)
{
    HPLInventImages inventImages; // Column HPLInventImages.ItemImage is EDT:BlobData (which is a container)
    Image image;
    ;

    if (!_itemId) return inventImages.ItemImage; // Return null bitmap. The whole AX client crashes if you try to do the resizing code below on a null bitmap.

    select firstonly inventImages where inventImages.ItemId==_itemId;
    //return inventImages.ItemImage; // Would normally just do this, but see comments below.

    // Ok, this next bit is weird!
    // There is a known issue with AX reports with images in, getting saved as PDFs:
    // In some cases, the images appear as garbage on the PDF.
    // I have found that resizing the image before rendering it, causes the image to come out ok on the PDF.
    // So the code below does a token resize (by 1.0 times!) operation on the image before returning it.
    // That is enough to make the image on the PDF turn out ok.
    image=new Image(inventImages.ItemImage);
    image.resize(image.width()*1.0,image.height()*1.0,InterpolationMode::InterpolationModeHighQuality);
    return image.getData();
}