![]() I know that I want my thicker border to be 1cm from the borders of an A4 page. ![]() ![]() Using the PDFPageFormatter will be trial by error until you become familiar with page coordinates and positioning. You should really have an idea of the page layout in your head and a great practice is to write down on a piece of paper the layout and dimensions of all the elements. The top two branches are creating a border for the PDF, a thicker lighter blue line, and a couple of millimetres inside this a thinner darker blue line representing the blues in the IMGS logo. Let’s step through some of the workspace. This workspace (Fig 1) creates a PDF with two borders, an image taken as a screenshot from Google Earth to show the location of IMGS’ office, a title, and information below the image relating to IMGS. All we need now is the FME Workspace… as shown below. If you have followed the instructions and are still getting errors, shoot me a message at now have everything we need to handle creating multiple page PDF’s through Python. > from pyPdf import PdfFileWriter, PdfFileReader Enter the following (the chevrons already exist after hitting enter on each line). Click OK and OK again.ĩ) Open up IDLE (the default Python development application) to display a new Python Shell so we can test if the third party libraries and the fmeobjects have been installed and correct for use. Remember to add a semi-colon ( ) after the last entry before pasting in the path. Copy this directory path and return to the Environment Variables… Add this path into PYTHONPATH in the System variables section. This is usually in C:\apps\FME2015\fmeobjects\python27. That’s our third party Python libraries installed, we will test that these installations worked after we set up Python to work with FME objects.Ĩ) Find where fmeobjects.pyd resides on your machine. PyPDF will enable us to create a new PDF and add pages from existing PDF documents. Click OK and OK again.ħ) Next, return to the Command Prompt, enter and run pip install pypdf Click into Environment Variables… and in the System variables section scroll down to Path, highlight Path and click Edit… button, place a semi-colon ( ) after the last entry and paste in the directory path. This can be done from the Start Menu, right click on Computer and select Properties, from the left hand panel choose Advanced System Setting. Should be somewhere like C:\Program Files (x86)\wkhtmltopdf\bin – copy this directory path.Ħ) Open up your Environment Variables window. ĭownload and run (I installed 32bit windows).ĥ) Open up Windows Explorer and navigate to where the installation occurred. Pdfkit will allow us to convert a webpage into a PDF page.Ĥ) In order to be able to utilize pdfkit we also need to download an executable file called wkhtmltopdf.exe from. Pip will allow us to easily install the rest of the necessary libraries.ģ) From the Command Prompt enter and run pip install pdfkit Let’s first get everything in order starting with the necessary Python libraries.ġ) If you do not have pip installed go to and right click on the get-pip.py file and Save link as…, save to a directory.Ģ) Open up the Command Prompt and change the current working directory to the directory where you saved get-pip.py. We will also add pages from a couple of other sources to make it a multipage PDF. A Python script will be used to run an FME workspace and use the output as a page in our final PDF. There is a current limitation that this new transformer can only output single paged PDFs so below we will examine using Python as an Open Source solution. ![]() Hi all, this post will explore using the new PDFPageFormatter transformer available in FME 2015. Author: Glen Bambrick, IMGS Applications Engineer ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |