| <<<Back 1 day (to 2016/03/13) | 20160314 |
kent3116 | Morning. Onto my next task - Printing. I've been looking at the SumatraPDF source - which has printing, but appears to do so by generating each page as an image and printing that. Is there a native way to print PDF's using mupdf ? or is that the only way ? | 06:42.07 |
| I need to support Windows 7 or newer | 06:42.17 |
tor8 | avih: see the branch 'typed-arrays' on http://git.ghostscript.com/?p=user/tor/mujs.git;a=shortlog;h=refs/heads/typed-arrays | 09:56.28 |
| there's a test commit to add 'fast' arrays... unfortunately it doesn't work with all language features | 09:56.45 |
| things like Object.keys, delete operator, etc | 09:57.06 |
ferter | hi everyone! | 10:50.05 |
| i've got a question about pdf reference. in what type of encoding should content of a Free Text Annotation be represented? | 10:51.34 |
kens | Its in the PDF reference. | 10:51.47 |
mrev1l | hi guys! | 13:17.28 |
| may i ask guidance on how does pdf_from_ucs2 function works? | 13:17.48 |
kens | What product is ths ? | 13:18.10 |
mrev1l | sorry? | 13:18.35 |
| mupdf | 13:18.39 |
kens | What produce does your question relate to ? | 13:18.47 |
| product* | 13:18.52 |
mrev1l | i;m working with mupdf | 13:19.02 |
kens | Then you'll need either tor8 or Robin_Watts to answer your question | 13:19.21 |
mrev1l | and i asume, i need to wait | 13:19.43 |
kens | Seems so yes | 13:19.51 |
mrev1l | for them to show up | 13:19.52 |
tor8 | mrev1l: the comment at the top of the function says "Convert UCS-2 string into PdfDocEncoding" | 13:19.55 |
| this is used for authentication of passwords on windows | 13:20.18 |
| since PDF passwords are assumed to be in PdfDocEncoding (and not unicode) | 13:20.39 |
Robin_Watts | tor8: In some cases, at least :) | 13:20.50 |
malc_ | tor8: ucs2 is this fixed width thing win32 and java uses? | 13:20.52 |
tor8 | Robin_Watts: only by sumatrapdf; so I'm not entirely convinced of the accuracy of my previous statement | 13:21.51 |
| malc_: ucs2 is the crappy 16-bit fixed width thing from win32 and java | 13:22.07 |
mrev1l | the reason a ask is cause it returns NULL. and as far as i can tell from debug session, this happens, because "fail, if a character can't be encoded" hapenns | 13:24.04 |
| so i'm wondering what it wrong with source string data | 13:24.36 |
| i provide | 13:24.39 |
| is wrong* | 13:24.45 |
kens | Not all UCS2 code points have a corresponding character code in PDFDocEncoding | 13:24.54 |
tor8 | mrev1l: it might help if you told us what you're trying to accomplish | 13:26.26 |
kens | tor8 THat's *my* line! :-) | 13:26.58 |
mrev1l | i've been working with annotations lately. and i found out, that text data i'm trying to save into pdf act weird when i use cyrillic letters. then i looked at how we parse free text annot data and came across pdf_to_ucs2_buf function. so i assumed, taking a cyrillic characters and dragging them through pdf_from_ucs2 would solve my problem. apparently, i'm losing something | 13:30.23 |
| not being dead-sure on how it is working, i seek your guidance) | 13:31.32 |
| hope i made myself clear.. | 13:32.03 |
tor8 | mrev1l: despite the naming similarity, pdf_from_ucs2 is not the mirror of pdf_to_ucs2 | 13:32.20 |
| mrev1l: content strings in annotations can be 16-bit strings if you just prepend a byte order mark | 13:33.03 |
| pdf_to_ucs2_buf looks at the PDF string, and if it has a byte-order mark it decodes it into host byte order | 13:33.37 |
| and if it dosen't have a byte order mark, it assumes PdfDocEncoding and decodes that | 13:33.50 |
malc_ | mrev1l: just tried, annots with cyrillic work as expected | 13:34.27 |
mrev1l | ok, thank you, this information is quite helpful | 13:36.51 |
malc_ | eh? they work as i coded and expected them to work.. | 13:37.49 |
| no idea what you have expected | 13:37.55 |
mrev1l | malc_: you mean you added an annotation to a file via mupdf or..? | 13:39.18 |
malc_ | mrev1l: via my own program that uses mupdf the library | 13:41.55 |
mrev1l | malc_: may you share some snippet on what you put as a 4th parameter into pdf_set_free_text_details then? | 13:43.46 |
malc_ | mrev1l: i don't use pdf_set_free_text_details at all, http://repo.or.cz/llpp.git/blob/e798d4037afecbe7308ae4adc567cfe90a8accb3:/link.c FWIW | 13:45.54 |
nmpribeiro | hi there. how can I check the attributes of a pclxl file? I suppose gs should allow me to get info on a pcl file right? | 13:49.20 |
Robin_Watts | nmpribeiro: gs? No. | 13:49.30 |
nmpribeiro | Robin_Watts: er... k thanks anyway :) | 13:49.49 |
kens | What do you mean by 'check attributes' and no GS won't let yopu 'get into' a PCL file, it will interporet it for you and render the results though | 13:49.56 |
nmpribeiro | kens: I see, a converter then | 13:50.12 |
Robin_Watts | You might hope that ghostpcl would, but I'm not sure whether that can do anything except interpret the file. | 13:50.18 |
| You can run it with -Z! (IIRC) and it will output debug information which may or may not be useful. | 13:50.41 |
kens | nmpribeiro : no, not a converter, an interpreter and rasteriser, just like you might expect from a printer | 13:50.48 |
Robin_Watts | Or maybe -ZI ? | 13:51.19 |
nmpribeiro | let me check | 13:51.32 |
kens | I htnk ZI but it depends what you want to see | 13:51.37 |
chrisl | I think -ZI only works with debug builds (most -Z options do) | 13:51.55 |
nmpribeiro | Error: /undefined in ââ | 13:52.24 |
kens | Yes -ZI only works with debug builds, but it does dump some information | 13:52.35 |
| nm are you trying to use a PCL file with Ghostscript ? | 13:52.48 |
| Because that won't work | 13:52.53 |
nmpribeiro | nevermind... it's a spool control file... doesn't work w gs | 13:53.02 |
kens | Ghostscript only interprets PDF and PostScript, fior PCL you need GhostPCL | 13:53.11 |
nmpribeiro | kens: will check it | 13:53.32 |
Robin_Watts | nmpribeiro: I meant "You can run ghostpcl with -Z! or -ZI" not gs. | 13:55.23 |
HenryStiles | -ZI dumps *everything*, i.e. you can create the original file from the debug output. | 13:55.32 |
kens | I bet you can't with PostScirp tor PDF input :) | 13:56.06 |
HenryStiles | but if it's XL he wants pxldis.py in the tools directory. Output is nicer and only requires python | 13:56.07 |
nmpribeiro | hum... | 13:56.39 |
HenryStiles | I'm sorry I meant -ZI for ghostpcl. I thought that's what we were discussing | 13:56.44 |
nmpribeiro | gpcl6 gives me a bunch of pages but at least I'm getting somewhere | 13:57.00 |
kens | We were sort of discussing both, because we don't really knopw what the input is | 13:57.00 |
| RIght, so its PCL or PXL then | 13:57.10 |
nmpribeiro | $ gpcl6 -ZI /var/spool/cups/d00025-001 outputs stuff like %%BoundingBox: 0 0 0 0 %%HiResBoundingBox: 0.000000 0.000000 0.000000 0.000000 End of page 404, press <enter> to continue. | 13:57.18 |
kens | If its PXL then use the disassembler, other wise you can try -ZI but it still isn't clear what ytou actually want | 13:57.31 |
HenryStiles | nmpribeiro: you need a debug build forr - | 13:57.49 |
kens | %%BoundingBox is PostScript comments | 13:57.50 |
HenryStiles | nmpribeiro: you need a debug build for -ZI as others said | 13:58.05 |
kens | If you send PostScript to a PCL device it will print the text of the progtram | 13:58.11 |
| I thnk at ths stage you probably need to share an example | 13:58.34 |
HenryStiles | it's output that because the default device is the bounding box | 13:58.40 |
kens | Ah, makes sense | 13:58.47 |
| THen its a need for a debug build | 13:58.57 |
nmpribeiro | kens: well, actually I just want do issue a command to analyse a spool/cups file and check for it's attributes. nothing more | 14:00.22 |
| I will read more about this gpcl6 | 14:00.43 |
kens | As I sadi, what do you mean by 'attributes' ? | 14:00.44 |
Robin_Watts | nmpribeiro: A spool/cups file is, AIUI, literally data that will be thrown at a printer. | 14:01.19 |
kens | My understanding is that *current* CUPS spool files are PDF, except, obviously, the final file being sent to the printer | 14:01.30 |
nmpribeiro | something like this per page: 1*Plain*A4*Portrait*Auto*Simplex*BW | 14:01.30 |
Robin_Watts | As such, it might be PS or PCL or PXL or any other languages. | 14:01.39 |
| nmpribeiro: That sounds like the kind of information that cups will hold elsewhere - not in the spool files. | 14:02.01 |
nmpribeiro | Robin_Watts: haven't found it on cups. I'm using pkpgcounter from pykota | 14:02.26 |
chrisl | Perhaps tkamppeter can give a hint...... | 14:02.47 |
kens | Well, if the informatoin is required by the printer, it'll be in the fainl file, however PDF for example) can't hold information on duplexing and so on | 14:02.50 |
nmpribeiro | but some files are outside PCLXL Protocol Class 2.0 Specification... so... I'm evaluating other possibilites (and learning a lot heh) | 14:03.17 |
kens | As far as I know (and tkamppeter would know better) intermediate sppol files in CUPS are held in PDF format. Only the final file being sent to the printer will be in the format required by the printer. Obviously that need not be PCL, it could be PostScript, PDF, XPS, ESC/P, or any of a myraid of other formats. | 14:04.31 |
nmpribeiro | kens: yes, and pkpgcounter does iterate over them. but my driver is sending a PCLXL a little too advanced for pkpgcounter to get it | 14:05.39 |
tkamppeter | kens, yes this is the case. The common, device-independent format is PDF. All incoming file formats are turned to PDF, processed as PDF, and then turned to the format which the printer needs. | 14:06.24 |
kens | I guess I don't understand your setup enoigh to be able to offer anything | 14:06.25 |
nmpribeiro | kens: for instance: pkpgcounter /var/spool/cups/d00027-001 -d, outputs: Input file is in the 'PCLXL (aka PCL6)' file format. Byte at 3cfc8 is out of the PCLXL Protocol Class 2.0 Specification (...) 1*Plain*A4*Landscape*Auto*Simplex*Color | 14:06.39 |
| and pkpgcounter uses gpcl6 | 14:06.54 |
| (just understood that now) | 14:07.04 |
| i'm looking at pkpgcounter source code | 14:07.24 |
tkamppeter | kens, chrisl, I do not use or package pykota. So I do not know about its internals and especially not whether it did the transition from the former PostScript workflow to the current PDF workflow. | 14:08.12 |
kens | tkamppeter : you know more than we do, or at least, more than *I* do :-) | 14:08.36 |
nmpribeiro | tkamppeter: but pykota's pkpgcounter does grab the info from pcl6/gpcl6. that's why I ended up here. I want to know how it does that | 14:09.06 |
kens | I very much doubt we can tell you | 14:09.29 |
nmpribeiro | tought you guys could give me a hint. never mind | 14:09.31 |
| thanks anyway. I'm trying to read pkpgcounter source code... might give me some hint | 14:09.55 |
| if anyone is curious: http://svn.pykota.com/pkpgcounter/trunk/pkpgpdls/pclxl.py | 14:10.24 |
HenryStiles | nmpribeiro: so you've created a driver that produce pcl and pkpgcounter does not work with it. Is that the issue? | 14:22.30 |
nmpribeiro | HenryStiles: almost (I didn't created the driver but that's fairly it). I suppose pkpgcounter hasn't been actively developed for the past years | 14:23.26 |
| and new features are not supported | 14:24.07 |
| newer drivers with new pcl xl class 3.0 features I suppose | 14:24.47 |
HenryStiles | nmpribeiro: nothing has changed with xl in years. 3.0 seems to be supported in the python you have. So probably something else. Good luck, a little debugging of the source should find the problem quickly | 14:27.14 |
nmpribeiro | HenryStiles: yes. | 14:28.48 |
| thank you all for your cool support | 14:29.08 |
kens | You're welcome | 14:29.17 |
avih | tor8: hey :) i might give it a go once you consider it stable and relatively complete. for now, if you want a test case, i suggest https://en.wikibooks.org/wiki/Algorithm_Implementation/Strings/Levenshtein_distance#JavaScript (i tried the non trivial js variant, but ended up using the space-optimized adaptation of the C sample) | 17:37.31 |
malc_ | tor8: Caving in are we? (b0280abd7fe895b461e807cfb2829c19fccaf583) | 17:41.23 |
kent3116 | Hi. I asked this earler today (your time) - but can't see a reply in the logs - so will ask again. | 18:44.00 |
| Printing. I've been looking at the SumatraPDF source - which has printing, but appears to do so by generating each page as an image and printing that. Is there a native way to print PDF's using mupdf ? or is that the only way ?06:42.07 I need to support Windows 7 or newer | 18:44.07 |
rayjj | kent3116: Printing an image is the only way as far as I know. Also, it is the "safest" in that you know that it will be match what you see on the screen | 19:58.10 |
kent3116 | But at the expense of the print being large. | 20:07.22 |
rayjj | kent3116: The spooled file is large, yes | 20:09.16 |
| kent3116: the "better" solution would be to print via XPS, but there mupdf doesn't have an xps output device afaik (at least yet) | 20:37.33 |
Robin_Watts | kent3116: In what way "print" ? | 20:40.01 |
| "print" involves turning the pdf file into a stream of data that the printer understands. | 20:40.35 |
| Some printers want postscript, some want pcl, a few want pdf, some want other formats. | 20:41.02 |
| I'm assuming that you're working on windows, and you want to feed into the windows printer system. | 20:41.35 |
| On pre-vista platforms that meant driving the GDI interface. | 20:41.51 |
| On vista and above you could use GDI (as a backwards compatible thing) or you could make XPS files. | 20:42.11 |
| With either GDI or XPS, by far the easiest route is to generate an image, and wrap that appropriately. | 20:42.36 |
| it's the only way to guarantee 100% match between what you generate and what you et. | 20:42.52 |
| get | 20:42.54 |
rayjj | Robin_Watts: right, and wrapping as an XPS, at least the image could be compressed | 21:13.58 |
| unless HenryStiles wants to adapt the gs xpswrite approach as a fitz device ? | 21:16.22 |
kent3116 | Thanks Robin. Personally I use a Mac for my development - but as we support both Mac and Windows clients, I need to support both. On Mac, the OS has native PDF frameworks which I can use for all of this. On Windows, there appears to be some effort in Win 8.1 to do so, but very limited. Maybe in 5 years when they have matured.... | 23:08.46 |
| Forward 1 day (to 2016/03/15)>>> | |