| <<<Back 1 day (to 2014/09/23) | 2014/09/24 |
amyn | can some one please tell me how can i integrate ghostsrcipt in my application developed in C++/C#? | 05:55.17 |
| the only command of ghostscript that i will use is "gs9.14\\bin\\gswin32c -I" . "gs9.14\\lib;fonts -dSAFER -dNumRenderingThreads=2 -dBATCH -dUseCropBox -dNOPAUSE -sPDFPassword=\"\" -sDEVICE=png16m -r200 -sOutputFile=\"output\" >> \"output\\conv.tmp\" 2>> \"output\\conv.err\" " ; | 05:55.41 |
| and "gs9.14\\bin\\gswin32c -I" . "gs9.14\\lib;fonts -dSAFER -dNumRenderingThreads=2 -dBATCH -dUseCropBox -dNOPAUSE -sPDFPassword=\"\" -sDEVICE=tiffg4 -r200 -sOutputFile=\"output\" >> \"output\\conv.tmp\" 2>> \"output\\conv.err\" " ; | 05:56.02 |
kens | chrisl I was reading last night your conversastion with Ray, do you want me to give a Windows build a try with your fix ? | 07:00.38 |
| amyn : Its not possible to answer such an open question. The normal way to 'integrate' Ghostscript, on Windows, woudl be either to link a static library or load a dynamic link library. Neither of those work with the command line interface. If you want to use the command line itnerface then you need to spawn a process in order to do so (this is not exactly what I would describe as 'integration') | 07:03.44 |
| You haven't stated what your problem is so its not really possible for us to tell you how to proceed | 07:05.05 |
chrisl | kens: thanks, I just tried it, and there is a performance deficit with my fix, only, it seems, on Windows..... | 07:13.45 |
kens | :-( | 07:13.52 |
| THat would suggest locking then. | 07:14.04 |
chrisl | It does, *but* I can only see one place where a change I've made would potentially cause additional locking, and Ray saw no difference changing that | 07:14.43 |
kens | Hmm, well I can try profiling it if you like | 07:14.58 |
chrisl | Well interestingly, a Cygwin build shows the difference even more than VS, so I'm doing a couple of profile builds so I can gprof them. I do have the VS 2010 (IIRC) profiler | 07:16.04 |
kens | Ah, interesting that Cygwin should be worse | 07:16.21 |
chrisl | I might take up your offer later on, though..... | 07:16.56 |
kens | I've never had much success with the VS profiling tools. Microsoft's staff seem to think its intuitively obvious hwo to use them, and it baffles me | 07:17.10 |
| I'll be out this morning, but let me know if I cna help this afternoon. | 07:17.31 |
chrisl | OKay, thanks. I'll be out this morning, too..... | 07:22.21 |
kens | Thought so | 07:22.27 |
chrisl | Hmm, well, interesting, but not useful: the Cygwin profile builds seem to be broken for multithreaded applications...... :-( | 07:49.34 |
kens | Oh, that's unhelpful | 07:49.47 |
chrisl | Yes, we end up in some kind of deadly embrace situation - presumably, the profiling instrumentation in the individual threads clashing | 07:51.03 |
kens | It looks to me like the PCL interpreter won't work with pdfwrite and -dFirstPage. It seems that the way this works it sends al teh marking operations to the device, but only emits a 'showpage' if the page is in the requested range. Since pdfwrite can't tell when a page starts and ends like that, it accumulates all the marking operations for pages 1 to FirstPage, tehn emits them all together. | 07:51.21 |
chrisl | Hmm, possibly it should push the nulldevice for the initial pages - that could complicate matters | 07:52.30 |
kens | It might complicate matters for the PCL interpretger, not for me :-) | 07:52.48 |
| As it stands though, it won't work as the customer wants, and there's essentially nothing I can do about it. | 07:53.07 |
| Another solution would be to pass a spec_op but I really think the interpreter should deal wiht this itself. | 07:53.27 |
chrisl | Just writing that.... | 07:53.42 |
amyn | if i want to integrate gs into my application in Dot net, can i use gsdll32.dll? | 09:31.40 |
Robin_Watts | amyn: Yes, with suitable wrappers. | 09:34.31 |
amyn | can u suggest me if there are any wrappers available for C#? | 09:35.20 |
Robin_Watts | http://lmgtfy.com/?q=gs+.net+wrappers | 09:37.54 |
amyn | do u think this is would be a good wrapper? http://ghostscriptnet.codeplex.com/ | 09:39.02 |
Robin_Watts | https://github.com/jhabjan/Ghostscript.NET | 09:39.15 |
amyn | yes this is the one i asked | 09:39.25 |
Robin_Watts | I have no experience of any of them myself, but the author for that one sometimes pops in here, so it's being actively developed. | 09:39.54 |
| BUT... think about the license. | 09:40.13 |
| You can commercially license ghostscript to avoid the AGPL. I'm not sure you can commercially license Ghostscript.NET | 09:40.41 |
amyn | actually i dont know much about license. could you explain? | 09:40.48 |
Robin_Watts | amyn: AIUI, you're developing an app, and using gs (and mupdf) in it. | 09:41.16 |
amyn | yes | 09:41.27 |
Robin_Watts | gs and mupdf are both under 2 different licenses. | 09:41.48 |
amyn | so what conditions apply for gs? how much i can use it for free? | 09:42.46 |
Robin_Watts | Firstly, they are released under the GNU AGPL. This says (lots of things, but in brief that) if you use some AGPL code somewhere in your project, then the WHOLE project must be released under the GNU AGPL. | 09:42.54 |
norbertj | kens: chrisl: rayjj: I saw your conversation on performance yesterday. And noticed that the cmdline for window has a -sOutputFile=nul: (with colon). Is the colon correct? Or is it then writing to a file named 'nul:' ? | 09:43.04 |
Robin_Watts | This means that you need to give away all the source code for all your app to anyone who you've given a copy of your app to. | 09:43.28 |
| Now, lots of people don't want that. | 09:43.38 |
| So we also license ghostscript and mupdf commercially. You pay Artifex some $$$ and they release you from the strictures of the GNU AGPL. | 09:44.22 |
| If you don't want to abide by the terms of the AGPL, and you don't want to pay Artifex, there is 1 further choice... don't use ghostscript or MuPDF at all. | 09:45.10 |
amyn | well let me explain you my condition. there is a company for whom an application is already developed. they use it internally and they do not sell that software to people outside there company. so now they want pdf to image conversion in their application. the code obviously belongs to the company whose product it is | 09:46.02 |
| and internally also they are not selling that software | 09:46.39 |
| example a bank software, they use it internally. now what if the bank software wants pdf to image conversion utility. | 09:47.07 |
Robin_Watts | I am not a lawyer, so I'm not going to get into advising you specifically whether a particular case is legal or not. | 09:47.45 |
| You should raise the issue of whether it's OK to use GNU AGPL code within their application. | 09:48.10 |
| with them. | 09:48.15 |
| Certainly, if they used it, and ever gave a copy of that application to anyone outside the bank (and that includes across different companies within the bank AIUI), they would be in violation. | 09:49.12 |
amyn | ok. i get it. and what about the above mentioned .net wrapper? | 09:49.47 |
Robin_Watts | Now, the above mentioned .net wrapper is licensed (AIUI) under the GNU AGPL too. | 09:50.09 |
amyn | no the application is only used within company at all times. it is never given to outsiders no matter what | 09:50.16 |
Robin_Watts | Same terms apply to that, except you don't have the option to buy yourself out of the restrictions, AIUI. | 09:51.20 |
amyn | ok great thanks. since the application is always used internally, i guess there is no problem. but i will discuss this with someone who can tell me accurately | 09:52.29 |
Robin_Watts | You should *absolutely* discuss this with the bank, cos there are lots of organisations that have strict rules about what liences they will accept. | 09:52.53 |
| We have commercial deals with many banks etc because of this. | 09:53.15 |
amyn | yes yes for sure. before finalizing my set of tools, i will give me web links of that products and license so that they can review it and then make a decision | 09:53.39 |
Robin_Watts | cool. | 09:53.54 |
amyn | is there any official wrapper provided by ghostsrcipt for dot net? | 09:54.28 |
Robin_Watts | no. | 09:54.35 |
amyn | not any 3rd party tool | 09:54.36 |
| not even c? | 09:54.44 |
Robin_Watts | https://code.google.com/p/gouda/ | 09:55.10 |
| That's under the MIT license. I have no idea how up to date etc it is. | 09:55.21 |
| gs 8.60 is OLD, but then the api hasn't changed much. | 09:55.39 |
amyn | well i think i will go with https://github.com/jhabjan/Ghostscript.NET | 09:56.17 |
mlen | Robin_Watts: Hi, I saw you did a lot of work on clists. Can you please take a look at http://bugs.ghostscript.com/show_bug.cgi?id=695459#c3 ? Am I headed in the right direction? | 10:05.33 |
| The issue occures when devn color is loaded from the clist in clist_playback_band | 10:06.28 |
| Is it more likely that the issue occurres when clist gets written into the file or when it's parsed? | 10:07.26 |
Robin_Watts | mlen: I'm not the guy to talk to about this. You want Ray. | 10:14.33 |
| According to ray's analysis, it's going wrong at the writing stage. | 10:14.56 |
mlen | Oh, I see. | 10:23.35 |
| Thanks | 10:23.41 |
Robin_Watts | np. | 10:23.59 |
rayjj | morning, all | 13:20.29 |
kens | Morning, you're up erly ray | 13:20.41 |
rayjj | chrisl: I saw that you were able to duplicate the Windoze problems | 13:21.00 |
| I tried (sample based) profiling using very sleepy (which sometimes works for me) and the results are not very helpful -- at least nothing jumped out. | 13:21.59 |
chrisl | rayjj: indeed yes - now battling the VS profiler | 13:22.11 |
rayjj | chrisl: I did see that the gx_device_init_on_stack differed | 13:22.40 |
| and that one had _VEC_memcpy and fastcopy_I show up, and the other just had memcpy | 13:23.36 |
| but the times for the sum of those was similar taken all together. This suggests some kind of compiler optimization that is being trigerred | 13:24.25 |
chrisl | rayjj: I see a *clear* increase in calls to monitor_enter/monitor_leave - from the heap allocator | 13:24.35 |
rayjj | triggered even | 13:24.39 |
| chrisl: unfortunately, sampling based doesn't show number of calls, but I considered doing manual instrumentation for that | 13:25.34 |
chrisl | rayjj: I'm trying to get the VS profiler setup to do instrumented profiling | 13:26.31 |
rayjj | well, mutex calls ARE slow on windoze (that's what led to the development of the chunk mem allocator for MT rendering) | 13:26.33 |
| chrisl: whenever I try VS profiling, it crashes my laptop (immediate reboot) | 13:27.13 |
kens | I've used it succesfully in the past, but it usually takes me several hours of poking to get it to work | 13:27.53 |
chrisl | rayjj: well, yes, but I am, frankly, bemused as to where these extra calls are coming from because I don't see a significant different in memory being used | 13:27.53 |
rayjj | chrisl: the other bothersome thing is that profile builds for me is the same time for with and without your change :-( | 13:28.44 |
chrisl | rayjj: actually, I phrased my findings badly: I see a *clear* increase in time spent in monitor_enter/monitor_leave | 13:30.37 |
rayjj | chrisl: I see the slowdown while parsing. I got wrapped up in this and just now pushed the change for -Z: that shows 'parse done' times for PCL | 13:31.00 |
| chrisl: I just emailed the little awk that I use: awk -f pcl-Z.awk log with the output from -Z: from the pcl log that includes parse done | 13:35.50 |
| I have to take my son to school. bbiab | 13:35.58 |
| OK, back (until the next trip). Wed is the day when my two oldest start at different times at the HS, and the youngest about the same time as my daughter | 14:04.45 |
| chrisl: so you don't know if there are extra mutex calls, or simply extra 'lock' delays ? | 14:06.02 |
chrisl_r500 | rayjj: with only sampling it's really hard to know..... on Linux, I see fewer mutex lock/unlocks - but not a huge difference | 14:07.08 |
rayjj | chrisl: I'm adding instrumentation to gp_monitor_ enter/leave | 14:21.27 |
chrisl_r500 | rayjj: okay, I've given up trying to get VS to do instrumentation based profiling - it seems I would *at least* have to reinstall VS2008 :-( | 14:22.23 |
kens | Sounds like the problems I usually have with it | 14:22.51 |
rayjj | chrisl: I haven't tried the VS 2013 tools | 14:22.56 |
chrisl_r500 | I don't have 2013 and only 2012 Express | 14:23.31 |
rayjj | maybe I should really get crazy and build pcl with VS 2013 (in case it's some crazy compiler issue) | 14:23.39 |
chrisl_r500 | What are you using? | 14:23.56 |
rayjj | chrisl: I only have 2013 Express (which may not have the performance tools) | 14:23.59 |
| chrisl: my usual version -- 2008 | 14:24.16 |
chrisl_r500 | Hmm, I guess I could try 2005...... | 14:24.32 |
rayjj | I have 2005, 2008 and 2013 installed | 14:24.35 |
kens | On this machine I only have 2008 installed, but I have some earlier editions on another PC, I could give that a try if required | 14:25.14 |
rayjj | chrisl: but you saw this with Cygwin (gcc), right ? | 14:25.16 |
chrisl_r500 | rayjj: yes, I did | 14:25.32 |
| but can't profile it..... | 14:25.43 |
rayjj | kens: that's OK (for now). If you have cygwin, you could try that ??? | 14:25.52 |
kens | I don't have a real cygwin, but since chrisl does it doesn't seem useful to try it | 14:26.16 |
| I have lots of trouble with cygwin, it usually won't work for me. | 14:26.46 |
rayjj | time for second trip. bbiab | 14:31.04 |
| kens: same for me. | 14:31.21 |
chrisl_r500 | Sample profiles are pretty much useless for this :-( | 14:53.31 |
kens | chrisl : you aren't using an instrumented build ? | 15:04.53 |
chrisl_r500 | kens: I *can* use an instrumenting build, but I can't run the profiler in that mode | 15:06.09 |
kens | Really ? That seems peculiar | 15:06.25 |
| THIs is why I dislike hte tools though, it used to be much easier to tell it you wanted an instrumented buyild :-( | 15:07.06 |
chrisl_r500 | It's apparently because it needs the pdb(??) data for *all* the binaries involved - DLLs etc. And I don't have that | 15:07.23 |
| Which is odd, because I usually choose "Full install"..... | 15:08.52 |
kens | Hmm, me too | 15:09.05 |
| .pdb == program database | 15:09.29 |
| I thought you could exclude the system libraries from instrumentation, maybe I'm wrong | 15:09.50 |
chrisl_r500 | I looked up the error on MSDN, and that's what the "answer" was] | 15:10.18 |
kens | huh :-( | 15:10.27 |
kens2 | Hmm, well, launch the instrumented profiler, and BANG - Blue Screen Of Death..... | 15:16.29 |
chrisl | Sounds like yours works like Ray's! | 15:17.25 |
kens2 | Yeah, MS tool on a MS operating system, what could go wrong..... | 15:17.55 |
| Its possible I don't have some service pack or something but still.... | 15:18.28 |
rayjj | kens: I *think* I have all Win 7 updates and the VS service packs. Part of the problem could be that I'm running 64-bit OS with a brain-dead 32-bit tool | 15:57.46 |
kens | Oh well I'm running 64-bit here as well now, I forgot that | 15:58.23 |
chrisl | rayjj: I've found the problem...... | 16:16.14 |
| The two strings I added to the bg_print structure to hold the file names are what's causing the slow down | 16:17.26 |
Robin_Watts | chrisl: how come? do people have to lock to read them or something? | 16:18.29 |
chrisl | Robin_Watts: I think it's because of the way we end up cloning devices with multi-threaded rendering. It probably means the device trips over into the size that gets a whole block to itself, and gets freed as a single block - usually calling down to the heap allocator | 16:20.38 |
| But removing those two entries in the structure puts performance back where it was, so...... | 16:21.05 |
kens | A strange effect...... | 16:23.43 |
| Can you manage without those strings ? | 16:23.57 |
chrisl | I don't think so, but I can make them pointers, and dynamically manage the memory | 16:25.14 |
kens | Ah, well I guess anythign that works ;) | 16:25.32 |
Robin_Watts | That sounds horrible :( | 16:26.39 |
| but fast is clearly better than slow... | 16:26.55 |
chrisl | Argh, I have to go - I will fix this properly tomorrow....... | 16:40.57 |
rayjj | chrisl_: good find. | 16:47.28 |
| oh, great -- I think I found another bug :-( | 17:22.04 |
mvrhel_laptop | henrys: almost done with this xpswrite stuff. had an icc profile issue that I got resolved. wanted to check for bit depth and spot color image issues. anyone know of a good pdf or PS file that has a variety of images with different bit depths? | 19:13.33 |
| off the top of your head | 19:13.41 |
Robin_Watts | one of the QL test pages, probably :( | 19:20.12 |
mvrhel_laptop | yes. I guess I need to grab them and take a look. will do that after lunch. | 19:21.58 |
| henrys: or I may push what I have so far for you to review, go back to SOT and fix what we talked about, and then swing back to this | 19:22.33 |
| to keep everyone happy... | 19:22.42 |
| think I will do that as I fear I may get in a bit of mess here | 19:23.19 |
fredross-perry | is there a way to build/use gsapi other than Windows? | 19:31.19 |
mvrhel_laptop | fredross-perry: it should be usable on all the platforms | 19:44.36 |
fredross-perry | where is the actual source code for it? | 19:45.03 |
mvrhel_laptop | iapi.h and iapi.c | 19:49.59 |
| fredross-perry: I have not played around with the api though on the non-windows platforms | 19:51.15 |
fredross-perry | I guess Iâll do that. I am using gs to convert from PS/EPS to PDF and it would be nice to get some sort of progress messages back to the main thread. | 19:52.53 |
| Iâm guessing that the code is just catching things that get writtne to stdout or stderror, yes? | 19:53.31 |
| going out for a bit, thanks. | 19:53.44 |
Robin_Watts | fredross-perry: Stuff does not go to stdout/stderr and get 'caught', we handle it internally before it gets that far. | 19:55.13 |
| but conceptually yes, those are your stdout/stderr streams. | 19:55.27 |
fredross-perry | ok, i will look at that code. | 19:56.09 |
mvrhel_laptop | fredross-perry: yes, I use the stdout/stderr hooks to monitor where we are in the process if you take a look at the c# code | 21:05.41 |
| of course, with PS in, you can't do it that way | 21:05.59 |
fredross-perry | why is that? | 21:06.37 |
mvrhel_laptop | iirc don't think you get proper page outputs. You will want to feed in chunks of data to gs. You will know how much data you need to send and you can use a percentage sent . Again this is in the c# code | 21:08.03 |
fredross-perry | yes, iâll look a it. | 21:09.47 |
mvrhel_laptop | ok. let me know if you have any questions | 21:10.20 |
| bbiab | 21:10.21 |
fredross-perry | I see how the c# code is doing it. Makes sense if the time pre chunk is stable. Like, if you have 10 chunks, then each one takes about 1/10 the time. Is that why PS is an issue? | 21:21.40 |
| Maybe gs could (or does?) have a way of throwing off a signal at interesting intervals, that a parent process could ctch and use for progress. | 21:23.01 |
mvrhel_laptop | fredross-perry: unfortunately it is not stable. | 23:22.42 |
| ok. back to fun with SOT | 23:22.58 |
| Forward 1 day (to 2014/09/25)>>> | |