page won't fit in A4 (itextsharp dll used)
-
Hy everyone! I used the itextsharp dll http://itextsharp.sourceforge.net/examples/Chap0607.cs ccomponent to add images to a pdf document. In default it uses the squar format for the page. I didn't change this, but no matter which size i choose the pic to be or which parameter I try to use to set the location where the pic is located at, there is a white strip on top of the page. is there a chance to use 100% of the page? my code is
Document document = new Document(PageSize.A4.Rotate());
try
{
PdfWriter.GetInstance(document, new FileStream(outputPath, FileMode.Create));
document.Open();
for (int i = 0; i < list.Count; i++)
{
iTextSharp.text.Image img = iTextSharp.text.Image.GetInstance(list[i]);
// Querformat
if (img.Width >= img.Height)
{
img.Alignment = iTextSharp.text.Image.MIDDLE_ALIGN;
//img.Alignment = iTextSharp.text.Image.ALIGN_TOP;
img.RotationDegrees = 0f;
}
// Hochformat
else
{
img.Alignment = iTextSharp.text.Image.MIDDLE_ALIGN;
//img.Alignment = iTextSharp.text.Image.ALIGN_TOP;
img.RotationDegrees = 270;
}
//img.ScaleToFit(624.5f, 462);
//img.ScaleToFit(687, 508);
//img.ScaleToFit(720, 534);
img.ScaleToFit(855, 550);
document.Add(img);
//Add a new Page for net next image
document.NewPage();
}
// document.Close();
}
catch (System.Exception EX)
{
logger.Error(EX.ToString());
}
finally
{
document.Close();
}is there a chance to fit the pic into the page to use the whole size, so to get rid of the white strip on top (compareable to the orange bar on top to the rest of this page here)? thanks! stephan.