My code
document.PageSettings.Orientation = PdfPageOrientation.Landscape;
PdfPage page = document.Pages.Add();
PdfGraphics graphics = page.Graphics;
PdfBitmap image = new PdfBitmap(ImageFilenames[i]);
float ftImageWidth;
float ftImageHeight;
float ftPageWidth;
float ftPageHeight;
float.TryParse(image.Width.ToString(), out ftImageWidth);
float.TryParse(image.Height.ToString(), out ftImageHeight);
ftPageWidth = page.Graphics.ClientSize.Width;
ftPageHeight = page.Graphics.ClientSize.Height;
float myWidth = image.Width;
float myHeight = image.Height;
float shrinkFactor=1.3f;
if (myWidth > ftPageWidth)
{
shrinkFactor = myWidth / ftPageWidth;
myWidth = ftPageWidth;
myHeight = myHeight / shrinkFactor;
}
if (myHeight > ftPageHeight)
{
shrinkFactor = myHeight / ftPageHeight;
myHeight = ftPageHeight;
myWidth = myWidth / shrinkFactor;
}
graphics.DrawImage(image, (ftPageWidth - myWidth) / 2, (ftPageHeight - myHeight) / 2, myWidth, myHeight);
//graphics. = image.Width * 0.3f;
//float height = image.Height * 0.3f;
PdfTextWebLink textLink = new PdfTextWebLink();
string[] nameGesplittet = Path.GetFileNameWithoutExtension(ImageFilenames[i]).Split('#');
if (nameGesplittet.Length > 1)
{
graphics.DrawString(Path.GetFileNameWithoutExtension(ImageFilenames[i]), font, PdfBrushes.Red, new PointF(0, 35));
textLink.Url = "https://www.google.cz/search?hl=en&site=imghp&tbm=isch&source=hp&q=" + nameGesplittet[1].Trim();
textLink.Text = "Google Suche(cz)";
textLink.Font = font;
textLink.DrawTextWebLink(page, new PointF(0, 65));
textLink.Url = "https://translate.google.com/#de/cs/" + nameGesplittet[0].Trim();
textLink.Text = "Google translate(deutsch)";
textLink.Font = font;
textLink.DrawTextWebLink(page, new PointF(0, 95));
textLink.Url = "https://translate.google.com/#cs/de/" + nameGesplittet[1].Trim();
textLink.Text = "Google translate(tschechisch)";
textLink.Font = font;
textLink.DrawTextWebLink(page, new PointF(0, 125));
}
#endregion
Console.WriteLine((i + 1) + ": " + Path.GetFileName(ImageFilenames[i]));
GC.Collect();
Attachment:
links_d936d861.7z