|
|
PDF is a vector format, so there is usually no problem scaling part of a page. In your case, I guess you have a scanned image (bitmap) in your document, so scaling it leads to a loss of quality.
|
|
|
Yes, i see. From there is my code. But the result is very bad.
|
|
|
Hi there, I am trying to create an image section from a PDF. This is my code used on VB.Net: Code:Friend Function TakeShapshot(ByVal Page As Patagames.Pdf.Net.PdfPage, ByVal Rect As RectangleF) As Image
Dim leftTop As PointF = Rect.Location
Dim rightBottom As PointF = New PointF(Rect.Location.X + Rect.Width, Rect.Top - Rect.Height)
Dim k As Double = width / (rightBottom.X - leftTop.X)
Dim height As Integer = CInt(((leftTop.Y - rightBottom.Y) * k))
Using bmp = New Patagames.Pdf.Net.PdfBitmap(width, height, True)
bmp.FillRect(0, 0, bmp.Width, bmp.Height, Patagames.Pdf.FS_COLOR.White)
Dim devX, devY As Integer
Page.PageToDevice(0, 0, CInt((Page.Width * k)), CInt((Page.Height * k)), Patagames.Pdf.Enums.PageRotate.Normal, leftTop.X, leftTop.Y, devX, devY)
Page.Render(bmp, -devX, -devY, CInt((Page.Width * k)), CInt((Page.Height * k)), Patagames.Pdf.Enums.PageRotate.Normal, Patagames.Pdf.Enums.RenderFlags.FPDF_LCD_TEXT)
Return New Bitmap(bmp.Image)
End Using
End Function
However, the result is disappointing, the image quality is very poor. What can I optimize for a better result? Best regards Christian
|