Patagames Software Support Forum
»
Pdfium.Net SDK
»
Common Questions
»
Page-Rendering: Font isn't as slim as in Adobe Acrobat Reader
Rank: Member
Groups: Registered
Joined: 6/1/2016(UTC) Posts: 28  Location: Hessen Thanks: 2 times Was thanked: 1 time(s) in 1 post(s)
|
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 34 time(s). Document.pdf (106kb) downloaded 25 time(s). Screenshot_Adobe.bmp (2,204kb) downloaded 29 time(s).
|
|
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 1/5/2016(UTC) Posts: 1,138
Thanks: 10 times Was thanked: 133 time(s) in 130 post(s)
|
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.
|
|
|
|
|
|
Rank: Member
Groups: Registered
Joined: 6/1/2016(UTC) Posts: 28  Location: Hessen Thanks: 2 times Was thanked: 1 time(s) in 1 post(s)
|
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).
|
|
|
|
|
|
Rank: Member
Groups: Registered
Joined: 6/1/2016(UTC) Posts: 28  Location: Hessen Thanks: 2 times Was thanked: 1 time(s) in 1 post(s)
|
|
|
|
|
|
|
Patagames Software Support Forum
»
Pdfium.Net SDK
»
Common Questions
»
Page-Rendering: Font isn't as slim as in Adobe Acrobat Reader
Forum Jump
You can post new topics in this forum.
You can reply to topics in this forum.
You can delete your posts in this forum.
You can edit your posts in this forum.
You cannot create polls in this forum.
You can vote in polls in this forum.
Important Information:
The Patagames Software Support Forum uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close