Java 7, Print to PDF not recognising fonts Mac OS X

Hi all,

Servoy 6.1.3, Mac OS X 10.6.8 / 10.7.x / 10.8.2. Latest Java 7 on server and client. We try to print an invoice. Invoice previews fine in Servoy with proper fonts. We click save as PDF or view as PDF in Preview. resulting invoice has bad bit-mapped font. Has anyone seen this issue?

Christian

Should look more like this:

How are you printing that invoice? print-preview? smart-client? web-client? just a form in Servoy?

With pdf-print, you can embed the font (look for the pdf options, in the pdf_output plugin in Servoy)

Smart Client, Print Preview, Click ‘Print Button’, get Apple’s Print Dialog, PDF Dropdown, Save as PDF or Open PDF in Preview…

so in the print-preview you see the right font?
that’s strange… that means, the font is recognized (locally) by Servoy.

You didn’t had this with Java 6?

Hi,

I have the same issue with Java 7 on Mac OS X. Fonts showing up properly on the print preview, but they do not print the same way. Everything was fine with the previous versions of java.

Does any one have any suggestions?

Harjo:
so in the print-preview you see the right font?
that’s strange… that means, the font is recognized (locally) by Servoy.

You didn’t had this with Java 6?

No, it was working fine before on Java 6.

Please, file a bug report in the Servoy Support system

Any news on this? We have the same problem on Java 7 latest, Mac OS X latest, Servoy 6.1 latest.
We work around by printing to PDF and emailing them to the users.

swingman:
Any news on this? We have the same problem on Java 7 latest, Mac OS X latest, Servoy 6.1 latest.
We work around by printing to PDF and emailing them to the users.

Did you make any further progress on this Christian ? The fonts are not working either as a print or pdf regardless of how I try and output from Servoy directly. I am looking at moving it to Velocity to overcome the problem but that is going to add a fair amount of work generating the template :(

Cheers
Gordon

Hi Gordon,

just looked at the production code and we are still sending ourselves PDFs to get around the issue.

swingman:
Hi Gordon,

just looked at the production code and we are still sending ourselves PDFs to get around the issue.

Hi Christian

Thanks and interesting, I tried this and the PDFs also failed to render the fonts on the Mac. As it was a relatively simple single page report I re worked it in html using velocity which was fine printed but again as a PDF it lost the fonts :( I am guessing this is the PDF rendering in the java component - none the less a workaround has saved the day :)

Thanks
Gordon

I have tested this, and this indeed happens, when you set the Servoy client, to use the system print dialog.
[attachment=0]Schermafbeelding 2014-08-20 om 10.21.05.png[/attachment]

I wondered why we never had complaints about this, and this is because we print the form, directly to pdf (with embedding fonts) inside Servoy and show it as a popup.
Did you already filled a case?? if so please let me know, I will vote for it.
Although I wonder if Servoy can do something about it, because when you don’t Save as PDF or Open PDF in Preview… but directly print it the printer, the right fonts are shown on the print.

this is snippet of the code we use

/**
 * @properties={typeid:24,uuid:"49aafa02-acfd-4eb7-aa8b-7708ca5cbcfa"}
 * @param {String} form
 * @param {String} sendfilename
 * @param {Boolean} [vCurrentRecordOnly]
 */
function printAsPdf(form, sendfilename, vCurrentRecordOnly) {
	if (!vCurrentRecordOnly) {
		vCurrentRecordOnly = false
	}
	//only allow characters
	var regExp = /[^a-zA-Z0-9_]/g
	var filename = sendfilename.replace(regExp, '');
	application.output(new Date())
	plugins.pdf_output.startMetaPrintJob()
	if (utils.stringMiddle(application.getOSName(), 1, 7) == "Windows") {
		plugins.pdf_output.insertFontDirectory('c:/Windows/Fonts');
	}

	if (application.getOSName().match("Mac")) {
		//plugins.pdf_output.insertFontDirectory('/System/Library/Fonts/');
		plugins.pdf_output.insertFontDirectory('/Library/Fonts/');
		//plugins.pdf_output.insertFontDirectory('~/Library/Fonts/');
	}
	forms[form].controller.print(vCurrentRecordOnly, false, plugins.pdf_output.getPDFPrinter());
	var pdf = plugins.pdf_output.endMetaPrintJob()
	
	var question = plugins.dialogs.showQuestionDialog('i18n:1.question', 'i18n:1.message.openorsavepdf', 'i18n:1.open', 'i18n:1.saveas')
	if (question == i18n.getI18NMessage('i18n:1.open')) {
		var filenames = plugins.file.createTempFile(filename, '.pdf')
		plugins.file.writeFile(filenames, pdf);
		openFile(filenames.getAbsolutePath())
	} else {
		var save = plugins.file.showFileSaveDialog(filename + '.pdf')
		if (save) {
			var success = plugins.file.writeFile(save, pdf);
			if (success) {
				plugins.dialogs.showInfoDialog('i18n:1.info', 'i18n:1.message.downloadsaveready', 'i18n:1.ok');
			} else {
				plugins.dialogs.showErrorDialog('i18n:1.error', 'i18n:1.message.downloadsaveerror', 'i18n:1.ok');
			}
		}
	}
}

Hi Harjo

I have not filed a bug, I elected for a work around as I rarely use Servoy to print, generally electing to use Velocity. This was an in house solution that I may roll out as a saas product, hence the question. I next to never use the smart client it was coincidental that I chose to save to PDF and lost the fonts and when I tried smart client got the same result hence investigating further.

best
Gordon

it becomes even stranger!

I showed in my answer a piece of a screenshot, of 2 different preview’s, right?
when I print both preview’s to the same printer, the printout is exactly the same, with the right font!!! :shock:

Any news on this issue? I can’t find any error report on servoy support system and I’m still having this problem with Servoy 8.1.