How to decrease rendered file size

101 views
Skip to first unread message

Shawn

unread,
Jan 31, 2020, 3:25:52 PM1/31/20
to pdfium
Hi,

I use FPDF_RenderPage to print PDF file on Windows platform. It create a much larger rendered data file than Adobe Reader for some files. I use same printer driver (PCL6) for both testing.  

After comparing the rendered data files, it seems the reason is that PDFium render text as basic elements (such as Path, Point and BoundingBox etc) instead of Font as Adobe Reader does. 

Is there a way to configure PDFium rendering text as Font? I noticed there is a "m_pUserFontPaths" in "FPDF_LIBRARY_CONFIG" which can be used to initialize PDFium library. But not sure how to use it. 

By the way, fonts in the testing file include "Arial-BoldMT", "Arial-ItalicMT", ArialMT and Calibri. 

Thanks for any help!



Lei Zhang

unread,
Jan 31, 2020, 3:30:20 PM1/31/20
to Shawn, pdfium
Try turning on the "pdf_use_win32_gdi" GN build option, rebuild, and
then call FPDF_SetPrintTextWithGDI(true) before rendering. The code
probably does not work 100% correctly which is why it's been sitting
in an experimental state.
> --
> You received this message because you are subscribed to the Google Groups "pdfium" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pdfium+un...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/pdfium/98daebd3-60b7-4084-bc30-4cb271912e6a%40googlegroups.com.

Lei Zhang

unread,
Jan 31, 2020, 4:25:36 PM1/31/20
to Shawn, pdfium
I should also mention Windows GDI is very old technology. Given
mainstream Windows 7 support just ended, we are targeting newer
Windows releases that have XPS support. (https://crbug.com/1034053) So
in the long run, the code I mentioned will likely go away.
Reply all
Reply to author
Forward
0 new messages