Tuesday, June 21, 2016

EDM Module - Changing Background Color in the Alfresco Previewer

By default, the Alfresco previewer uses a white background to display an AutoCAD drawing.

Unfortunately, this makes lighter colors very difficult to see (like yellow, which seems to be a very common color in AutoCAD).  By adding a parameter to the conversion script, we can change the way the drawing is displayed in the Alfresco previewer.

EDM Module 2.x (for Alfresco 4.x)
Edit the [ALF_HOME]/formtek/edm_module/bin/cad2pdf.sh script to make the following change:

${dwg_exename} -i=${sourcename} -o=${targetname}.png -f=png -extents=true -Q -rsz=${edm_resolution} -last -b=0

Use 0 for black, 1 for white (default), and 2 for gray.  Note that this doesn't actually change the background color of the original drawing; it only adds a solid rectangle of the desired color at the base of the previewer, and then renders the rest of the drawing on top of the colored rectangle.

EDM Module 3.x (for Alfresco 5.x)
The vector PDF format used to render AutoCAD drawings in EDM Module 3.x doesn't support a background color the way the raster PDF format does in EDM Module 2.x.  The drawing will be rendered in all of its colors on a white background.  However, a "-mono" switch can be used to render all all layer colors as black instead, which can result in a more-readable drawing.  This setting can be made inside the [ALF_HOME]/formtek/edm_module/bin/edm-cad2pdf.bat script as follows:

%dwg_exename% -i=%sourcename% -o%targetname% -f=pdf -basic -mono -axpath="%ax2011Dir%ax2011.exe"

This may end up being added as a setting in the UI inside the EDM Module at some point, but we can make the setting at the script level for now.

No comments:

Post a Comment