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

Notification

Icon
Error

Options
Go to last post Go to first unread
ju1989  
#1 Posted : Friday, December 7, 2018 7:26:43 AM(UTC)
ju1989

Rank: Member

Groups: Registered
Joined: 6/1/2016(UTC)
Posts: 28
Germany
Location: Hessen

Thanks: 2 times
Was thanked: 1 time(s) in 1 post(s)
Hi,

we found an issue with the latest pdfium version (this issue was not present in an earlier version of pdfium).

By rendering the first page of the attached document it makes a different if I iterate through the PageObjects of the first page.

I use the following code for rendering:

Code:

internal static byte[] BildRendern(byte[] document, bool check)
{
	int targetWidth = 453;
	int targetHeight = 640;

	var doc = PdfDocument.Load(document);
	using (var page = doc.Pages[0])
	{
		if (check)
		{
			var list = page.PageObjects.Where(x => x is PdfImageObject).ToList();
		}
		using (MemoryStream bitmapStream = new MemoryStream())
		{
			using (var bitmap = new Bitmap(targetWidth, targetHeight))
			{
				using (var g = Graphics.FromImage(bitmap))
				{
					g.FillRectangle(new System.Drawing.SolidBrush(System.Drawing.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();
			}
		}
	}
}


If you call the method with check=false the image is rendered correctly. If you call it with check=true the image is rendered with the white black boxes.
You can see it in the attached image (left side with check=false, right side with check=true).

white_black_boxes.png (153kb) downloaded 2 time(s).

Do you have any idea?

Best regards
Julian


Document.pdf (115kb) downloaded 1 time(s).
Paul Rayman  
#2 Posted : Tuesday, December 11, 2018 2:59:04 AM(UTC)
Paul Rayman

Rank: Administration

Groups: Administrators
Joined: 1/5/2016(UTC)
Posts: 1,138

Thanks: 10 times
Was thanked: 133 time(s) in 130 post(s)
Thank you for bug report.
We will fix this issue in the next release
Paul Rayman  
#3 Posted : Sunday, December 16, 2018 2:48:16 AM(UTC)
Paul Rayman

Rank: Administration

Groups: Administrators
Joined: 1/5/2016(UTC)
Posts: 1,138

Thanks: 10 times
Was thanked: 133 time(s) in 130 post(s)
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.