Log of #ghostscript at irc.freenode.net.

Search:
 <<<Back 1 day (to 2021/05/17)Fwd 1 day (to 2021/05/19) >>>20210518 
artifexi- <KenSharp> Ghostscript may have it's resources built into a ROM file system (ie part of the binary executable), in which case it will work without a Resource/Init directory. I would normally expect the distribution to include the Resource directory anyway, but we can't control what package maintainers do.06:54.10 
  <KenSharp> I would not expect the content of gs_init.ps to make any difference to the media size of a PDF produced from PostScript, with one exception; if the PostScript program does not request a media size, and the default media size is 'unexpected'. The default is normally either A4 (Europe) or Letter (US). I don't recall how that normally gets set on a Linux system, but I thought it was dynamic based on the OS setup.06:56.16 
  <chrisl> I believe "make install" installs all the resources, regardless of whether they were compiled into the romfs.07:21.17 
  <chrisl> Additionally, if it's available, gs on Linux uses libpaper to determine the default page size - which is (usually) a setting in /etc/papersize07:22.28 
  <KenSharp> That's the thing I was trying to remember 🙂07:22.40 
  <chrisl> 'Course probably a waste of effort since kteynor appears to have moved along....07:23.24 
  <KenSharp> Yep, that happens a lot07:23.35 
  <KenSharp> But you never know, someone may read the logs, or turn them up in a Google search07:23.48 
  <chrisl> It's no surprise this channel is almost dead 😦07:24.25 
  <paulgardiner> I can build nui-lib+app and then smart-office-examples for emulator. The CC commands used in that build and the command-line one must be different, or those command are run from different directories. I can't think what else would do this.08:32.42 
  <KenSharp> @paulgardiner wrong channel ?08:50.29 
  <paulgardiner> Oop ta09:12.41 
kteynor Can anyone tell me why the Init directory would be missing from a Linux installation of Ghostscript?11:12.07 
artifexi- <KenSharp> kteynor we did discuss this above, if you weren't around you can read the IRC logs11:12.35 
chrisl kteynor: Did you build and install it yourself?11:12.43 
kteynor artifexi- ok. My bad.  Haven't used IRC is 15+ years.  I'll go look at the logs.11:13.56 
  chrisl, no I did not. Another team member did it. They just use yum to do the deed.11:13.57 
artifexi- <KenSharp> As @chrisl said, make install ought to install the directory, but that rather assumes whoever built it used make install 🙂11:14.31 
chrisl kteynor: In which case, you'll need to ask whoever make the rpm11:14.35 
artifexi- <KenSharp> Oh yeah yum, not made from source11:14.49 
chrisl Correction to what I said earlier: if the resources are in romfs, the install target does *not* still install the Resource files.... I got that wrong11:15.54 
artifexi- <KenSharp> kteynor when you logged into our IRC channel you shoudl have got a message giving the location of the IRC logs11:16.11 
  <KenSharp> @chrisl, OK, but still if its a RPM then we don't really know 🙂11:16.36 
  <KenSharp> But I think my comments about media size, and yours about libpaper are still relevant11:16.55 
chrisl *However*, I don't know of any distro that builds the resources into the binary - certainly RedHat and its derivatives don't11:17.18 
kteynor Found the logs and I see yesterday's responses.11:17.46 
artifexi- <KenSharp> I msut confess I'm not familiar with anyone doing that, its something the distros have generally been opposed to11:17.52 
kteynor You're talking a lot of Linux stuff that I don't understand.  I'm not a linux admin, but it might help another team member.11:18.27 
artifexi- <KenSharp> kteynor, since you're here now, feel free to ask any more questions, though I'm heading off for an early lunch shortly. But chrisl is the build manager and general Linux person11:18.56 
chrisl kteynor: Are you *sure* the Resouce files aren't installed?11:19.22 
kteynor 6:00am my time...that's an EARLY lunch haha11:19.27 
artifexi- <KenSharp> If you can make a file available which gives you an unexpected media size we cna look at it.11:19.43 
  <KenSharp> Well it's 12:20 here in the UK11:19.51 
kteynor There is no Init directory within the Resource directory11:20.06 
artifexi- <KenSharp> Right, but you have a Resource directory ?11:20.19 
kteynor Yes11:20.24 
artifexi- <KenSharp> That's entirely unexpected and unusual11:20.28 
kteynor Really?  How do I get you a file?11:20.31 
  I can give you before and after.11:20.37 
artifexi- <KenSharp> Can you ask the other team member where they got the RPM from ?11:20.49 
kteynor What's an RPM?11:21.05 
artifexi- <KenSharp> I can look at the input PostScript program and make some guesses, also, obviously, I can try it myself11:21.18 
  <KenSharp> RPM = RedHat Package Manager (or possibly Module, I forget)11:21.34 
  <KenSharp> It's the package format for yum11:21.42 
kteynor Oh11:21.47 
  It'll be a bit before I can get that answer. Like I said, it's 6am here.11:22.16 
artifexi- <KenSharp> OK so really early, you must obviously be in the US11:22.34 
  <KenSharp> If you stick the input file somewhere I can take a swift poke at it,.11:22.54 
kteynor Yes, WISCONSIN.  Just got done milking the cows.  (KIDDING)11:22.55 
chrisl For page sizes: it can be set by libpaper (if it's Linux and built with libpaper), it can be set by the environment, it can be set by the command line and it can be set by the input file.11:23.20 
artifexi- <KenSharp> Note that if Ghostscript is working with the Init directory being missing, then I'm reasonably sure the resources must be built into a ROM file system, otherwise it would fall over horribly11:23.25 
artifexi- <KenSharp> lunches11:24.48 
kteynor I'll work on getting you the output file(s)11:27.00 
chrisl Input files are rather more helpful....11:27.53 
kteynor ok11:32.13 
chrisl Perhaps more useful, at this stage, would be: what page size are you getting? What page size are you expecting? And what leads you to that expectation?11:32.56 
kteynor Expecting 8.5x11 and getting 8.26x11.6911:38.56 
chrisl So you expect Letter and you're getting A4? And what leads you to that expecation?11:40.51 
kteynor Because the customer was upgraded from one Linux environment to another, and before the upgrade, all of the reports were printing in Letter, and now they are A4.  The reports look all jacked up now.  The good ones were created using GS 8.7, and the newer ugly ones were created with 9.2511:44.14 
  So a few moving parts here that I don't know a lot about.11:44.44 
  No luck finding the originating file currently.  Still trying.11:45.38 
chrisl Okay, so you're not requesting a page size on the command, nor in the input file11:46.23 
kteynor I would say no at this point.  I have seen no indication of that.11:50.17 
chrisl In which case, I would look at what the file "/etc/papersize" contains11:51.15 
kteynor ok11:51.43 
  It's empty11:52.20 
  Just the standard single commented out line11:52.38 
artifexi- <KenSharp> You can always specify the default paper size on the command line11:53.20 
chrisl Well, that's odd. FWIW, I think the sensible solution is be explicit in what you want gs to do, rather than rely on defaults11:53.40 
artifexi- <KenSharp> Ohterwise in the absence of a request from the input, and no libpaper and no command lien switch, you get whatever the build was set up for, whch could be A4. Its either that or letter, and its possible the package maintainer used something unexpected (for US installations anyway)11:54.23 
kteynor I can't disagree with you, but I just want to replicate what we've been doing for probably 20 years.  Not sure why it's acting differently than every other setup.11:54.33 
chrisl Well, things change....11:55.23 
kteynor Yes I agree.  I know about 0.00005% of how this stuff is set up, and I don't want to introduce something that could break something else.11:56.20 
chrisl If you just add "-sDEFAULTPAPERSIZE=letter" it should do what you need11:56.56 
kteynor Add it to the /etc/papersize?  I'll keep that in mind.11:57.44 
chrisl No, to the ghostscript command line11:57.59 
kteynor Oh11:58.09 
artifexi- <KenSharp> Just in passing, I'd recommend you upgrade to something newer than 9.25. The current release is 9.54.0, 9.25 has (IIRC) some known security issues11:58.40 
kteynor Doesn't yum sorta dictate that?11:59.00 
chrisl Relying on /etc/papersize id going to mean "fixing" it every time the distro updates libpaper11:59.07 
  s/id/is11:59.14 
artifexi- <KenSharp> You don't have to use a package, you can always build Ghostscript from source. But I'm slightly surprised that ene a LTS version of Linux would be shipping an elderly version of Gs, with known security holes12:00.14 
  <KenSharp> Well I suppose 9.25 is only 2.5 years old12:00.44 
  <KenSharp> Feels longer.....12:00.56 
chrisl I guess I missed which distro this is....12:01.01 
niedved Hello. I don't know is that the correct place for that but I'm confused and can't find a solution anywhere... and a little bit desperate :) I have a PDF that has images and text.12:12.06 
  And when I run gs pdf to jpg with -dFilterTEXT => ok I get output1.jpg without text12:12.06 
  but when I run gs with -dFilterVECTOR and -dFilterIMAGE I get output2.jpg totally white (empty)12:12.06 
  There is a chance that PDF doesn't have fonts attached but hoped that TEXT will be visible in output1.jpg or output2.jpg - any idea? Or help where I can find a solution :)? 12:12.08 
artifexi- <KenSharp> MosWithout seeing your input file I can't really comment.12:13.01 
  <KenSharp> niedved^^12:13.11 
  <KenSharp> The presence or absence of fonts has no effect on the filtering devices12:13.27 
kteynor we're using ps2pdf to do the conversion12:13.30 
  can i use the same option to set the default paper size?12:13.43 
artifexi- <KenSharp> @kteynor you can add GS command line switches to the ps2pdf invocation, assuming its our ps2pdf script you are using. Those get passed along to Ghostscript12:14.03 
kteynor We have an internal environment as well that also does not have most subdirectories of the Resource directory.12:14.19 
  We only have the CMap directory12:14.50 
artifexi- <KenSharp> @kteynor there's not really a lot I can tell you there. If a package maintainer chooses to not distribute certain resources we have no influence.12:15.04 
kteynor ok12:15.14 
artifexi- <KenSharp> What Linux distribution is this ? Where did you get the RPM you are using ?12:15.31 
  <KenSharp> I appreciate you may need to wait for someone else to answer those12:15.42 
  <KenSharp> My guess is that your binary has been built with a ROM file system and gs_init.ps is basically part of the binary. YOU can override that, if you have a complete set of resoruce files. The -sGenericResourceDirectory switch allos you to tel GS to use a path. So you could pick up the Resources from our Git repository, stick them on the Linux OS i nthe right place, and then tell GS to use them.12:17.11 
  <KenSharp> But as chrisl said, I really think it would be better for you to add the DEFAULTPAPERSIZE to the command line. That way you aren't dependent on any defaults, and won't have to keep fixing this every time GS or Linux gets updated.12:17.53 
  <KenSharp> @niedvd if you can make your PDF file available I will look at it.12:18.35 
niedved @artifexi - http://ar.xcity.eu/cana3.pdf for example here thanks12:19.06 
  gs -dNOPAUSE -dTextAlphaBits=4 -dColorConversionStrategy=/sRGB -g3862x4998 -dPDFFitPage -dFILTERTEXT -dUseCropBox -dNumRenderingThreads=8 -sDEVICE=jpeg -sOutputFile='out_without_txt.jpg' -dJPEGQ=100 -r1030 -q 'cana3.pdf' -DNOSAFER -c quit 12:19.09 
  gs -dNOPAUSE -dTextAlphaBits=4 -dColorConversionStrategy=/sRGB -g3862x4998 -dPDFFitPage -dFILTERIMAGE -dFILTERVECTOR -dUseCropBox -dNumRenderingThreads=8 -sDEVICE=jpeg -sOutputFile='out_without_txt.jpg' -dJPEGQ=100 -r1030 -q 'cana3.pdf' -DNOSAFER -c quit 12:19.09 
  thue 2 command I use 12:19.19 
artifexi- <KenSharp> @niedvd, I'll need a couple of minutes......12:19.22 
  <KenSharp> Thanks for the command lines12:19.27 
niedved no problem thx I lost few days 12:19.37 
  in secound command ofcourse output file hould be out_txt.jpg12:20.34 
artifexi- <KenSharp> OK so FILTERIMAGE is causing the whole lot to go missing12:20.58 
  <KenSharp> I have a suspicion why but give me a minute12:21.06 
  <KenSharp> Hmm, no its not that.12:22.10 
niedved pdf was generate with photoshop .... when creating file with indesign we dont have such prblem 12:22.33 
artifexi- <KenSharp> That's interesting12:22.44 
niedved so we thought that fonts missing is a prblem 12:22.54 
artifexi- <KenSharp> It looks like osmehow the text is being recognised as images. I'm not (yet) sure why12:23.01 
  <KenSharp> Wow, text rndering mode 712:23.32 
  <KenSharp> That's **really** unusual12:23.39 
  <KenSharp> I'll have to look that up12:23.43 
  <KenSharp> Aha!12:24.19 
  <KenSharp> OK so your text is not, precisely, text.12:24.29 
niedved its smth between vecor and txt :) ?12:24.58 
artifexi- <KenSharp> What is happening is that the file uses text rendering mode 7 to turn all the ext into clipping paths.12:24.58 
  <KenSharp> If you liek its a stencil12:25.04 
  <KenSharp> The it draws a black image, only the 'cutout' bits of the stencil let the image fall through to the canvas12:25.25 
  <KenSharp> Now when you filter out images, the black image doesn't get drawn12:25.41 
  <KenSharp> So the text 'disappears'12:25.47 
  <KenSharp> The filter text works, because if you remove the text there are no 'stencil' holes, so the image is completely clipped out12:26.27 
  <KenSharp> I'm afraid there is no way to use the filtering classes as they stand with an input file of this nature, sorry.12:26.59 
niedved ok any idea how to get JPG or PDF (bwtter)with only this "almost text" 12:27.22 
artifexi- <KenSharp> In all honesty, you can't do this with Ghostscript12:27.56 
  <KenSharp> Your best bet is going to be to edit the PDF file using something like Adobe Acrobat Pro12:28.14 
niedved my cript is basicaly splits IMG + Vector to IMG (for background) and all Text to PDF to convert to SVG in next step12:28.26 
  so when I put svg over IMG a have orginal page 12:28.39 
  uhhh12:28.42 
  and in this example I have no SVG and mimssing text in bg12:29.00 
artifexi- <KenSharp> Well to be honest its a lousy way to draw text that Photoshop is using here.12:29.24 
  <KenSharp> I'm sorry but there's nothing I can do to help you, Ghostscript isn't able to tell the difference between an image which is a picture and an image which is being drawn through some text12:30.02 
niedved ok thanks for your time 12:30.19 
artifexi- <KenSharp> You're welcome, sory I couldn't be more help12:30.30 
niedved you save my next few days of searching :) thats a lot thx 12:31.29 
artifexi- <KenSharp> 🙂12:31.35 
niedved Last question can GS or other debian command :D tell me that "file uses text rendering mode 7"? so I will in that case simple resign frm getting text and remove all filters from BG 12:45.50 
artifexi- <KenSharp> Ghostscript can't no. You could us -dPDFDEBUG and then grep the output for "7 Tr" maybe, but I'm not sure that would be reliable. I don't know of any tool which will tell you that, though obviously it would be possible to write such athing. You could use MuPDF to decompress the fiel and then grep it for "7 Tr" but that's probably not totally reliable either, as that sequence might occur in binary data (such as bitmaps)12:47.36 
  <KenSharp> OK so using GS I did gs -dPDFDEBUG cana3.pdf > out.log12:49.01 
niedved Ok I just simply need to get info that page will generate problem like here and there skip 12:49.14 
artifexi- <KenSharp> Then grep "7 Tr" otu.log produced a number of hits12:49.15 
niedved great 12:49.19 
artifexi- <KenSharp> I cna't claim much for reliability, but at least that way won't get any bitmap data12:49.41 
  <KenSharp> YMMV of course12:49.48 
niedved yes great thanks for tip12:50.01 
  help*12:50.10 
artifexi- <KenSharp> Again, you're very welcome12:50.19 
  <KenSharp> Its always interesting to try and solve strange problems 🙂12:50.35 
artifexi- <KenSharp> fetches coffee12:52.11 
Ashish Hi, I was testing pdf print for a POC project and it was working fine till today.13:11.12 
  Today I got a scenario in which a pdf document of 2 pages was issued print on mswinpr2 using GS Cli.13:11.12 
  First page printed like thumbnail of page in left top corner13:11.13 
  Second page printed correctly as expected.13:11.13 
  It seems very strange13:11.14 
artifexi- <KenSharp> And if you try it agani do you get the same result ?13:12.10 
Ashish no. It happen only once.13:12.54 
  I posted here thinking if its know issue13:13.04 
artifexi- <KenSharp> Then it's "Windows Weirdness" TM13:13.06 
  <KenSharp> I doubt Ghostscript is doing anything differently13:13.22 
Ashish https://drive.google.com/file/d/1QevBrfRLUwqdimxRe3ApePmAgHLg_v5i/view?usp=sharing13:13.33 
  here is the picture of print13:13.47 
artifexi- <KenSharp> From what little I can make out that looks OK13:14.02 
Ashish is their any way we can set any log path to get gs output so in future I will have some more info. ?13:15.17 
artifexi- <KenSharp> Ghostscript outputs anything it wants to tell you on stdout and sdtderr, you can redirect the output to files and log that. However it seems to me that this is a problem with Windows rather than Ghostscript13:16.07 
  <KenSharp> NB if you want to log back channel messages, its a good idea not to set -dQUEIT or -q13:16.33 
Ashish "-empty",13:22.06 
  "-dPrinted",13:22.07 
  "-dBATCH",13:22.07 
  "-dNOPAUSE",13:22.08 
  "-dNOSAFER",13:22.08 
  "-dNoCancel",13:22.09 
  "-dPDFFitPage",13:22.09 
  "-c",13:22.09 
  "mark /NoCancel true /QueryUser 3 /OutputFile (%printer%"+printerName+") /UserSettings <</DocumentName (testdoc)>> (mswinpr2) finddevice putdeviceprops setdevice",13:22.10 
  "-dNORANGEPAGESIZE",13:22.11 
  "-f", "D://...........pdf"};13:22.11 
  I am using above parameters.13:22.11 
artifexi- <KenSharp> Yep13:22.18 
  <KenSharp> Don't use -dNOSAFER13:22.28 
  <KenSharp> Bad plan13:22.30 
Ashish ok13:22.45 
artifexi- <KenSharp> Having said that, I'm not certain that fiddling with the device like that will work if you don't set NOSAFER. But you can probably do all of that from command line switches anyway13:25.39 
Ashish My application will relay pdf print using gs so It needs to run in background which is already done so far. So I didn't find way to get logs of gs execution.13:27.01 
artifexi- <KenSharp> redirect stdout and stderr to files.13:27.43 
Ashish As you suggested I already not using dQUEIT13:27.45 
  ok13:28.44 
  I am building application is c#, To use GS using DLLImport method. Which only takes parameters.13:32.26 
  No Output so in that case I can't redirect stdout.13:32.27 
artifexi- <KenSharp> You can redirect it RTFM13:33.33 
  <KenSharp> -sstdout=filename13:33.40 
  <KenSharp> But more flexibly you need to enable monitoring of stdout and stderr in your own application.13:34.30 
  <KenSharp> While we are on the subject, you need to be aware that Ghostscript is licensed under the AGPL and I strongly suspect that Artifex will consider what you have described so far of your application will require a license, or your own code to be released under the AGPL13:35.28 
Ashish ok13:36.31 
artifexi- <KenSharp> To enable capture opf the back channel in your own application you need to register a callback13:36.58 
  <KenSharp> See doc/API.htm13:37.06 
  <KenSharp> Section 3.4 "sgapi_set_stdio_with_handle"13:37.34 
Ashish ok I will try this and get back13:39.20 
 <<<Back 1 day (to 2021/05/17)Forward 1 day (to 2021/05/19)>>> 
ghostscript.com #mupdf
Search: