Without looking into code, I assume that the PDF is created as pixel image.
So a DXF file describes each entity with few lines of ASCII code. But the PDF will depend on the form factor of the drawing. The bigger the drawing in the sense of absolute dimensions, the bigger the PDF will be.
Armin
investing less than half an hour into Search function can save hours or days of waiting for a solution