| <<<Back 1 day (to 2015/07/15) | 20150716 |
harry_ | Hi Guys Im am using mupdf 1.4 (if necessary I can update to 1.7). I want to jump to a "named destination". I can load and find all the destinations. I have a pdf_obj* pointer from the "Dests" list / tree but I can not find any information about how to use the pdf_obj* to find out where this named destination is. Please can you instuct me how to find out where the destination is ? | 12:37.00 |
Robin_Watts | harry_: Hi | 12:44.38 |
kens | chrisl I seem to remember there is (or was) a Distiller parameter to control acrobat combining images, I don't suppose you remember what it was ? | 12:45.02 |
Robin_Watts | harry: How did you obtain the pdf_obj * pointer from the Dests list? | 12:45.37 |
| The way the API works, we anticipate people calling through the 'annot' stuff in the fz_page interface. | 12:47.41 |
| Yeah, fz_load_links(ctx, page); | 12:48.54 |
| Then each link is sensibly parsed out. | 12:49.12 |
| If you're going to be accessing the dests tree directly, then you're talking at the pdf_obj * level, and you'll need to be handling the intricacies of the PDF format yourself. | 12:49.46 |
harry_ | Robin: I am using the example "pdf_lookup_dest". In the function "pdf_lookup_name_imp" there is a loop over sorted name array and there my name was found. This function is returning the pdf_obj pointer. | 12:51.14 |
Robin_Watts | harry_: Right. That's an internal function used within the pdf_load_links stuff. | 12:51.45 |
| The public API is to call fz_load_links and work there. | 12:52.02 |
| Is there some reason you can't work at that level ? | 12:52.12 |
harry_ | Robin: In my opinion fz_load_links are loading clickable links of a defined page and not named destinations. Is that wrong ? | 12:54.31 |
Robin_Watts | What 'dest' do you have that is not associated with a clickable link ? | 12:56.04 |
Robin_Watts | grabs food. bbiab. | 12:58.32 |
harry_ | Robin: For example: the Acrobat reader I can start with the option /A namedest=label5 and the pdf will opend at the position label5 | 12:59.54 |
chrisl | kens: I don't, sorry | 13:00.05 |
kens | chrisl not to worry, I'm starting to think its not reelvant anyway. | 13:00.29 |
chrisl | I actually thought Distiller didn't allow control over it | 13:01.13 |
kens | It doesn't from the interace but I *thought* there was a distiller parameter, can't find it though.... | 13:01.34 |
Robin_Watts | harry_: I see. | 13:26.45 |
| harry_: Well, if you've got a pdf_obj * for the named dest you want, you can process that yourself. | 13:28.11 |
| Are you familiar with the different types of object you can have within a PDF file ? | 13:28.37 |
| I believe destinations are generally arrays. For instance [10 /FitH 100] or something. | 13:30.00 |
| You can find out what type of object you got back by calling pdf_is_array etc. And then you can extract values from that, so you can do whatever processing you need. | 13:30.41 |
| Does that help? | 13:30.44 |
harry_ | Robin: Yes that is what i want, I want to process it by myself, but I can not find out where the dest is (page number or whatelse) | 13:31.19 |
Robin_Watts | pdf_print_obj(ctx, obj); might help you on your way. | 13:32.00 |
harry_ | Robin: thank you I will try it | 13:32.46 |
Robin_Watts | kens, chrisl: Mind if I run stuff past you for a mo? | 13:32.52 |
| harry_: Let me know how you get on. | 13:33.01 |
kens | Burble on, I need ot think for a bit | 13:33.05 |
| So a break is welcome | 13:33.15 |
Robin_Watts | I've built a gs.a for android. | 13:33.17 |
kens | I saw you were going to | 13:33.26 |
Robin_Watts | and I've linked that into MuPDF, and I can call it using the gsapi calls. | 13:33.38 |
| The createinstance call works fine. | 13:33.47 |
chrisl | I assume you just tweaked the makefile to pickup the android toolchain? | 13:33.52 |
Robin_Watts | chrisl: yeah, nothing major. | 13:34.11 |
| The init_with_args call returns with a gs_rangecheck. | 13:34.25 |
kens | Suggests a problem reading the initialisation files | 13:34.37 |
Robin_Watts | I can step through and the problem is within gs_main_init2aux | 13:35.02 |
kens | let me just find that in my sources | 13:35.12 |
| Hmm I can't find that.... | 13:36.33 |
chrisl | gs_main_init2aux() doesn't actually generate any error codes | 13:36.35 |
Robin_Watts | yeah, it's within that. Hold on I'm trying to recreate it again now. | 13:36.50 |
| Essentially it gets into running the interpreter and ends up with that code. | 13:37.11 |
| gs_main_run_file_open, I think. | 13:37.58 |
kens | Normally I would set a breakpoitn with a hitcount on the interpreter loop, run till I get the error, then see how many hts there were on the counter and reset to 1 less. Then I could see what operator was cuasing the problem | 13:38.02 |
Robin_Watts | kens: Cunning! | 13:38.14 |
| let me try that, thanks. | 13:38.26 |
kens | do_operator or something like that | 13:38.43 |
chrisl | If it's a debug build, it's do_call_operator() | 13:41.11 |
| 'return code; /* A good place for a conditional breakpoint. */' ;-) | 13:41.39 |
kens | Yes that's the one | 13:41.42 |
Robin_Watts | actually, it might be in lib_file_open | 13:42.51 |
kens | Well that probably makes sense, sicne it'll be running the init (lib) files | 13:43.11 |
| lib_file_open | 13:43.20 |
chrisl | That would be.... odd. It's not an error I'd expect from there | 13:43.29 |
Robin_Watts | For some reason I can't read vars :( | 13:43.56 |
| And annoyingly when I do exactly the same build for linux, it's not going wrong in the same place. | 13:44.18 |
chrisl | Both x86? | 13:44.43 |
Robin_Watts | android is arm. | 13:45.10 |
chrisl | Robin_Watts: Here's the arch.h I used for an arm port: http://pastebin.com/EUpXdVMh | 13:47.29 |
Robin_Watts | oh, gawd. The one I was using was based on x64, not x86. | 13:48.48 |
| That'll have confused things. | 13:48.54 |
chrisl | That won't help..... | 13:49.00 |
Robin_Watts | Let me rebuild with saner values. | 13:49.01 |
henrys | chrisl: do you know how make(sp)(tab) works on linux? I want to do it on the mac to see your targets and I use it anyway... | 13:55.22 |
chrisl | henrys: It doesn't really work with out makefiles | 13:56.54 |
henrys | chrisl: works fine for me on linux | 13:57.32 |
chrisl | It lists >100 targets | 13:57.48 |
henrys | chrisl: well we do have a lot of targets I'm looking at ghostpcl, but I guess you are right it is listing mupdf which shouldn't be there | 13:59.02 |
chrisl | Really? Mine doesn't. It's really the shell that does it, and apparently it's not supported on MacOS | 14:01.12 |
| henrys: ^^ | 14:01.18 |
henrys | chrisl: actually for ghostpdl I have just under 80 targets and all look good, mupdf is in there too from the mooscript business | 14:05.16 |
Robin_Watts | henrys: Hope you're feeling better. | 14:07.56 |
henrys | Robin_Watts: not much and the race is looming... | 14:08.38 |
Robin_Watts | Race is in 3 weeks? | 14:08.52 |
henrys | August 2 | 14:09.21 |
chrisl | Oh, I have a squash tournament on the 2nd as well...... | 14:09.44 |
henrys | looks like no wetsuit too which kind of sucks for me and other poor swimmers that benefit from the bouyancy. | 14:10.43 |
chrisl | Is that rules or weather that dictate it? | 14:11.26 |
henrys | chrisl: water temperature | 14:11.38 |
chrisl | Ah, right | 14:11.53 |
henrys | chrisl: do you also have racketball in the UK or do folks just play squash they look mighty similar to me. | 14:12.19 |
| ? | 14:12.25 |
chrisl | Yes, we have racketball - tends to be the older folks that play racketball, though | 14:12.56 |
| The ball is bigger and much bouncier, rackets are shorter with a larger head. The way the ball bounces means movement around the court tends to be a bit slower, less lunging etc. | 14:14.40 |
| But on the other hand, rallies can go on forever | 14:15.17 |
henrys | fredross-perry: if you fix a bug mark it fixed, customer bugs are "verified" by marcos. | 14:17.37 |
Robin_Watts | chrisl: New gs.a is dying in the same region, with the same -15 value. | 14:34.26 |
| BUT... I can't see how it can possibly have that value. | 14:34.36 |
henrys | Robin_Watts: doesn't -Z# tell you the line? | 14:35.11 |
Robin_Watts | henrys: No stdin/stdout/stderr hooked up under android. | 14:35.35 |
henrys | ugh | 14:35.51 |
kens | Can't you stick a breakpoint on gs_stderr (or whatever its called) and look at the output there ? | 14:36.23 |
Robin_Watts | kens: I can't read fecking variables either :( | 14:38.38 |
kens | Oh, that's not helpful.... | 14:39.13 |
chrisl | Robin_Watts: I'd suggest disabling the compaction/compression/binary encoding when generating the romfs, and see if that helps | 14:53.23 |
henrys | chrisl: I've gotten through it whenever you, marcosw and Robin_Watts are ready. I do wonder if the next release should come with a warning given this, kens change and other changes that might come about prior. | 15:15.55 |
kens | CHange veriosn number ? | 15:16.26 |
jogux | Robin_Watts: use freopen to put stdout/stderr to file? | 15:16.42 |
| (doesn't help with stdin of course :-) ) | 15:16.58 |
Robin_Watts | jogux: It's stdout/stderr I care about. | 15:17.11 |
chrisl | henrys: It was going to come with a *huge* warning. *Hopefully* Ghostscript should be the product with the least risk | 15:19.06 |
Robin_Watts | Ahaha! I have variables. | 15:28.20 |
| OK, so the rangecheck is coming from zsetuserparams. MaxOpStack is being set to 300000 | 15:54.08 |
| And pdef->max_value = -1 | 15:54.28 |
chrisl | Should be pdef->max_value == 4294967295 | 15:58.04 |
Robin_Watts | oh, .... I'm so dumb. I edited the wrong sodding arch file :( | 15:58.10 |
| Or maybe genarch is overriding it? | 15:58.30 |
chrisl | Surely, I don't need to explain that.....? | 15:58.52 |
Robin_Watts | No, I'm just dumb. | 15:59.06 |
chrisl | You can set the arch.h file to use in Makefile | 16:00.01 |
Robin_Watts | Cross compiling for arm is best done on 32bit linux, cos genarch for x86 gives correct values for arm too :) | 16:00.19 |
chrisl | for arm-le...... | 16:00.40 |
Robin_Watts | No one uses arm-be unless they are insane. | 16:00.58 |
| And truly batchshit insane people used mixed endian arms (mentioning no apples) | 16:01.16 |
chrisl | I've had one person ask me about it - open source user, and wouldn't tell me why, so...... | 16:02.08 |
| Robin_Watts: If you have the appropriate libraries, you can just use the "-m32" CFLAG and that'll set everything up for 32 bit Linux | 16:04.56 |
Robin_Watts | Ok, it's getting further. Dying with a range check in gs_getdevice(4) | 16:27.24 |
| oh, wait, maybe that's not a death... is it supposed to do that? | 16:27.48 |
| I could believe I only had 3 devices... | 16:28.00 |
chrisl | It may be checking if pdfwrite is available | 16:28.12 |
Robin_Watts | pdfwrite is one I kept. | 16:28.21 |
| bbox, pdfwrite, gproof. | 16:28.27 |
chrisl | There should be a call shortly before to establish the index to pass to gs_getdevice() - can't remember what it is just now, though | 16:29.49 |
Robin_Watts | I see it called with 0, 1,2,3, 4... | 16:31.01 |
| and 4 fails, so I reckon it's maybe running through all the devices ? | 16:31.17 |
chrisl | Probably yes. It maybe building the name->index mapping | 16:31.38 |
| Robin_Watts: gs_res.ps:%% executing .getdevice with incremental numbers until we get an error. | 16:35.49 |
| Robin_Watts: it should actually do that twice - which is pretty hideous.... | 16:39.42 |
Robin_Watts | OK, I get code = -100 now... | 16:42.11 |
| progress, I get. | 16:42.22 |
| guess. | 16:42.26 |
chrisl | gs_error_Fatal | 16:42.55 |
Robin_Watts | yeah. | 16:43.03 |
chrisl | Can you set conditional break points now? | 16:43.36 |
Robin_Watts | I can. | 16:43.40 |
chrisl | So gs_log_error might be a useful place | 16:43.59 |
Robin_Watts | conditional breakpoints appear to be very slow. | 16:52.20 |
| Might almost be fastest to compile an if into the library :) | 16:52.32 |
chrisl | It must be doing them in software - that is bonkers slow | 16:52.55 |
Robin_Watts | ok, and it's evidently not coming through gs_log_error. | 16:54.55 |
chrisl | Farts :-( | 16:55.26 |
| I take it gs_throw_code() also goes through gs_log_error..... | 16:57.09 |
| Robin_Watts: I take it we are well past the code in imainarg.c? | 16:59.16 |
Robin_Watts | I think we're still in the initaux2 stuff. | 17:00.14 |
chrisl | I'm just looking at places that return gs_error_Fatal without using return_error() and co | 17:01.31 |
fredross-perry | henry: my only choices seem to be confirmed, in progress, awaiting review, and resolved. | 17:39.29 |
henrys | fredross-perry: choose resolved then fixed | 17:39.59 |
| off to lunch | 17:40.31 |
Robin_Watts | Aha. It's a gs_error_Quit (-101) that is being rewritten as a -100 | 17:43.33 |
| And it's because zquit is being called. | 17:50.24 |
chrisl | Well, that makes some sense...... | 17:50.43 |
Robin_Watts | What's the implementation for == called? | 17:51.40 |
chrisl | It's probably defined in Postscript | 17:52.18 |
Robin_Watts | Is there something I can trap stdout/err writes to in C ? | 17:53.02 |
chrisl | s_stdout_write_process() maybe? | 17:53.40 |
| Robin_Watts: You could also do: -sstdout=filename in your command line | 17:55.21 |
chrisl | thinks we should also have a -sstderr=filename | 17:56.12 |
Robin_Watts | Unable to open the initial device, quitting. | 17:56.33 |
| OK, so how do I find out what the initial device is? | 17:56.52 |
| I have GS_DEV_DEFAULT="bbox" in the makefile. | 17:57.37 |
chrisl | I'd guess the initial device would be the nulldevice | 17:57.47 |
Robin_Watts | Ok, zsetdevice is called. dev = null device, and gs_setdevice_no_erase returns -9 | 18:01.22 |
chrisl | null device should be in the build..... | 18:02.29 |
Robin_Watts | null device isn't mentioned in Makefile. | 18:03.38 |
chrisl | No, it never is - it should be included implicitly | 18:04.04 |
Robin_Watts | ok. it's failing the call to default_subclass_open_device. | 18:04.31 |
chrisl | I wonder why it's calling that? | 18:05.49 |
Robin_Watts | -dFirstPage= and -dLastPage= : ) | 18:06.21 |
chrisl | Oh, right, start simple...... | 18:06.36 |
Robin_Watts | The code that calls this using an exe works fine. | 18:07.33 |
chrisl | I'd have started with just "-c showpage quit" | 18:07.42 |
Robin_Watts | hence I am doing exactly the same call using gsapi. | 18:07.46 |
| chrisl: If i'd been working from scratch, I would have too. | 18:07.57 |
| OK. It's into the gproof device (or the prn setup at least, and it's failing with -9 in gdev_prn_allocate_memory. | 18:12.13 |
chrisl | Robin_Watts: you probably want to change BAND_LIST_STORAGE to "memory" | 18:15.17 |
Robin_Watts | chrisl: possibly, but I'm happy for it to hit files, I think. | 18:15.39 |
| gdev_prn_setup_as_command_list is failing. | 18:16.46 |
| I think you're probably right :) | 18:16.54 |
chrisl | I'd have thought file access would be too slow on a mobile device, anyway | 18:17.28 |
| It also occurs to me that mkstemp() might not be doing the right thing on an Android device...... | 18:18.48 |
Robin_Watts | yes, it's file opening that's failing. | 18:20.40 |
chrisl | You can tell gs where to put it's temp files..... | 18:21.24 |
| Oh, but it's an environment variable, not a command line option :-( | 18:22.33 |
Robin_Watts | I could setenv before I call :) | 18:38.30 |
| but I'm testing with a memory clist build now. | 18:38.53 |
chrisl | That assumes setenv has any effect on android..... | 18:39.20 |
Robin_Watts | ok, new and inventive problems now. | 18:41.13 |
| Error: /invalidfileaccess | 18:43.08 |
| in --showpage-- | 18:43.18 |
chrisl | Rght, so it can't open the output file | 18:43.30 |
Robin_Watts | Read-only file system. | 18:43.49 |
| Yeah. | 18:43.51 |
| OK, I can work with that. | 18:43.54 |
chrisl | Can you direct to /dev/null ? | 18:44.11 |
Robin_Watts | Input file is: "/storage/emulated/0/Download/adobe_supplement_iso32000_1.pdf" | 18:44.49 |
| Output file is: "./gprf_0_nCbxEXqgmO" | 18:45.09 |
| ok. So I need to rework that a bit. | 18:45.53 |
chrisl | I was just thinking if there's a /dev/null you could confirm that gs is running to completion | 18:46.16 |
Robin_Watts | bah, where's your sense of fun? | 18:48.23 |
| oh, it's 8pm at night, I guess it left already :) | 18:48.33 |
chrisl | About half an hour ago...... | 18:48.52 |
Robin_Watts | I'm going to give up in a mo, honest. | 18:49.18 |
chrisl | And I am finishing RSN...... | 18:49.29 |
Robin_Watts | ok, gs completes, but I'm getting bad page displays in mupdf. | 18:51.53 |
| so this seems like a good place to drop it for the night. | 18:52.02 |
| Thanks Chrisl! | 18:52.05 |
chrisl | If my half blind stabs in the dark helped - you're welcome :-) | 18:52.29 |
| Goodnight! | 18:53.50 |
| Forward 1 day (to 2015/07/17)>>> | |