Skip to main content
Question

Outputting individual Excel row and jpg image to an individual PDF report


amgaad
Contributor
Forum|alt.badge.img+3

Hi All,

I have an xls spreadsheet, lots of rows, each row is an individual record with various data in each column.

I also have a folder of jpgs, each jpg named to match 1 value in a column.

I am looking to produce a single pdf for each xls row and its associated photo.

I am still learning my way around FME but I've tried an Excel Reader and Jpeg Reader joined by jpg filename/column attribute, then put into PDFPageformatter then fanned out by joined attribute but for the life of me I can't work out why the xls does not show on the PDF, just blank. Photo will show though.

Am I missing a step? Would really appreciate any advice?

Many thanks in advance,

Amgaad

15 replies

itay
Supporter
Forum|alt.badge.img+17
  • Supporter
  • November 24, 2016

Hi @amgaad, have a look at the PDFStyler transformer and possibly aggregating the xls data into one feature per column before writing to PDF.

Hope this helps.


amgaad
Contributor
Forum|alt.badge.img+3
  • Author
  • Contributor
  • November 24, 2016
itay wrote:

Hi @amgaad, have a look at the PDFStyler transformer and possibly aggregating the xls data into one feature per column before writing to PDF.

Hope this helps.

 

Thanks a lot @itay will take a look!

Forum|alt.badge.img+2
  • November 24, 2016

This article is a good starting point for creating PDF output. Not quite what you're trying to accomplish, but it should illustrate all the pieces you need.


amgaad
Contributor
Forum|alt.badge.img+3
  • Author
  • Contributor
  • November 25, 2016
markatsafe wrote:

This article is a good starting point for creating PDF output. Not quite what you're trying to accomplish, but it should illustrate all the pieces you need.

Thanks a lot @MarkAtSafe

 


amgaad
Contributor
Forum|alt.badge.img+3
  • Author
  • Contributor
  • November 28, 2016

@MarkAtSafe @itay - I have managed to create a simple workspace that will create 3 separate pdfs based on 3 jpegs and 3 xls rows. However when I try to add a border (as explained in the other guides) it goes wrong. I can do 3 pdfs with a border or 3 pdfs with the relevant image but I just cant get the border to show correctly at the same time. The jpeg appears ok but the border appears as a tiny square in the top 3rd of the pdf. Would you have any thoughts what I might be doing wrong? Many thanks!


itay
Supporter
Forum|alt.badge.img+17
  • Supporter
  • November 28, 2016
amgaad wrote:

@MarkAtSafe @itay - I have managed to create a simple workspace that will create 3 separate pdfs based on 3 jpegs and 3 xls rows. However when I try to add a border (as explained in the other guides) it goes wrong. I can do 3 pdfs with a border or 3 pdfs with the relevant image but I just cant get the border to show correctly at the same time. The jpeg appears ok but the border appears as a tiny square in the top 3rd of the pdf. Would you have any thoughts what I might be doing wrong? Many thanks!

Hi @amgaad

 

 

If I understand you correctly you are getting only 1 border feature, while there should be 3.

 

 

If you dont need the border as a separate layer in your output, you can rasterize it into the jpeg with the MapnikRasterizer.

 

This hould be done for each jpeg you are sending to the output.

 

hope this helps

amgaad
Contributor
Forum|alt.badge.img+3
  • Author
  • Contributor
  • November 28, 2016
itay wrote:
Hi @amgaad

 

 

If I understand you correctly you are getting only 1 border feature, while there should be 3.

 

 

If you dont need the border as a separate layer in your output, you can rasterize it into the jpeg with the MapnikRasterizer.

 

This hould be done for each jpeg you are sending to the output.

 

hope this helps
@itay thanks a lot for your reply! apologies I worded it badly. I'm actually after a border around the whole A4, with the jpg set smaller inside (controlled by the pdfpageformatter). If I don't aggregate the jpeg, and show just border, it fits perfectly (2nd image). But if I also try to show the jpegs too the border suddenly become really small (1st image).

capture2.jpg

 


gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • December 1, 2016

Counter on your fotos

Boundingboxreplacer to create bound. Place as separate layer in pdfformatter.

set pdf_page_number = count.

Will be variable size of course.

For fixed border on A4 pdf

pdf-picture-per-page-writer-with-border.png

see pic


gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • December 1, 2016

Of course I can just upload the fmw...

pdf-border-to-fotos.fmw


gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • December 1, 2016

For single pdf per photo, don't use the page number in the attribute creator, leave it to pdf_page_number =1


amgaad
Contributor
Forum|alt.badge.img+3
  • Author
  • Contributor
  • December 2, 2016
gio wrote:

For single pdf per photo, don't use the page number in the attribute creator, leave it to pdf_page_number =1

@gio

 

thanks a lot for taking the time to reply gio. I was looking into a long winded way of possibly using mapnik rasterizer to create one raster with all the borders and jpeg combined. But will give your solution a go!!!

amgaad
Contributor
Forum|alt.badge.img+3
  • Author
  • Contributor
  • December 2, 2016
gio wrote:

Of course I can just upload the fmw...

pdf-border-to-fotos.fmw

@gio Really appreciate you putting the workspace on. Unfortunately I get an error when I try and download. Many thanks

itay
Supporter
Forum|alt.badge.img+17
  • Supporter
  • December 2, 2016
amgaad wrote:
@itay thanks a lot for your reply! apologies I worded it badly. I'm actually after a border around the whole A4, with the jpg set smaller inside (controlled by the pdfpageformatter). If I don't aggregate the jpeg, and show just border, it fits perfectly (2nd image). But if I also try to show the jpegs too the border suddenly become really small (1st image).

capture2.jpg

 

Hi @amgaad

 

 

The link provided by Mark shows how a pdf can be created using multiple layers, you can download the FME template (fmwt at the bottom) and edit it to your needs.

 

 

A modification when working with rasters (images) you can better use the fme_basename for fan out and not the fme_feature_type

 

 

Hope this helps.

 


gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • December 2, 2016

@amgaad

Hi

I made some correction to the affiner and scaler to get picture to fill page.

I'll try publish workspace again.

If upload don't work, i'll include pic of workspace.


amgaad
Contributor
Forum|alt.badge.img+3
  • Author
  • Contributor
  • December 7, 2016
gio wrote:

@amgaad

Hi

I made some correction to the affiner and scaler to get picture to fill page.

I'll try publish workspace again.

If upload don't work, i'll include pic of workspace.

Thanks a lot @gio and all. Thanks a lot for you workflow. I used your work flow, with the PDFpageformatter controlling the photo to appear in 1 quarter of the A4. I then featuremerged (value of 1, created by AttributeCreator) the xls data to various Creators (A4 border and other smaller borders too on the PDF) so every xls row has a border. For the xls I've used the PDFstyler and TextAdder to show the individual row data. On the jpeg workflow I added one extra attribute, fme_basename but renamed the attribute to match xls column that contains the photo name. I then fanned out the pdf writer by the xls column. So from the original xls and jpegs I now have a separate pdf for each row with its associated data and photo.

 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings