TIPS Poor outgoing PDF fax quality with Hylafx/Avantfax.

RoboLord

Member
Joined
Aug 18, 2017
Messages
43
Reaction score
4
Location
Oregon
Hey there- I managed to get faxing setup on my new Incredible PBX for Rasbian install. I have a Comcast business ISP and am using VoIP.ms for SIP Trunking. My initial testing faxes are unfortunately of such poor quality that I don't think I will be able to use this system as is. I'm curious what steps I can take to improve the quality?

This image shows the original PDF from my scanner:


This is the PDF that was sent from Hylafax to my eFax account. As you can see, it's almost unreadable. Please note that we receive faxes at this number that are usually much better quality so I don't believe it's on the receiving end.


Here's an incoming fax sent the opposite direction, from eFax to Hylafax. As you can see the image quality is much higher.


So the question is, is this a setting in Hylafax that's causing the degradation? Is it a problem with my ISP or VoIP.ms? What can I do to fix it? Thanks!
 

dicko

Still learning but earning
Joined
Oct 30, 2015
Messages
678
Reaction score
252
Check that you have a VRes = 196 in your hfaxd.conf it would (unnecessarily, it it will negotiate that with the far end) try to force 196 dpi, but if efax is only sending standard resolution then you are hosed.
 

RoboLord

Member
Joined
Aug 18, 2017
Messages
43
Reaction score
4
Location
Oregon
Check that you have a VRes = 196 in your hfaxd.conf it would (unnecessarily, it it will negotiate that with the far end) try to force 196 dpi, but if efax is only sending standard resolution then you are hosed.
Any ideas where hfax.conf would be located in my Raspbian install? It's not shown in the "Config Edit" menu in Incredible/FreePBX. Also, just to be clear, the fax coming from eFax to my PBX/Hylafax looks pretty good. It's the outgoing from Hylafax that is unreadable. I'm unclear what eFax's sending dpi would have to do with it. Thanks!
 

dicko

Still learning but earning
Joined
Oct 30, 2015
Messages
678
Reaction score
252
Any ideas where hfax.conf would be located in my Raspbian install? It's not shown in the "Config Edit" menu in Incredible/FreePBX. Also, just to be clear, the fax coming from eFax to my PBX/Hylafax looks pretty good. It's the outgoing from Hylafax that is unreadable. I'm unclear what eFax's sending dpi would have to do with it. Thanks!


apt-get install -y locate; updatedb;locate hfax.conf

But for ,whatever reason your fax is only being received at 98 VRes that's why it looks like that sendfax accepts arguments of -l (low 98) -m (medium 196) and -G (the highest resolution both machines can use), further to that the log files in /var/spool/hylafax/log/c* should fully identify the negotiated resolution af any particular fax.
 
  • Like
Reactions: RoboLord

RoboLord

Member
Joined
Aug 18, 2017
Messages
43
Reaction score
4
Location
Oregon
I located the HylaFax folder in /etc/hylafax
There was no hfax.conf but I did find sendfax.conf

I found a post on a different forum that suggested I add this to sendfax.conf
Code:
VRes:        196.
It's a shame this option isn't exposed in the AvantFAX gui.


I don't know much about what I'm seeing in those logs but I did notice a couple differences before and after making the change.

Before:
Code:
Nov 29 10:18:19.61: [ 5343]: REMOTE best rate 14400 bit/s
Nov 29 10:18:19.61: [ 5343]: REMOTE max A4 page width (215 mm)
Nov 29 10:18:19.61: [ 5343]: REMOTE max unlimited page length
Nov 29 10:18:19.61: [ 5343]: REMOTE best vres R16 x 15.4 line/mm
Nov 29 10:18:19.61: [ 5343]: REMOTE format support: MH, MR
Nov 29 10:18:19.61: [ 5343]: REMOTE best 0 ms/scanline
Nov 29 10:18:19.61: [ 5343]: USE 14400 bit/s
Nov 29 10:18:19.61: [ 5343]: SEND file "docq/cover2;c0"
Nov 29 10:18:19.61: [ 5343]: USE A4 page width (215 mm)
Nov 29 10:18:19.61: [ 5343]: USE unlimited page length
Nov 29 10:18:19.61: [ 5343]: USE 3.85 line/mm
Nov 29 10:18:19.61: [ 5343]: USE 2-D MR
Nov 29 10:18:19.61: [ 5343]: USE 0 ms/scanline
Nov 29 10:18:19.61: [ 5343]: SEND training at v.17 14400 bit/s

Nov 29 10:18:37.73: [ 5343]: SEND file "docq/doc3.pdf;c0"
After:
Code:
Nov 29 14:39:27.90: [ 9341]: REMOTE best rate 14400 bit/s
Nov 29 14:39:27.90: [ 9341]: REMOTE max A4 page width (215 mm)
Nov 29 14:39:27.90: [ 9341]: REMOTE max unlimited page length
Nov 29 14:39:27.90: [ 9341]: REMOTE best vres R16 x 15.4 line/mm
Nov 29 14:39:27.90: [ 9341]: REMOTE format support: MH, MR
Nov 29 14:39:27.90: [ 9341]: REMOTE best 0 ms/scanline
Nov 29 14:39:27.90: [ 9341]: USE 14400 bit/s
Nov 29 14:39:27.90: [ 9341]: SEND file "docq/cover4;c1"
Nov 29 14:39:27.90: [ 9341]: USE A4 page width (215 mm)
Nov 29 14:39:27.90: [ 9341]: USE unlimited page length
Nov 29 14:39:27.90: [ 9341]: USE 7.7 line/mm
Nov 29 14:39:27.90: [ 9341]: USE 2-D MR
Nov 29 14:39:27.90: [ 9341]: USE 0 ms/scanline
Nov 29 14:39:27.90: [ 9341]: SEND training at v.17 14400 bit/s

Nov 29 14:39:51.10: [ 9341]: SEND file "docq/doc7.pdf;c1"
You'll see that it changed from to 3.85 to 7.7 line/mm
Also, "docq/doc3.pdf;c0" changed to "docq/doc7.pdf;c1"

I assume the c1 indicates a higher res.
Here's the result: it's far better than the previous sent image but still not as good as the incoming one (both were 7.7 line/mm


Are there any other changes I can make to improve the quality of the conversion? Thanks!
 

dicko

Still learning but earning
Joined
Oct 30, 2015
Messages
678
Reaction score
252
If you don't correct your . . . . /includes/local_config.php to use letter , timestamps etc, to reflect your locale then you will continue to need ghostscript to translate A4 to letter and wonder why David Mimms is stupid enough to use European conventions, you could add -G to your sendfax args but there is no guarantee that it will be honored becazuse the"far end" actually said

REMOTE best vres R16 x 15.4 line/mm

but you decided to

USE 7.7 line/mm

you said

VRes: 196.

it should technically be

VRes:/t196

don't add things (.) and use tab not spaces between the key and the value
 
Last edited:
  • Like
Reactions: RoboLord

RoboLord

Member
Joined
Aug 18, 2017
Messages
43
Reaction score
4
Location
Oregon
Thanks for the pointers. I checked out /includes/local_config.php and it was pre-set to letter, not A4 so that's good.
A couple more questions--
Where would I put the "-G" if I wanted to send at highest quality settings?
Is send fax.conf the correct place to put "VRes:/t196" or is there a better location? I read about creating "/var/spool/hylafax/etc/FaxModify"
 

dicko

Still learning but earning
Joined
Oct 30, 2015
Messages
678
Reaction score
252
I apologize for the typo

/usr/lib/fax/hfaxd.conf (or whatever locate reports, I use hylafax+ , you might not)

is where you would do that

for the -G , I suggest you could edit

..../.../includes/functions.php:
 

dicko

Still learning but earning
Joined
Oct 30, 2015
Messages
678
Reaction score
252
Because it is more functional/dynamic, because it is guided by a human and because I'm a little left of center :) .
 

RoboLord

Member
Joined
Aug 18, 2017
Messages
43
Reaction score
4
Location
Oregon
I apologize for the typo

/usr/lib/fax/hfaxd.conf (or whatever locate reports, I use hylafax+ , you might not)
My HylaFax install (non-+ version) does not have a hfaxd.conf file anywhere in the system. In any event, I think I got it working with the weird tab spaced config line I added to /etc/sendfax.conf

Ultimately, it turns out the real problem I'm having appears to be coming from the dithering settings when converting documents from color/grayscale to duotone in Ghostscript. I discovered this by scanning a document directly to duotone and faxing it at 196dpi. It looks fantastic. Now I'm curious if it's possible for me to fix the dithering issue in case someone in the office tries to send something that's not pre-converted to duotone. I found references to adding a line "DITHERING=libtiff-fs" to "/var/spool/hylafax/etc/FaxModify", however, it appears this is a Hylafax Enterprise only option. I poked around for quite a while trying to find any place to tinker with the Ghostscript settings, to no avail. Any ideas what can be done and where to find it? Thanks!

For reference, here's the fax sent at 196dpi, pre-converted to duotone by my scanner:

definitely good enough for my purposes!
 

dicko

Still learning but earning
Joined
Oct 30, 2015
Messages
678
Reaction score
252
ImageMagick can do that on your original pdf

convert -monochrome input.pdf output.pdf

ghostscript can do it also by adding -sDEVICE=psmono to the call to it, but as I said before, make sure your ghostscript is not 10 years old ;-)
 
  • Like
Reactions: RoboLord

RoboLord

Member
Joined
Aug 18, 2017
Messages
43
Reaction score
4
Location
Oregon
ImageMagick can do that on your original pdf

convert -monochrome input.pdf output.pdf

ghostscript can do it also by adding -sDEVICE=psmono to the call to it, but as I said before, make sure your ghostscript is not 10 years old ;-)
Thanks, but I have no idea how to implement that into the faxing workflow. Do I just stick this line of code into one of the config files?
 

dicko

Still learning but earning
Joined
Oct 30, 2015
Messages
678
Reaction score
252
If you are using Avantfax , in

/var/www/html/fax/includes/functions.php

is a function convertpdf, I would add it in there.
 
  • Like
Reactions: RoboLord

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
15,430
Reaction score
2,737
Thanks, but I have no idea how to implement that into the faxing workflow. Do I just stick this line of code into one of the config files?
For GhostScript conversion, change DEVICE from pswrite to psmono here: /etc/hylafax/faxmail/application/pdf

Might also want to change PAPERSIZE from a4 to letter or legal (depending on your country and requirements, of course)
 
Last edited:
  • Like
Reactions: RoboLord

RoboLord

Member
Joined
Aug 18, 2017
Messages
43
Reaction score
4
Location
Oregon
Things are much different on Raspbian, it seems.

/var/www/html/fax/includes/functions.php
is actually:
/var/www/html/avantfax/includes/functions.php
unfortunately I have no php coding skills and am not comfortable slipping lines into that file. I'm sure I would break it!

/etc/hylafax/faxmail/application/pdf

is non-existent on my system and I'm not sure where it's equivalent would be located. I used locate to try to find "pdf" and I can't find any files that would have these options to edit. Any ideas where this might be in a Raspbian system?

I did find the file /etc/hylafax/pagesizes and was able to switch the default to from A4 to US Letter.
 

dicko

Still learning but earning
Joined
Oct 30, 2015
Messages
678
Reaction score
252
Things are much different on Raspbian, it seems.

/var/www/html/fax/includes/functions.php
is actually:
/var/www/html/avantfax/includes/functions.php
unfortunately I have no php coding skills and am not comfortable slipping lines into that file. I'm sure I would break it!

/etc/hylafax/faxmail/application/pdf

is non-existent on my system and I'm not sure where it's equivalent would be located. I used locate to try to find "pdf" and I can't find any files that would have these options to edit. Any ideas where this might be in a Raspbian system?

I did find the file /etc/hylafax/pagesizes and was able to switch the default to from A4 to US Letter.
Not so much the included file with avantfax , debian-prefs.txt is how to choose a few basics, in my case I choose fax over avantfax and change the apache user/group to asterisk
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
15,430
Reaction score
2,737
Google is your friend. Take a look at /etc/hylafax/typerules.
 

Members online

PIAF 5 - Powered by 3CX

Forum statistics

Threads
22,580
Messages
138,980
Members
14,675
Latest member
profjake