Link to home
Start Free TrialLog in
Avatar of Shailesh Shinde
Shailesh ShindeFlag for India

asked on

Formatting and layout in word or pdf

Hi All,

We have an requirement to adjust formatting and layout (like., fonts, line breaks in table, columns and margins) of word or PDF files using any script [Perl, Python or Ruby].

Can you please suggest or provide any references or sample codes for this or suggest which scripting languages will be good for such requirements.

Avatar of Walter Ritzel
Walter Ritzel
Flag of Brazil image

The best starting point I know is this:
It uses python and give pointers to python libraries that can handle PDF and word documents.
Why are you scripting vs. applying a theme that sets all that on the fly? Just curious. With security restrictions becoming more prevalent, I would think that scripting might not work well everywhere.
Avatar of Shailesh Shinde


Hi Colleen Kayter,

The reason for scripting is to include this script in existing automated processing workflow.
This script will read the config file which will contains
and manipulate the input source word or pdf files.

Hi All,

Can formatting be applied to the text level and the page level to a specific paragraph, a set of paragraphs, a range of pages. Is this possible using perl or python scripts?

Avatar of Colleen Kayter
Colleen Kayter
Flag of United States of America image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial

Waiting for coder experts comments.

This looks at things from a PHP perspective, so it may or may not fit your environment, but since PHP is free and open-source it could be worth considering.

PHP has two well-supported libraries for building PDF documents: FPDF and TCPDF.  Both are self-contained object-oriented libraries.  The documentation is pretty good. and they have online examples.  I have never used them to import and adjust pre-existing PDF files, but some others in the E-E forums claim this can be done.  Most of my work has been to take external inputs (forms, databases, API data) and build PDF documents.  For this kind of work, either of the extensions will work well, giving you access to a variety of fonts, colors, layouts, and image placements.