Skip to main content

Is there a way to set the justification of text in a PDF writer? I can't find anything in the PDFStyler transformer or any Format Attribute in the writer to control this and this article doesn't mention PDF. https://knowledge.safe.com/articles/16546/text-justification.html

The text feature class I'm reading from has the text justified as center, center, but when I write to PDF it shows up as top, right in relation to the anchor point.

In GIS:

In PDF:

Any one have any ideas?

Hi @drc43

Unfortunately, the PDF2D is not currently a format that supports text justification. This enhancement request is tracked internally as FMEENGINE-38098.

As mentioned in this text justification article, FME ignores text justification and displays text as lower-left.

There are several workarounds for this issue. Is it a requirement that text features stay as vectors or would rasters be OK?


Hi @drc43

Unfortunately, the PDF2D is not currently a format that supports text justification. This enhancement request is tracked internally as FMEENGINE-38098.

As mentioned in this text justification article, FME ignores text justification and displays text as lower-left.

There are several workarounds for this issue. Is it a requirement that text features stay as vectors or would rasters be OK?

Thanks for your reply Debbi. I think raster would be okay, but I'm not sure. My process starts with a user parameter that affects the scale of each PDF map, so I think I will need a way to scale the text appropriately. I feel like that would be easier as vector, but I'm interested in your opinion.


Thanks for your reply Debbi. I think raster would be okay, but I'm not sure. My process starts with a user parameter that affects the scale of each PDF map, so I think I will need a way to scale the text appropriately. I feel like that would be easier as vector, but I'm interested in your opinion.

My apologies, I had meant to type "text features stay as text or would vectors be OK?" as one of the workaround is to stroke the text to polygons.

I have attached a template workspace that demonstrates both these approaches. I would recommend changing the settings of the transformers in the bookmarks and the PDFStyler (for the text features) to see how the two approaches affect the output PDF annotationtoparcelcentre.fmwt

Pros of the text approach includes: output file size is smaller than the vectorising the text while cons include less control over the placement with different font sizes.

Pros of the vector approach are greater control over the placement of the text regardless of font size but cons include larger file size and slightly less legibility when zoomed out.


My apologies, I had meant to type "text features stay as text or would vectors be OK?" as one of the workaround is to stroke the text to polygons.

I have attached a template workspace that demonstrates both these approaches. I would recommend changing the settings of the transformers in the bookmarks and the PDFStyler (for the text features) to see how the two approaches affect the output PDF annotationtoparcelcentre.fmwt

Pros of the text approach includes: output file size is smaller than the vectorising the text while cons include less control over the placement with different font sizes.

Pros of the vector approach are greater control over the placement of the text regardless of font size but cons include larger file size and slightly less legibility when zoomed out.

Hi Debbi, I'm guessing your workspace is version 2019. We are still on 2018.1 (BUILD 18528), so when I open your workspace it is dropping a lot of the transformers. Would you be able to down save it to 2018.1 for me?


Hi Debbi, I'm guessing your workspace is version 2019. We are still on 2018.1 (BUILD 18528), so when I open your workspace it is dropping a lot of the transformers. Would you be able to down save it to 2018.1 for me?

The following workspace was created in FME 2018.1. AnnotationToParcelCentre_18520.fmwt

Please note there was a bug in 2018 with GDB annotations which was fixed for 2019. There is an extra transformer in the 2018 version which provides a workaround for the bug.


The following workspace was created in FME 2018.1. AnnotationToParcelCentre_18520.fmwt

Please note there was a bug in 2018 with GDB annotations which was fixed for 2019. There is an extra transformer in the 2018 version which provides a workaround for the bug.

Hi @debbiatsafe

I have been trying the text stroking method that you suggested and have been able to achieve good results in tests with my data. However, I am having trouble replicating those results in the workspace I wanted to use this for. The weird thing is when inspecting the data prior to the PDF writer, it looks great, but when it gets written out, it is hardly legible.

PDFPageFormatter Inspector:

PDF Writer:

I'm really at a loss with this, as I have been able to write to PDF with my test data and it looks great.

PDF Test Writer:

 

Any ideas on what's going on here? Could other layers in the PDF writer be affecting the text output? Any direction you could provide would be most appreciated.


Hi @debbiatsafe

I have been trying the text stroking method that you suggested and have been able to achieve good results in tests with my data. However, I am having trouble replicating those results in the workspace I wanted to use this for. The weird thing is when inspecting the data prior to the PDF writer, it looks great, but when it gets written out, it is hardly legible.

PDFPageFormatter Inspector:

PDF Writer:

I'm really at a loss with this, as I have been able to write to PDF with my test data and it looks great.

PDF Test Writer:

 

Any ideas on what's going on here? Could other layers in the PDF writer be affecting the text output? Any direction you could provide would be most appreciated.

Hi @drc43

What are your parameters for styling lines within the PDFStyler?

 

Based on the screenshots, it appears the Line width may be a potential cause of the issue you're seeing. Could you please try setting the line width parameter to be lower?

Hi @drc43

What are your parameters for styling lines within the PDFStyler?

 

Based on the screenshots, it appears the Line width may be a potential cause of the issue you're seeing. Could you please try setting the line width parameter to be lower?

I just got back to looking at this @debbiatsafe. You are so right, when I lowered the line width parameter in the PDFStyler, that fixed the issue. Things are looking good here now. Thank you so much.


Reply