Truncating pages with large width

33 views
Skip to first unread message

Dmitry Goryachev

unread,
Apr 26, 2021, 4:26:28 PM4/26/21
to pdfium
Hi all,
We got a large PDF file with a page width of ~141 inches. PDFium renders this page fine at up to 200dpi. With a resolution of 250 or more, PDFium crops the image to the right.

Are there some limitations on image size or something like that? Or is it a bug?

I made a simple PDF with the same dimensions and reproduce this issue with the following test:

  EXPECT_TRUE(EmbedderTest::OpenDocument("problem.pdf"));
 
  FPDF_PAGE page = EmbedderTest::LoadPage(0);
  ASSERT_TRUE(page);
 
  int resolution = 300;
  int width = static_cast<int>(FPDF_GetPageWidthF(page) / 72 * resolution);
  int height = static_cast<int>(FPDF_GetPageHeightF(page) / 72 * resolution);

  int alpha = FPDFPage_HasTransparency(page) ? 1 : 0;
  ScopedFPDFBitmap bitmap(FPDFBitmap_Create(width, height, alpha));
  FPDF_DWORD fill_color = alpha ? 0x00000000 : 0xFFFFFFFF;
  FPDFBitmap_FillRect(bitmap.get(), 0, 0, width, height, fill_color);
  FPDF_RenderPageBitmap(bitmap.get(), page, 0, 0, width, height, 0, 0);
  FPDF_FFLDraw(nullptr, bitmap.get(), page, 0, 0, width, height, 0, 0);

  WriteBitmapToPng(bitmap.get(), "300dpi.png");
problem.pdf
300dpi.png
Reply all
Reply to author
Forward
0 new messages