richardandtracy | 18/09/2017 11:05:22 |
![]() 943 forum posts 10 photos | I had an idea this morning about the cause, and think it may be related to pdf page location co-ordinates being converted to use decimal commas. I am hoping Thor will respond to a PM so I can check whether this may be the cause of one/all of the problems. I am not sure that HTML opening is likely to be the problem as the pdf file with the problems opens (if it opens at all) just shows blank pages. However, there is such diversity in setups that I am increasing less sure about anything! Regards, Richard |
Thor 🇳🇴 | 18/09/2017 11:30:51 |
![]() 1766 forum posts 46 photos | Hi Richard, Thanks for taking time to iron out the PDF problems. I will try and find one of the failed PDF files and e-mail to you. Ady, the problem isn't that PDFs are set to open automatically in a browser. I tried several PDF readers, the only one that gave any other output than a blank screen was FireFox. Thor Edited By Thor on 18/09/2017 11:34:36 |
SillyOldDuffer | 18/09/2017 11:45:49 |
10668 forum posts 2415 photos | Wild suggestion: Richard's code sets the font by name ('Helvetica' ) without checking that it actually exists. (It should but...) I don't know what the PDF library does if it can't find a font, but I suppose writing a document full blank glyphs is a possibility. (I've never understood how PDF files handle fonts; whether they load a copy of the font into the document, or just provide a link and expect the PDF reader to find it on the other system.) Might be worth initialising the PDFObject without setting a font at all. With luck a portable default will be used. Dave Edit: I hate automatic smileys!!! Edited By SillyOldDuffer on 18/09/2017 11:46:34 |
richardandtracy | 18/09/2017 12:41:40 |
![]() 943 forum posts 10 photos | There are four fonts that are 'built in' with the PDF spec, Helvetica, Times, Courier and ZapfDingbats. On Apple systems, they exist, I think, by virtue of being loaded with the OS. On Windows there are auto substitutions of Arial, Times New Roman, Courier New and Symbol, which are all loaded by the OS. The four fonts are part of the core PDF definition - and I use them for simplicity, programming in the font embedding is interesting, but getting the information to embed the fonts from Windows is a non-trivial exercise which I'd prefer to avoid. A font can be embedded in the pdf file in the manner described below. Each character is stored as an object in the file. It is stored as an array of co-ordinates marking the perimeter of the object, this is done clockwise. Any 'holes' in the filled in character (eg for 'A' etc) are another group of co-ordinates where the perimeter is drawn anti-clockwise. The co-ordinates are all in points from the character origin, which is on the line and permits the correct character spacing from the previous character. The character is defined at 1 point font size. There is another co-ordinate for the 'End of character' point. Each font is defined as a series of objects and they are mapped onto letters. The font need not be complete, just cover every letter that is used. The font is given an external designation (eg 'Arial' ) , and an internal name (eg 'Font1' ) When text is used in a pdf file you get an uncompressed entry in the 'Page Object Contents Stream' similar to that below (anything after a % character is a comment that the reader ignores): 'BT' %Begin Text Then at the end of any group of text there is an 'ET' before any line drawing can occur. There must be an 'ET' before the end of each page that has a 'BT'. Regards, Richard Edited to kill rogue emoticons Edited By richardandtracy on 18/09/2017 12:45:08 |
SillyOldDuffer | 18/09/2017 13:02:51 |
10668 forum posts 2415 photos | Who would have thought that people would be discussing pdf intricacies on a Model Engineering forum! Excellent explanation Richard. My other thought is that the pdf error is version related. Something new in edge or W10 that's incompatible with the library you're using. If so may be difficult to find and fix - so far I haven't had empty documents on linux or W10 ; pdf and csv both work. Nothing is ever easy. Thanks, Dave |
Neil Wyatt | 18/09/2017 13:10:06 |
![]() 19226 forum posts 749 photos 86 articles | Posted by SillyOldDuffer on 18/09/2017 11:45:49:
Wild suggestion: Richard's code sets the font by name ('Helvetica' ) without checking that it actually exists. (It should but...) I don't know what the PDF library does if it can't find a font, but I suppose writing a document full blank glyphs is a possibility. (I've never understood how PDF files handle fonts; whether they load a copy of the font into the document, or just provide a link and expect the PDF reader to find it on the other system.) Might be worth initialising the PDFObject without setting a font at all. With luck a portable default will be used. Dave Edit: I hate automatic smileys!!! Edited By SillyOldDuffer on 18/09/2017 11:46:34 Far cleverer that that, if you have a proper PDF creator. You can specify fonts as embedded or converted to curves. Embedded fonts can be done as subsets if less than a given percentage of characters are used They won't uses system fonts because that would open the possibility of loading a font that isn't identical to the one used to create the document and break the 100% consistent cross-platform appearance aim of the PDF format. |
richardandtracy | 18/09/2017 13:26:26 |
![]() 943 forum posts 10 photos | Embedding of fonts was my aim when I started. After reading the spec & trying to relate that to the information I could get out of Windows with my level of understanding, I fairly rapidly revised the aim. Maybe, one day... Regards, Richard.
|
SillyOldDuffer | 18/09/2017 14:55:07 |
10668 forum posts 2415 photos | Posted by Neil Wyatt on 18/09/2017 13:10:06:
Posted by SillyOldDuffer on 18/09/2017 11:45:49:
...
Far cleverer that that, if you have a proper PDF creator. You can specify fonts as embedded or converted to curves. Embedded fonts can be done as subsets if less than a given percentage of characters are used
![]() They won't uses system fonts because that would open the possibility of loading a font that isn't identical to the one used to create the document and break the 100% consistent cross-platform appearance aim of the PDF format. 'if you have a proper PDF creator' - we may be getting closer to the problem. Richard's program uses a class library to set up and write the pdf document. I see he uses VCL and that Embracardo have various pdf offerings. Other pdf libraries are available, not least that sold by Adobe. Or Richard might be smart enough to have written his own. Whose library are you using Richard? Might be a known bug. Dave |
richardandtracy | 18/09/2017 15:14:40 |
![]() 943 forum posts 10 photos | My own. I am too much of a cheapskate to pay for anything if I can avoid it. I suppose it is rather like most of the stuff with model engineering - it's more effort, but more satisfying and cheaper to do it yourself. I have never charged for a program, and am never likely to, so paying for bolt-on's is not anything that is going to pay for itself. Software libraries are not high on my list of priorities for purchases. In July last year I found I had been using my 'PCPlus' cover disc of the C++ Builder 4 programming environment for exactly 16 years, and thought it wise to finally upgrade to C++ Builder 10.1, so when the price dropped from £205 to £49, I jumped at the chance. It is now free... I have made my C++ Builder 10 pdf source code available for download here: **LINK** for anyone who is interested. I have been harbouring the hope some clever person may be able to use it, and maybe improve on it. Not happened so far that I have heard of, but there we go. I will update it if I can trace the source of the problems Thor is experiencing. As it is, it seems to work most of the time. Or it seemed that it did... Regards, Richard.
|
clivel | 18/09/2017 16:28:51 |
344 forum posts 17 photos | Hi Richard, I am not familiar with C++ builder, but in the unlikely event that you ever want to change your build environment, then I would recommend the excellent gcc (Gnu Compiler Collection) C++ compiler. Again completely free and open source, it is included with www.cygwin.com and being cross platform I use it to compile the identical code on Windows, Linux & Mac.
|
richardandtracy | 18/09/2017 16:45:24 |
![]() 943 forum posts 10 photos | Thanks Clive, I have downloaded Libharu and will look into it. Regards, Richard.
|
SillyOldDuffer | 18/09/2017 20:25:53 |
10668 forum posts 2415 photos | Ho hum, looks like Adobe changed the specification. Wikipedia says of the Standard Type 1 Fonts: 'However, since Adobe Acrobat version 6, most of these fonts are not guaranteed to be available in the reader, and may only display correctly if the system has them installed.' Dave |
clivel | 18/09/2017 22:18:56 |
344 forum posts 17 photos | Posted by SillyOldDuffer on 18/09/2017 20:25:53:
Ho hum, looks like Adobe changed the specification. Wikipedia says of the Standard Type 1 Fonts: 'However, since Adobe Acrobat version 6, most of these fonts are not guaranteed to be available in the reader, and may only display correctly if the system has them installed.' Dave As the author and maintainer of an open source application that generates PDF files using the previously mentioned libharu I was very concerned upon reading that. Wikipedia is a fantastic resource, regrettably however it is not always reliable. Clive
|
SillyOldDuffer | 19/09/2017 10:22:54 |
10668 forum posts 2415 photos | Hi Clive, Good point about the fallibility of Wikipedia, but they might be right. A quick look at the Adobe forum reveals that there have been multiple changes to what Acrobat does with fonts since 1993, and some of it has been further complicated by Microsoft. My understanding (feel free to put me right) is that:
Thor's bug is interesting in that he gets blank pages. It implies that the document is being correctly populated but the font is empty, i.e all the characters produce white-space. All supposition so far but I think the proposition could be tested by seeing if Thor gets readable text by using a font other than Helvetica, and/or by showing that a libharu program using Helvetica also produces blank pages on his computer. I'm never quite sure if debugging programs is an interesting puzzle or a boring pain in the butt! Dave
|
richardandtracy | 19/09/2017 12:35:22 |
![]() 943 forum posts 10 photos | I am really confused by the problems with Thor's pdf file. I sent him one that worked OK on my machine under Acrobat Reader SD (the latest) but it failed to read on his machine using Edge & Firefox (which presumably calls up a reader to embed the pdf in a tab). I also got the same file to open with PDFCreator, but it failed with PDFsam. I am stumped. Very stumped. I think I'll leave it be for the moment, and try a few experiments with libharu. I will upload the 'decimal comma hardened' version of the program this evening, which should make it more likely to work with more machines. If I can get the libharu libraries to work for me under C++ Builder 10, I will upgrade the program to use it, but given my likely schedule in the near/medium future, my programming time is likely to be curtailed and developments will be slow. Regards, Richard.
|
Thor 🇳🇴 | 19/09/2017 13:17:41 |
![]() 1766 forum posts 46 photos | Thanks Richard, for your efforts to sort out this problem. I have now tested the revised PDF you sent me on a couple of other computers. It opened without problem in the default PDF reader on Linux Mint. I have also tried it on my old Windows XP and the old Acrobat Reader opened the file without problems. Thor |
Andrew Wood 7 | 03/01/2019 20:31:34 |
14 forum posts 4 photos | Just discovered this brilliant program, thanks very much Richard. I was struggling to find an accurate 32tpi setting on my WM180 and using the program (on XP) with a bit of sorting in excel using the csv files I found several possibilities. The WM180 has an extra gear wheel but varying the initial ratio setting enabled me to get the correct answers. I already had made an excel program to calculate the pitch and tpi so it was easy to check. It's a pity this couldn't be somewhere more prominently on the ME site as it was only by chance I happened on the link. I haven't tried the pdf option btw.
|
Please login to post a reply.
Want the latest issue of Model Engineer or Model Engineers' Workshop? Use our magazine locator links to find your nearest stockist!
Sign up to our newsletter and get a free digital issue.
You can unsubscribe at anytime. View our privacy policy at www.mortons.co.uk/privacy
You can contact us by phone, mail or email about the magazines including becoming a contributor, submitting reader's letters or making queries about articles. You can also get in touch about this website, advertising or other general issues.
Click THIS LINK for full contact details.
For subscription issues please see THIS LINK.