English 中文(简体)
iTextSharp中的缩放图像
原标题:scaling images in iTextSharp

I m having some trouble scaling an image that i am inserting. I must be doing something wrong, because it does not change at all, no matter what i do. This is the code i have at the moment, but it does not seem to work. The image gets inserted fine, it just doesn t scale, no matter what values i try.

Any obvious things i am doing wrong? Any common things that people do wrong? I am working in C#, but i assume the syntax is the same (more or less) in all languages.

    Image imgSpine = Image.GetInstance(strSpine);
    imgSpine.ScaleAbsolute(2, 55);
    SpineCell.Image = imgSpine;

    SpineCell.Image.Border = Rectangle.NO_BORDER;
    SpineCell.VerticalAlignment = Element.ALIGN_TOP;
    SpineCell.HorizontalAlignment = Element.ALIGN_LEFT;

    pTable.AddCell(SpineCell);
最佳回答

查看单元格。图像总是按比例缩放以适应单元格。您需要将图像包装在或一些类似的元素中,该元素将包含图像

<code>调用.Image</code>属性也总是写入PdfPTable中的<code>PdfPTable.TEXTCANVAS</code〕画布,因此您无法控制Z顺序。

选项:

  1. Wrap the image in a Chunk instead.
  2. Use a Cell Event handler and draw the image yourself.

数字1可能更容易

问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签