Author Topic: Simple PDF Solution; "Gostscript" -> Developer Needed  (Read 32823 times)

Offline Knezzen

  • Administrator
  • Platinum Member
  • *****
  • Posts: 975
  • Pro Tools Addict!
    • Macintosh Garden
Re: Simple PDF Solution; "Gostscript" -> Developer Needed
« Reply #40 on: December 10, 2016, 02:08:53 AM »
I'm actually working on a PDF Viewer for Mac OS 9 that can open modern PDF's. It's not ready to be released yet and im focusing on MacTorrent at the moment, but I will probably post something about it soon :)
Pro Tools addict and admin at Macintosh Garden, Mac OS 9 Lives! and System 7 Today

Offline Mat

  • Platinum Member
  • *****
  • Posts: 644
Re: Simple PDF Solution; "Gostscript" -> Developer Needed
« Reply #41 on: December 11, 2016, 02:59:21 PM »
Knezzen, whatever you are planning, please think about the following: the most needed feature for "real world usage" beside "viewing" all recent pdfs would be a "conversion possibility" to clean PDF 1.3 or PDFx1a:2001. That would assure that the PDFs are fully usable (including manipulation with Acrobat pro) at Mac OS 9.
There are tools at Linux doing a quite good job in this direction, and most PDFs (I´d say 99%) do not use any non-printable modern functions like extreme furmulars, embedded videos, heavy JavaScripts, ...

Offline OS923

  • Platinum Member
  • *****
  • Posts: 888
Re: Simple PDF Solution; "Gostscript" -> Developer Needed
« Reply #42 on: December 12, 2016, 09:39:14 AM »
I'm actually working on a PDF Viewer for Mac OS 9 that can open modern PDF's. It's not ready to be released yet and im focusing on MacTorrent at the moment, but I will probably post something about it soon :)
Can you be a bit more specific?
Will this be open source?
Do you use C++?
Do you use CodeWarrior?

Offline OS923

  • Platinum Member
  • *****
  • Posts: 888
Re: Simple PDF Solution; "Gostscript" -> Developer Needed
« Reply #43 on: December 12, 2016, 09:43:49 AM »
OS923 I don´t exactly understand your posting. First you suggest to compile, or if  needed port, Xpdf ( http://www.foolabs.com/xpdf/ )to Mac OS 9. But the rest of your posting is about optimizing PDFs with other Operating Systems for Mac OS 9. That is no real solution for people like me who use nothing else like Mac OS 9. Or did I miss something completely?
No you missed nothing. Indeed, if you convert and optimize your PDFs on XP then you need no specific solution for OS 9, because as soon as your PDF is converted to version 1.4 you can do everything you want with it on OS 9. But as you say, if you use only OS 9 then there's no solution for PDFs with version >= 1.5 at this moment.

Offline Knezzen

  • Administrator
  • Platinum Member
  • *****
  • Posts: 975
  • Pro Tools Addict!
    • Macintosh Garden
Re: Simple PDF Solution; "Gostscript" -> Developer Needed
« Reply #44 on: December 12, 2016, 10:24:19 AM »
Can you be a bit more specific?
Will this be open source?
Do you use C++?
Do you use CodeWarrior?

I haven't gotten that far yet. Im using REALbasic 2006R3 on OSX to do it (the last version of REALbasic able to compile Macintosh Toolbox binarys). Will probably be open sourced as soon as I get something working. Feel free to help out if you have the time :)
Pro Tools addict and admin at Macintosh Garden, Mac OS 9 Lives! and System 7 Today

Offline OS923

  • Platinum Member
  • *****
  • Posts: 888
Re: Simple PDF Solution; "Gostscript" -> Developer Needed
« Reply #45 on: December 15, 2016, 10:01:19 AM »
2 problems:
  • The drawing capabilities of REALbasic are very limited. This is more something for QuickDraw GX.
  • PDFs are Unicode and REALbasic can't draw this on OS 9.
If you can get it to work in OS 9 and I get the source code then I'm confident that I can make a faster version in C++ that draws Unicode, but I've never used QuickDraw GX.

Offline Mat

  • Platinum Member
  • *****
  • Posts: 644
Re: Simple PDF Solution; "Gostscript" -> Developer Needed
« Reply #46 on: May 26, 2020, 11:23:45 AM »
I need to push this thread once again, as it is still one of the most important "missing links" if you are using just Mac OS 9.

Offline ivan_holmes

  • Enthusiast Member
  • ***
  • Posts: 28
  • New Member
Re: Simple PDF Solution; "Gostscript" -> Developer Needed
« Reply #47 on: May 27, 2020, 10:48:36 AM »
I have downloaded various versions of the Ghostscript source code to see how far I could get easily. My results:

GhostScript 8.51 compiles and works as expected

GhostScript 8.54 compiles using the CodeWarrior project from 8.51 (with minor adjustments) and seems to work with MacGSView. I don't know if it gives any benefits (I don't have any tricky PDFs to test), but I have attached it anyway.

GhostScript 8.70 compiles (using a CodeWarrior project generated by the included makefile, quite a few manual adjustments needed) but MacGSView won't work with it. I couldn't get MacGSView to compile (CodeWarrior too new I think), and I don't know anything about GhostScript, so whatever adjustments might need to be made to get them to play nicely are a mystery to me. 

GhostScript 8.71 is the last version in the 8.x series and it uses libtiff. Unfortunately none of the makefiles related to Mac OS 9 were updated to reflect this. I had a go but couldn't get it to work.

I may try to build GhostScript 8.6x but I am out of my depth now, I think adjustments to MacGSView may be needed for the new libraries to work well.

Offline Mat

  • Platinum Member
  • *****
  • Posts: 644
Re: Simple PDF Solution; "Gostscript" -> Developer Needed
« Reply #48 on: May 27, 2020, 11:02:31 AM »
Ivan, you are great. That is the OpenSource spirit that we need so much für Mac OS 9 as well.
Thanks a lot for your work! So we have an updated version to 8.54 now. I will do some tests in the upcoming weeks, and report about the improvements.

Perhaps noc Knezzen should share his project with you and see if there is something that can be done easily. The Bittorrent Client he did is working very well.

Offline ivan_holmes

  • Enthusiast Member
  • ***
  • Posts: 28
  • New Member
Re: Simple PDF Solution; "Gostscript" -> Developer Needed
« Reply #49 on: May 27, 2020, 11:40:57 AM »
Thank you Mat, it is quite rewarding to get newer stuff working with old.

Perhaps noc Knezzen should share his project with you and see if there is something that can be done easily. The Bittorrent Client he did is working very well.
I have used MacTorrent myself, it is a very cool piece of software. I had to pinch myself when it actually worked!
I would be open to the idea, I wonder how far he got with it. Sadly I think serious work will be needed to get anywhere.

In terms of a true solution to PDF rendering on Mac OS 9, I am not sure if the best solution is trying to update GhostScript and MacGSView, or maybe trying to get poppler https://poppler.freedesktop.org/ to build on Mac OS 9... hopefully its dependencies are portable. I recently came across the Retro68 toolchain, which I think will be easier than trying to use CodeWarrior with modern C++.
If poppler can be built, a drag and drop conversion utility (new PDF to old, or postscript) would be possible. I did something similar for the 'Drop ALAC' utility (although the code I based that on is a lot simpler than poppler). This seems like the best path to me, creating a new reader as good as Acrobat 5.0 would take far too much work.

Offline Mat

  • Platinum Member
  • *****
  • Posts: 644
Re: Simple PDF Solution; "Gostscript" -> Developer Needed
« Reply #50 on: May 27, 2020, 04:15:28 PM »
If poppler can be built, a drag and drop conversion utility (new PDF to old, or postscript) would be possible. (…) This seems like the best path to me, creating a new reader as good as Acrobat 5.0 would take far too much work.
I have to agree! In fact MacGSView is damn slow compared to Acrobat 5. And a new program is not necessary. To cover 99,9% of PDF real world usage, a simple "converter" would do the trick. Nearly all PDFs are not using the newer possibilities of PDF 1.5 and up, like embedded videos or audio data, or encryption and all that stuff. So the best would be a program where you can "drag&drop" any PDF and let it create a clean PDF 1.3. For using these PDFs Acrobat is still fine.

I am using a similar program at Linux some times which is called PDFConverter and I could convert all (!) PDFs that I wanted to use the last 8 years, to clean 1.3.

If poppler is a better path (that have coders to decide) please try it. It was just that GhostScript was already available.

Offline ivan_holmes

  • Enthusiast Member
  • ***
  • Posts: 28
  • New Member
Re: Simple PDF Solution; "Gostscript" -> Developer Needed
« Reply #51 on: May 28, 2020, 08:52:19 AM »
So I have looked in to this a bit more, and I am not sure how to proceed.

First of all, I hadn't done my research on poppler properly – it has loads of dependencies, including fontconfig which will not work on OS 9, so it's a dead end.

Xpdf (mentioned by OS923 4 years ago) is a much better option as it only has a couple of dependencies. It has command line utilities that can convert PDF to PS and PNG amongst other things, these are potential candidates for conversion to drag-and-drop utilities. I have managed to compile it and the necessary libraries but I can't get it to link in to an executable with Retro68 (undefined references to various symbols in libpng), probably because I don't know what I am doing... There's basically no documentation so I am stuck here for now. I might be able to come back to it when I have sharpened my skills...

This concludes my investigation, sorry I was not able to help further.

Offline OS923

  • Platinum Member
  • *****
  • Posts: 888
Re: Simple PDF Solution; "Gostscript" -> Developer Needed
« Reply #52 on: May 29, 2020, 04:14:50 AM »
Qpdf is a command-line pdf-to-pdf converter written in C++ that depends only on libjpeg-turbo which may be replaced with QuickTime's GraphicConverter.

Offline ivan_holmes

  • Enthusiast Member
  • ***
  • Posts: 28
  • New Member
Re: Simple PDF Solution; "Gostscript" -> Developer Needed
« Reply #53 on: May 29, 2020, 07:15:56 AM »
It looks interesting; the site says it can force a lower version and disable unsupported features, and that it can 'optimise' images to JPEG. It sounds like it could be a solution, definitely worth further investigation.

I haven't got any 'tricky' PDFs I need to open, so perhaps anyone who does have some (that are not private of course) could upload them here. That way one could easily evaluate if QPDF does the job before bothering to start porting.

Offline Mat

  • Platinum Member
  • *****
  • Posts: 644
Re: Simple PDF Solution; "Gostscript" -> Developer Needed
« Reply #54 on: May 30, 2020, 06:17:27 AM »
Thanks Ivan for your investigations and time!

About Xpdf, it may be the way to go, as there are several ports to different plattforms. I do not know anything about QPDF.

Regarding tricky PDFs I will try to provide some. It may need some time, as I need to check at another OS than 9 ;)

Offline ivan_holmes

  • Enthusiast Member
  • ***
  • Posts: 28
  • New Member
Re: Simple PDF Solution; "Gostscript" -> Developer Needed
« Reply #55 on: June 02, 2020, 04:22:55 AM »
No problem, I await your tricky PDFs if you are able to find any. I'm learning as I go though, so don't expect much.

Offline IIO

  • Platinum Member
  • *****
  • Posts: 4439
  • just a number
Re: Simple PDF Solution; "Gostscript" -> Developer Needed
« Reply #56 on: June 02, 2020, 10:58:30 PM »
And a new program is not necessary. To cover 99,9% of PDF real world usage, a simple "converter" would do the trick.

for me it does not happen too often that a pdf cant be read on OS9, but when it happens, then it is really annoying that there is no solution other than what OS923 described above in 2016. (using 3 different utilities under windows^^)

and i dont think it will be so easy to make a pdf converter for OS9, because converting requires reading and understanding - and if you could do that, you could as well display new formats directly. (i.e. only display the conversion but not touch the file.)

or maybe we´re just overlooking that one app which already does it? i needed quite a while until i found out that there is a dozen of OS9 apps which can open docx or rtf back in the days.
insert arbitrary signature here

Offline OS923

  • Platinum Member
  • *****
  • Posts: 888
Re: Simple PDF Solution; "Gostscript" -> Developer Needed
« Reply #57 on: June 03, 2020, 06:55:11 AM »
converting requires reading and understanding - and if you could do that, you could as well display new formats directly. (i.e. only display the conversion but not touch the file.)
I disagree. Drawing is more complicated than conversion. I'm looking into Qpdf in which I want to replace libjpeg-turbo with the original jpeglib, which is a bit slower, but it has no dependencies.

Offline IIO

  • Platinum Member
  • *****
  • Posts: 4439
  • just a number
Re: Simple PDF Solution; "Gostscript" -> Developer Needed
« Reply #58 on: June 04, 2020, 02:29:36 AM »
for a quick reader app, couldnt you just print a bitmap to screen or something?
insert arbitrary signature here

Offline IIO

  • Platinum Member
  • *****
  • Posts: 4439
  • just a number
Re: Simple PDF Solution; "Gostscript" -> Developer Needed
« Reply #59 on: June 04, 2020, 02:31:33 AM »
oh but yes, i iknow what you mean. converting can of course start at such simple things like changing the version number or converting a single picture, you  dont need to render everything. not sure what i was thinking when i wrote that.
insert arbitrary signature here