logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Post a reply
From:
Message:

Maximum number of characters in each post is: 32767
Bold Italic Underline   Highlight Quote Choose Language for Syntax Highlighting Insert Image Insert an existing Attachment or upload a new File... Create Link   Unordered List Ordered List   Left Justify Center Justify Right Justify   Outdent Indent   More BBCode Tags
Font Color Font Size
Security Image:
Enter The Letters From The Security Image:
  Preview Post Cancel

Last 10 Posts (In reverse order)
Paul Rayman Posted: Sunday, January 5, 2020 2:16:41 AM(UTC)
 
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.
Bazi Posted: Saturday, January 4, 2020 9:19:51 AM(UTC)
 
Yes, i see. From there is my code.
But the result is very bad.
Paul Rayman Posted: Thursday, December 26, 2019 12:11:33 AM(UTC)
 
Bazi Posted: Sunday, December 22, 2019 1:08:14 PM(UTC)
 
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