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)
ju1989 Posted: Thursday, March 8, 2018 2:35:30 AM(UTC)
 
any further ideas?
ju1989 Posted: Thursday, February 15, 2018 11:49:08 PM(UTC)
 
I think the Problem isn't scaling or the size. The difference is if I have a Image PDF (like a scanned document) than there is no difference to Adobe Acrobat Reader. There is only the difference when we have a vector PDF (like created with word).

The Size is calculated like you said.

Quote:
targetWidth = page.Width / 72.0 * dpi.X;
targetHeight = page.Height / 72.0 * dpi.Y;


I only add some scaling between 0.5 and 4.0 in steps of 0.1.

I compare the output of the rendered Image with Adobe Acrobat with same page size (scale).
Paul Rayman Posted: Thursday, February 15, 2018 6:54:57 AM(UTC)
 
Your images has different size.
If you scale the Adobe screenshot to size of rendered image, then you will see that there is no any differences.

By the way, how are you calculating targetWidth and targetHeight?
If you want to get actual size of the page (to compare it with actual size from AdobeReader) you should use the following formula

targetWidth = page.Width / 72.0 * dpi.X;
targetHeight = page.Height / 72.0 * dpi.Y;

where dpi is a current dpi of your desktop.
ju1989 Posted: Thursday, February 15, 2018 6:05:22 AM(UTC)
 
Hi,

I have an issue by rendering pages.
If I compare the image rendered by the Code below with the page presented by Adobe Acrobat Reader, there is a huge gap. In Adobe Arcobat Reader the font is slimmer than in the rendered Image.

Attached is a sample document, a screenshot from the document opened in Adobe Arcobat Reader and the rendered image.


Code:

using (MemoryStream bitmapStream = new MemoryStream())
{
	using (var bitmap = new Bitmap(targetWidth, targetHeight))
	{
		using (var g = Graphics.FromImage(bitmap))
		{
			g.FillRectangle(new Color.White, 0, 0, targetWidth, targetHeight);
			using (var pdfBitmap = new PdfBitmap(targetWidth, targetHeight, true))
			{
				page.Render(pdfBitmap, 0, 0, targetWidth, targetHeight, PageRotate.Normal, RenderFlags.FPDF_ANNOT);
				g.DrawImageUnscaled(pdfBitmap.Image, 0, 0);
			}
		}
		bitmap.Save(bitmapStream, ImageFormat.Bmp);
		return bitmapStream.ToArray();
	}
}


Do you have any information how I can fix it?

Best regards



Rendered_Image.bmp (3,305kb) downloaded 33 time(s). Document.pdf (106kb) downloaded 25 time(s). Screenshot_Adobe.bmp (2,204kb) downloaded 28 time(s).