Log of #ghostscript at irc.freenode.net.

Search:
 <<<Back 1 day (to 2021/06/07)Fwd 1 day (to 2021/06/09) >>>20210608 
artifexirc-bot <petaflot> hello! I generated some ps files that work fine with gv ; I sent them for print but the company is not able to read them. I converted them with ps2pdf (tried all PDF versions), a file is genereated but mupdf cannot open them (exit status 1)07:23.29 
  <KenSharp> Without seeing your file there is really nothign I can say beyond 'that's interesting'07:24.25 
  <petaflot> I was hoping someone could give me a clue on what is wrong. here's a sample : lutolf.vserver.nimag.net/files/ftimes_777_29-8.ps07:26.01 
  <KenSharp> "gs -sDEVICE=pdfwrite -o out.pdf ftimes_777_29-8.ps" produces a PDF file which Acrobat is completely happy with07:27.57 
  <KenSharp> a bunch of coloured circles07:28.06 
  <chrisl> mupdf doesn't seem to have a problem, either, for me07:28.48 
  <KenSharp> MuPDF opens the file and has no problems with it either07:28.53 
  <KenSharp> That's MuPDF 1.18.0 for completeness07:29.12 
  <chrisl> Looking at the PS content, it's hard to imagine why any consumer would have an issue with it07:30.14 
  <KenSharp> Yes I wass thinking the same, its about as simple as you can get07:30.29 
  <KenSharp> It is all in RGB of coruse, maybe the print company wants CMYK07:31.29 
  <KenSharp> Or possibly they don't understand what PostScript is and tried to send it to a PCL printer, or open it with Acrobat Reader or somethng equally dumb.07:32.05 
  <petaflot> can you please try this ? lutolf.vserver.nimag.net/files/out.pdf I cannot open it. can you also give me the resulting PDF _you_ generated to see if I can open it?07:32.24 
  <KenSharp> One minute07:32.49 
  <chrisl> That even works in the browser!07:33.14 
  <KenSharp> Works in Acrobat too07:33.21 
  <chrisl> And in mupdf07:34.02 
  <KenSharp> And in MuPDF07:34.03 
  <KenSharp> echo 🙂07:34.08 
  <chrisl> Although, I'm using mupdf from git rather than a release07:34.17 
  <petaflot> thanks for your feedback. I guess I'll just convert my files and blindly send them as PDF... can I still have a copy of the PDF you generated?07:34.49 
  <KenSharp> Me too, though I have some earlier releases to hand I could try07:34.57 
  <KenSharp> petaflot what version of MuPDF are you using ?07:35.35 
  <KenSharp> You could also run the PDF file back through Ghostscript if you want confirmation the file is OK07:35.49 
  <petaflot> forget it.. for some reason it seems my mupdf is broken. I can't even open files downloaded from the internet that were fine before07:35.56 
  <KenSharp> Ghostscript can render PDF files too, and if you use the display device it'll draw it on screen07:36.06 
  <KenSharp> Ah, sounds indeed like you have a broken installation there07:36.22 
  <petaflot> yup :-/07:36.30 
  <petaflot> that's in case you want to see "the bigger picture" ;-) https://www.swisstransfer.com/d/f8f61a54-3d84-44b0-ab8b-2707ce4db434 (this way you might forgive me for the noise)07:37.12 
  <KenSharp> Its not a problem, it didn't take long to diagnose07:37.42 
  <KenSharp> Crikey big files.07:37.59 
  <petaflot> hrrr07:38.16 
  <petaflot> theye plots of factorisation times of a "few" integers07:38.48 
  <KenSharp> If these are the same as the PostScript file you sent earlier, you could make them smaller with a little PostScript programming.07:39.08 
  <petaflot> really? how so?07:39.21 
  <petaflot> they were generated with a pretty naive python script07:39.44 
  <KenSharp> Write a procedure to draw a circle and use that instead of repeatedly drawing each arc individually for example07:39.48 
  <petaflot> I didn't know this could be done. nice :-)07:40.12 
  <KenSharp> PostScript is a programming language 🙂07:40.23 
  <KenSharp> You can also pass the colour on the stack (as well as the co-ordinates) and then you could set the colour in the procedure as well07:40.59 
  <KenSharp> And include the gsave and grestore (if you really feel you need that) as well. So the whole thing woudl be much smaller.07:42.10 
  <KenSharp> At the moment you have :07:42.55 
  <KenSharp> gsave07:42.56 
  <KenSharp> 0.333333 0.800000 0.172414 setrgbcolor07:42.57 
  <KenSharp> newpath07:42.58 
  <KenSharp> -28.6076 32.4473 moveto07:42.59 
  <KenSharp> -78.6058 32.4473 49.9982 0.1 359.9 arc07:43.01 
  <KenSharp> closepath07:43.02 
  <KenSharp> fill07:43.03 
  <KenSharp> grestore07:43.04 
  <KenSharp> Define a procedure Circle which takes 6 parameters, RGB colour triplet, centre and radius07:43.27 
  <KenSharp> Actually 7 parameters....07:44.49 
  <petaflot> cool. I'll copy this whole cnversation and make sure I use its content next time I generate images. for now I'll just go with converting what I have at hand07:45.22 
  <KenSharp> I'd have to fiddle with the co-ordinates, I don't recall offhand how those work07:45.27 
  <petaflot> maybe it's even possibel to drop the python script altogether07:46.19 
  <KenSharp> /Circle07:46.25 
  <KenSharp> {07:46.26 
  <KenSharp> gsave07:46.27 
  <KenSharp> setrgbcolor07:46.29 
  <KenSharp> newpath07:46.30 
  <KenSharp> moveto07:46.31 
  <KenSharp> 0.1 359.9 arc07:46.32 
  <KenSharp> closepath07:46.34 
  <KenSharp> fill07:46.35 
  <KenSharp> grestore07:46.36 
  <KenSharp> } bind def07:46.38 
  <KenSharp> 07:46.39 
  <KenSharp> -28.6076 32.447307:46.40 
  <KenSharp> -78.6058 32.4473 49.998207:46.42 
  <KenSharp> 0.333333 0.800000 0.17241407:46.43 
  <KenSharp> Circle07:46.44 
  <KenSharp> I'm fairly sure you can calculate one of those numbers defining the circle from two of the others, but I'd have to think about it. Anyway, once you've defined the Circle procedure, you just call that with the numbers.07:47.05 
  <KenSharp> By the way, your program doesn't request a media size, so it may not work as expected on printers with different media.07:48.18 
  <chrisl> Even with more efficient Postscript, don't expect files like those to render quickly!07:48.37 
  <KenSharp> Hmm when I try to extract fiels from teh archive, I get 0 Kb07:50.40 
  <petaflot> I don't :-) the simple act of changing the zoom level takes about as long as opening the file in the first place07:50.55 
  <KenSharp> That's because you haev to re-interpret the whole program07:51.17 
  <KenSharp> That's how PostScript works07:51.28 
  <KenSharp> OK if I download the files individiually then it works07:52.05 
  <KenSharp> Pretty pictures 🙂07:52.18 
  <petaflot> fyi: the pythono code is http://dpaste.com/7JVZWSNUL (or something similar.. I have a few different versions laying around)07:53.02 
artifexirc-bot <KenSharp> doesn't speak Python07:53.44 
  <KenSharp> But the PostScript seems to be getting created by something else 'pyx' ?07:54.58 
  <petaflot> ooh yeah that's a python lib that takes care of some of it07:55.38 
  <petaflot> I didn't go into the details (not yet at least)07:55.52 
  <KenSharp> Then it is generating inefficient code. But in fairness, it can't know what you are doing, soe it probably can't do any better. A function is only useful if you intend to call it multiple times07:56.17 
  <petaflot> afaik it should be possible. I could also chose to _not_ use pyx (or no python at all)07:57.46 
  <KenSharp> Well its only an observation, there's nothing actually wrong with the code as it stands07:58.09 
  <petaflot> a simple compression with xz could be about as efficient too (and less painful!) to reduce the size. not so clean though...08:02.42 
  <chrisl> Shame Postscript doesn't support xz.....08:03.12 
  <petaflot> the PDFs are much smaller too08:03.14 
  <KenSharp> You can't send a compressed file to a PostScript printer08:03.17 
  <petaflot> KenSharp that makes sense08:03.37 
  <chrisl> PDF is probably using compressed content streams08:03.37 
  <KenSharp> Part of the advantage of using a function is that it would execute faster because there would be less parsing involved.08:03.47 
  <KenSharp> Not hugely faster, but a little I would expect08:04.07 
  <KenSharp> Yeah the PDF will be using compressed content streams08:04.22 
  <KenSharp> So it should be considerably smaller08:04.30 
  <petaflot> the main improvement, IMHO, would be where the printer has limited memory08:04.30 
  <KenSharp> That's not really a consideration08:04.51 
  <petaflot> .. unless there are printers that can print from a pipe08:04.57 
  <KenSharp> PostScript is streamed and itnerpreted as it goes, so the program is discarded as it is read.08:05.07 
  <petaflot> nice to know08:05.16 
  <KenSharp> Most PostScript printers will stream the file, its one of PostScript's main dvantages08:05.33 
  <petaflot> .... but then the bottleneck is the printing speed. I could simply stream the ps output to the printer without even saving the file08:06.14 
  <KenSharp> You could, yes, but it still needs to be parsed. Each token (gsave, grestore, arc, setrgbcolor etc) has to be read and interpreted. If you replace that sequence with Circle, its quicker08:07.08 
  <petaflot> sure08:07.49 
  <KenSharp> Quicker to send (less data) and quicker to interpret08:08.00 
  <petaflot> :-)08:08.09 
  <KenSharp> So your printer owuld run (a little) faster08:08.10 
  <chrisl> It's probably quicker to render the PS on your computer, and print the sampled image data08:08.11 
  <KenSharp> Yeah tht's even faster potentially08:08.22 
  <chrisl> Especially if you render it at the native resolution of the printer08:08.33 
  <petaflot> chrisl: what do you mean exactly? convert it to... ok right08:08.48 
  <petaflot> or use gcode ;-)08:09.14 
  <chrisl> Not sure how that helps, but okay.....08:10.01 
  <petaflot> chrisl: a laser cutter doesn't understand postscript afaik08:10.25 
  <KenSharp> Some do (or did)08:10.46 
  <chrisl> Depends on the laser cutter08:10.48 
  <KenSharp> I remember someone doing a vinyl cutter that used PostScript. Of course it was wildly inefficient with bitmap data08:11.44 
  <chrisl> Although, the ones I'm aware of used (basically) a powerful PC to drive them, so....08:11.54 
  <petaflot> .. running windows too :-|08:13.12 
  <chrisl> I think some form of Unix, rather than Windows - not sure, though.08:14.03 
  <petaflot> you'd be scared to see how the industry relies on windows08:14.42 
  <chrisl> It was a "PC" you could sit down at and play Minesweeper anyway08:14.42 
  <chrisl> Probably not. It's world's most used computer OS08:15.18 
artifexirc-bot <petaflot> actually saw a minesweeper instance on a bystronic laser cutter once08:15.23 
  <RayJohnston> The really scary thing is that most of the "embedded Windows" systems NEVER get security patches or updates and are running ancient Windoze (often XP)16:07.04 
  <RayJohnston> ever looked at the system used in your doctor's office ?16:07.38 
 <<<Back 1 day (to 2021/06/07)Forward 1 day (to 2021/06/09)>>> 
ghostscript.com #mupdf
Search: