| <<<Back 1 day (to 2014/04/06) | 2014/04/07 |
Ziai | guys, need help. I am trying to implement ghostscript on c# | 09:40.39 |
kens | You can't 'implement' Ghostscript on C#. You could write a C# wrapper to use the Ghostscript DLL, and in deed such a thing already exists I believe | 09:41.20 |
Ziai | it sort of works. I am using ghostscriptsharp wrapper https://github.com/mephraim/ghostscriptsharp | 09:41.43 |
| cannot control the resolutions though . | 09:42.05 |
kens | Bear in mind that we know nothgin about C# and are not repsonsible for that code. | 09:42.05 |
| -r is usually the resolution control for Ghistscript | 09:42.59 |
Ziai | i give it 500 and 300 and it spits out png 5200+ x 3000+ | 09:42.59 |
kens | WHy is this a surprise ? | 09:43.11 |
| WHat is the media size of your original PDF ? | 09:43.25 |
Ziai | i assumed it will behave somewhat like imagemagick | 09:43.51 |
kens | I have no idea how ImageMagick behaves | 09:44.05 |
Ziai | ic | 09:44.47 |
kens | If you have a PDF which has a media of 10 inches wide, and you set the resolution to 300 then your resulting PNG will be 3000 pixels wide. | 09:44.51 |
| resolution is quoted in dpi | 09:45.02 |
Ziai | ic so i had to give inches | 09:45.30 |
| not pixes | 09:45.35 |
kens | No. | 09:45.36 |
Ziai | pixels | 09:45.37 |
kens | No to both | 09:45.41 |
Ziai | o.O | 09:45.45 |
kens | If you want a fixed media size you have to tell Ghostscript what media size ot use. Resolution is not at all the same thing as media size | 09:46.06 |
Ziai | CallAPI(GetArgs(inputPath, outputPath, firstPage, lastPage, width, height)); | 09:46.31 |
kens | Resolution determines how many pixels there are per inch of output. YOu multiply the resolution by the media size to find out the width/height in pixels of the output | 09:46.42 |
Ziai | ic | 09:46.57 |
kens | Ziai well width and height are notthing to do with resolution | 09:47.00 |
| I cannot tell you what the wrapper is doing with that call, its not a Ghostscript call. | 09:47.31 |
Ziai | got it! | 09:47.32 |
| but then.. from such API i have no way to resize my image. I can only adjust DPI.. correct? | 09:48.26 |
kens | If you want a specific size, you can set the width and height, and then set FIXEDMEDIA. If you also set FitPage to true then GS will scale the output to fit the specific size (scales isomorphically so the least scaling required to fit the content to the media in bot directions) | 09:48.44 |
| s/bot/both/ | 09:49.03 |
| However, I can't tell you how to do any of that using the C# wrapper | 09:49.36 |
Ziai | gtg 20min hope u ll be around | 09:49.44 |
| is there any documentation on api? | 09:49.54 |
| i could look up? | 09:49.59 |
kens | There's also a .net project for GS, and the developer of that crops up here, you might be better using that. | 09:50.02 |
| Our API is documented, yes, I have no idea about the C# code, but since it says 'see the souce' I woudl doubt it | 09:50.29 |
athysirus | hello | 09:58.49 |
| i have a problem with mupdf for Windows Phone, anyone can help me???? | 10:00.12 |
kens | Not unless you say what your problem is. | 10:00.25 |
| Also the MuPDF developers are (mostly) on vacation today but we can try and help, and your comments will be logged here for their perusal when they return | 10:01.00 |
athysirus | i create a document (_document = await Task.Factory.StartNew(() => Document.Create(fileName, DocumentType.PDF, dpi));), and it throw an exception: "An exception of type 'System.ArgumentException' occurred in YBookReader.DLL but was not handled in user code, WinRT information: The parameter is incorrect." | 10:01.40 |
kens | Well BookReader.DLL is not part of MuPDF | 10:02.02 |
| At least, not that I'm aware of anyway | 10:02.30 |
| I'm afraid I know nothgin about Windows Phone, so the code snippet doesn't mean anything to me, but none of that looks like its using MuPDF | 10:03.24 |
| Jogux, you know anythgin about the WIndows RT port of MuPDF ? I know Michael is using it.... | 10:04.10 |
athysirus | i use MuPDFWinRT.dll | 10:04.52 |
kens | athysirus : I'm sure you do but as I say I know very little about WIndows Phone, and the call you are making doesn't 'look like' a MuPDF call, and the error you quote is not in MuPDFWinRT.dll | 10:05.38 |
athysirus | i find it in https://bitbucket.org/mishauliutin/pdf-reader-for-wp8-public | 10:05.43 |
kens | 'PDF Reqader' is nothing to do with us | 10:06.42 |
| It looks like someone has implemented a GPL PDF Reader using MuPDF< but that does not make it 'MuPDF@ | 10:07.05 |
| If you are using functions exposed by 'PDF Reader' then you need to go to the deveopers of that application and ask them, we cannot help you with that. | 10:07.42 |
| I notice it does not mention MuPDF anywhere, but does offer commercial licencing.... | 10:08.54 |
chrisl | MuPDF is under "xternals"..... | 10:09.28 |
kens | Hmm I don't see an 'xternals' link | 10:09.51 |
athysirus | yes | 10:09.57 |
kens | But if they are offering commercial licences, I think they will need a licence from Artifex also | 10:10.20 |
athysirus | that project have "xternals" folder | 10:10.22 |
chrisl | kens: in the "Source" "tab" | 10:10.22 |
kens | Ah, I hadn't got thsat far | 10:10.35 |
chrisl | kens: Yeh, I think a quick mail to Miles might be a good idea | 10:10.43 |
kens | I was thinking so, yes | 10:10.51 |
| I'll do that | 10:10.54 |
Jogux | kens : I don't really know anything about mupdf, sorry | 10:11.34 |
kens | athysirus : as I said, if you are using functionality exposed by some component of this application we are unable to help you. It looks to me like you are, and it looks like its failing somewhere other than MuPDF. I suggest you take up your problem with the 'PDF Reader' developer(s) | 10:12.02 |
athysirus | I have contacted the PDF reader developers, but they reply: "Ocius support is for supporting PDF reader users. Any questions regarding MuPdf wrapper should be asked at github, where the project under open source." :( | 10:14.03 |
kens | Tell them the qustion isn't regarding MuPDF. As far as I can see its not MuPDF that's failing and you are not calling a MuPDF function. I could be mistaken, I'm not one of the MuPDF developers, but an error thrown from a DLL other than MuPDFWinRT.dll doesn't make me think its our error. | 10:15.28 |
chrisl | I'm guessing they are using this: https://github.com/MishaUliutin/MuPDF.WinRT | 10:15.53 |
| Which is still nothing to do with us.... | 10:16.00 |
kens | So now we're up to 2 levels of indirection, neither of which we cna help with | 10:16.15 |
| Looks like its the same developer to me | 10:16.33 |
athysirus | i create an app to read pdf file, but some files can be read and others don't | 10:17.00 |
kens | mishauliutin at 'PDF Reader' and 'Mish Uliutin' at MuPDF.WinRT | 10:17.14 |
| athysirus : I'm sorry to keep reiterating this but I don't see any way we can help you | 10:17.41 |
chrisl | Yes, that looks likely - and makes that reply doubly cr*p | 10:17.45 |
kens | Indeed so | 10:17.52 |
| athysirus : you need to contact Misha Uliutin and tell him the problem seems to be in one or another piece of his code. | 10:18.28 |
athysirus | ok! thank for your help :) | 10:19.24 |
kens | Sorry we couldn't help more | 10:19.33 |
Ziai | kees: I could pack that .net project into a dll and use it as a lib right? | 10:25.28 |
kens | Ziai You're outside my comfort zone asking questions like that :-) | 10:25.51 |
| But I don't see any reason why not | 10:25.57 |
Ziai | sorry kees, havent done things like that in some time. I am still an undergrad. | 10:26.57 |
kens | Josip Habjan has been pretty responsive in the past (he just now updated his web site when I warned him it had a malware link), and he seems keen to engage with his user base | 10:26.58 |
| Grr, Miranda crashed on me | 10:27.59 |
| Ziai I don't know much about Windows Phone *, C# or .NET. I try to avoid all of the above topics ;-) | 10:28.27 |
| I would imagine you could use Josip's code in some kind of DLL, but I don't know any specifics at all | 10:29.02 |
Ziai | Ill try using his stuff. seems to be way better then that other wrapper i found earlier on. :) | 10:33.45 |
| Ty! :) | 10:33.49 |
kens | You're welcome | 10:33.53 |
kens | is getting confused between MuPDF and Ghostscript today..... | 10:35.39 |
jhabjan | Ziai: Ghostscript.NET (.net wrapper around the Ghostscript library ) is already a library (.dll) which you can easily reference to your .NET project and use it in a similar way you use Ghostscript via command line and more... | 10:50.51 |
Ziai | jhabjan: thank you. i'll have a go with it in a minute.. :) | 11:04.13 |
jhabjan | Ziai: ok, gr8 | 11:05.45 |
Ziai | jhabjan: which sample show how to convert PDF to PNGs with a geometry resize option? | 11:17.15 |
| jhabjan: or anything close to it.. | 11:21.57 |
jhabjan | Ziai: you can take a look at DeviceUsageSample.cs | 11:25.43 |
Ziai | ty! | 11:26.04 |
kens | From the command line something like -sDEVICE=png16m -g<width in pixels>x<height in pixels> -dFitPage <input.pdf> | 11:27.10 |
jhabjan | Ziai: so, with what kens suggested your code should look similar to this: http://pastebin.com/NVhqzd9a | 11:30.05 |
| Ziai: or like this: http://pastebin.com/qRStqkdB (I forgot to add -dFitPage earlier) | 11:31.55 |
Ziai | jhabjan: ran into an exception An unhandled exception of type 'Ghostscript.NET.GhostscriptLibraryNotInstalledException' occurred in Ghostscript.NET.dll | 11:34.52 |
| i've referenced dll provided. I am not using the namespace. began with an empty console application | 11:35.37 |
| ill have a look at your links now | 11:35.44 |
jhabjan | Ziai: do you have Ghostscript native library installed ? (from the http://www.ghostscript.com/download/gsdnld.html) | 11:35.54 |
| Ziai: Ghostscript native library is not shipped with the Ghostscript.NET. It's a separate installation. | 11:36.23 |
Ziai | ow | 11:37.35 |
| ups | 11:37.35 |
jhabjan | Ziai: once you install a native Ghostscript library, Ghostscript.NET will find it automatically at runtime (by registry entries set by Ghostscript installer ) | 11:37.36 |
kens | lunches, will be back later | 11:39.18 |
madmoose | I found a very simple bug in pdf export. pdf_count_pages caches the page count so if you append multiple pages to a pdf it keeps putting them in after page 1. | 11:45.12 |
robin_watts_mac | madmoose: Yes, that's probably true. Can you mark it on bugs.ghostscript.com for us please? | 11:50.05 |
| (I'm on holiday) | 11:50.13 |
madmoose | http://bugs.ghostscript.com/show_bug.cgi?id=695137 | 11:58.29 |
Ziai | jhabjan: happy days! it did work! :) ty! where can I find out more about what setting there are? I imagine you wrote a lot of them.. | 11:59.42 |
| for instance. it's nice that it made the thing of the size I asked. but it filled it up with white colour. I'd prefer transparent or even better.. expand the image so it fits to my given size. but not neccesserely make it that big | 12:01.04 |
jhabjan | Ziai: I'we implemented base switches for png devices, custom ones you can find here: http://ghostscript.com/doc/current/Use.htm | 12:01.17 |
| Ziai: also, for more details about the devices you can take look at here: http://ghostscript.com/doc/current/Devices.htm | 12:05.35 |
Ziai | struggling to find what I need.. | 12:25.19 |
jhabjan | Ziai: I'm sure someone here will help you out with the question about background colour / transparency as this is out of my scope... | 12:33.44 |
Ziai | sure! ty anyways. you gave a green light for what I am planning to do. :) | 12:35.04 |
jhabjan | gr8, I'm glad I could help | 12:35.42 |
chrisl_r500 | Ziai: for a transparent backdrop in a png, you need to use the pngalpha device - but there are some caveats about it with PDFs with transparency blending in them | 12:40.09 |
Ziai | it just is. i need all of the image that is in PDF but i need to scale it up/down so it fits my geometry. (atm it filles it up with white space) | 12:44.09 |
| need to keep my files small if possible ... | 12:44.50 |
chrisl_r500 | -dFitPage should scale the output | 12:45.01 |
Ziai | all it does it puts it in the center | 12:47.07 |
chrisl_r500 | It should fill the output in at least one dimension | 12:47.55 |
Ziai | what do you mean one dimension? o.O | 12:48.26 |
chrisl_r500 | You have two dimensions, the PDF output should scale to fit one of them | 12:49.07 |
Ziai | can't it figure out which one will be bounding it's size itself? | 12:52.33 |
| are you familiar with imagemagick? | 12:53.37 |
| there is a function i use to transform my image: convert input -resize 1280x752 output | 12:54.58 |
| it take the input and makes it fit the given geometry. but doesnt make it that size unless it's exact ratio... | 12:55.46 |
| that's my goal | 12:55.51 |
| now. ghostsript jhabjan provided makes transforms my input page into this geometry. and fills it up with white space | 12:56.44 |
| (background..) | 12:56.54 |
chrisl_r500 | Ziai: what version of Ghostscript are you using? | 13:02.04 |
| sorry have to go out for a while.... | 13:04.18 |
henrys | thanks for following up Jogux | 13:31.28 |
| with mace | 13:31.38 |
Jogux | np | 13:32.07 |
Ziai | how to check? i am not sure. to be frank. couldnt get newest dll to work so used something i had from other wrapper.. | 13:40.37 |
kens | Just starting up Ghostscript will give you the version number. Run it from the command shell | 13:41.07 |
norbertj | henrys: I just entered a new bug on pcl 695138, | 13:43.59 |
henrys | norbertj: okay I'll have a look | 13:44.25 |
norbertj | henrys: including a fix :) | 13:44.57 |
henrys | my favorite kind of bug report ;-) | 13:45.28 |
jhabjan | Ziai: if you want to find out which Ghostscript version Ghostscript.NET use, you can run something like this: http://pastebin.com/CEvzKnWt | 13:48.30 |
Ziai | the one i've installed is 9.14 | 13:49.24 |
| the one i use in my .net project is older. | 13:49.31 |
| but new one is not usable | 13:49.37 |
kens | Why ? | 13:49.41 |
Ziai | when i try to import it. Visual Studio gives an error | 13:49.52 |
| not valid assembly or COM.. | 13:50.07 |
kens | Well that's true, it neither. | 13:50.20 |
| Its a DLL | 13:50.33 |
Ziai | yea.other one is also a ddl | 13:50.46 |
kens | But you got it wrapped up in some kind of C# wrapper | 13:51.15 |
| AIUI Ghostscript.Net doesn't need you to 'import' it to Visual Studio, it will find and use the DLL itself | 13:51.40 |
| The Ghostscript DLL that is. | 13:52.26 |
Ziai | i am using what jhabjan gave me. his wrapper. but he explained that ghostscript itself is not included there fore i had to include it myself if i wanted to use his wrapper | 13:53.06 |
kens | No, he said you had to *install* it yourself, not 'include' it | 13:53.29 |
Ziai | o.O but but.. it was installllled. | 13:53.58 |
| and it's just a test run i wont be using this computer | 13:54.15 |
kens | I'm not sure Ghostscript was previously installed. | 13:54.29 |
Ziai | ok | 13:54.47 |
| :D | 13:54.48 |
kens | You had previously used a DLL which you got from Ghostscriptsharp | 13:54.48 |
| THis is not Ghostscript. | 13:54.56 |
Ziai | ill do it all over again tomorrow | 13:55.10 |
kens | Just don't 'include' the Ghostscript DLL in the .NET stuff. As far as I can see you should not need to | 13:55.41 |
| Ghostscript.NET will look for an existing Ghostscript installation, and use it if it finds it. | 13:56.02 |
jhabjan | Ziai: When native Ghostscript library is installed, it writes some registry entries of the installation path | 13:56.03 |
| Ziai: Ghostscript.NET looks for that registry entries and loads native Ghostscript library at runtime | 13:56.32 |
| Ziai: there is no need to reference a native Ghostscritp library into your project | 13:57.07 |
| Ziai: it's pritty simple, just install native Ghostscript library and in your project reference managed Ghostscript.NET library. | 13:57.36 |
| I hope that clears the confusion ;-) | 14:00.06 |
henrys | norbertj: that change was added by somebody I'm sure to fix something but no test file noted in the commit (d3a3f3f49637) - darn. | 14:03.14 |
Ziai | it does . but now i have a problem | 14:03.27 |
kens | had that experience just the other day :-( | 14:03.35 |
Ziai | sry for you kenss | 14:03.55 |
kens | I was talking to henrys ;-) | 14:04.07 |
Ziai | jhabjan: can i change Ghostscript.NET to look it up from elsewhere? ie source code or dll or sth | 14:05.22 |
henrys | kens:this person wasn't a real champion of sentences and spelling either, I didn't even have to look in the "blame" log | 14:07.38 |
kens | aha :-) | 14:07.47 |
norbertj | henrys: you agree that it's a bug? | 14:10.40 |
henrys | norbertj: I'd say go ahead and commit if you can clean up the comment. combined is misspelled and it is not in a proper sentence. | 14:10.45 |
jhabjan | Ziai: yep, take a look at this sample: http://pastebin.com/PkHBvnYj | 14:11.44 |
henrys | norbertj: not your comments the previous comments | 14:11.51 |
Ziai | jhabjan: that is fantastic! and you guys are the most supportive community ever! :) | 14:20.39 |
| as I said. i'll have a go properly tomorrow. boss other plans for me now.. | 14:21.23 |
jhabjan | Ziai: no worries | 14:21.32 |
Ziai | :) | 14:21.36 |
| where are you located guys? | 14:21.44 |
kens | is in the UK | 14:21.52 |
Ziai | was in UK, Scotland, Aberdeen. | 14:22.08 |
Ziai | now lives in Lithuania.. back home you see.. | 14:22.23 |
| :P | 14:22.27 |
kens | hOME IS ALWAYS NICE | 14:23.08 |
| OOps caps lock sorry all | 14:23.19 |
jhabjan | I'm from Croatia | 14:24.16 |
marcosw | is ghostbot down or is there just very little rc traffic today? | 17:36.02 |
Jogux | no one's talking much | 17:36.18 |
| the log seems to match up with my client :) | 17:36.40 |
marcosw | thx. I guess everyone is either busy or on vacation⦠| 17:37.12 |
Jogux | is busy battling iOS SO, certainly. :) | 17:40.06 |
| henrys : how much do we care about the bluetooth keyboard thing on iOS? I have a fix that gets the cursor keys working (on iOS 7), but it's revealed that normal text input doesn't work as well as you'd like (but fixing that is going to require additions to the core picsel library), and I think there's more to be done to polish BT keyboard support too. I could easily burn a week or more I reckon. | 17:44.14 |
henrys | Jogux: well the customer only asked for cursor keys so we get that in and document the other shortcomings so paul can respond reasonably to the customer. | 17:49.45 |
Jogux | nods | 17:50.33 |
| they don't autorepeat, but that's an iOS limitation. (I presume MS has the same issue; will check in the morning) | 17:50.51 |
ray_laptop | chrisl_away: WOW!! Fast response to cust 532 :-) | 21:06.50 |
| chrisl_away: BTW, I don't know whether it is relevant, but cust 532 uses UFST. Does that still uses AFS/FT for Type42 or does it use UFST ? | 21:07.57 |
| Forward 1 day (to 2014/04/08)>>> | |