Log of #ghostscript at irc.freenode.net.

Search:
 <<<Back 1 day (to 2021/02/14)Fwd 1 day (to 2021/02/16) >>>20210215 
mnestorov Hello ghostscript devs/users/maintainers :) I thought that it would be a better idea to ask here (before I potentially unnecessarily create a gs issue on bugzilla). I'm having issues with validating a PDF/A file after converting it with `gs`. Validation is done through veraPDF and pdfbox. The `gs` command exits normally and produces a good looking12:22.17 
  PDF. Following the report of veraPDF, I checked the produced by ghostscript PDF, but I'm way over my head in properly understanding the implications of the errors from veraPDF and understanding the PDF source code I'm reading. I'm not sure if the problem is in veraPDF or with the Ghostscript conversion. I've tried my best to verify that the source12:22.18 
  document is at least a valid PDF without any errors (checked with a myriad of cli tools). I can share the `gs` command I'm issuing, the source pdf, the produced pdf, and the veraPDF report it would be helpful. Of course, this might not be the proper place to ask such things, in which case I'll try not to further pollute the chat.12:22.18 
artifexirc-bot <KenSharp> mnestorov, sorry was eating lunch12:57.04 
  <KenSharp> What version of Ghostscript are you using ?12:57.15 
mnestorov 9.53.312:57.37 
artifexirc-bot <KenSharp> And what is the error report ?12:57.38 
  <KenSharp> I just fixed a problem relating to non-PDFDocEncoding strings in the /Title12:57.56 
mnestorov I'll omit the xml and just give you the checks that fail12:58.14 
artifexirc-bot <KenSharp> Please, I'm no good at reading XML 🙂12:58.25 
mnestorov specification="ISO 19005-1:2005" clause="6.7.3"12:59.17 
  If a document information dictionary does appear at a document, then all of its entries that have analogous properties in predefined XMP schemas, shall also be embedded in the file in XMP form with equivalent values.12:59.17 
  this is one12:59.22 
  specification="ISO 19005-1:2005" clause="6.2.3"12:59.36 
  DeviceRGB may be used only if the file has a PDF/A-1 OutputIntent that uses an RGB colour space12:59.36 
  this is another12:59.38 
artifexirc-bot <KenSharp> That looks very similar to the problem I just fixed12:59.40 
  <KenSharp> Ah, have you customised a pdfa_def.ps file and executed it **before** the inptu PDF file ?13:00.02 
mnestorov So I checked what that XMP should be like and I do find the XMP in the produced pdf, but I can't be sure if it's properly created in the resulting pdf13:00.10 
artifexirc-bot <KenSharp> If not then you won't get an OutputIntent, and you will get the second error13:00.20 
mnestorov let me check the .ps file13:00.27 
artifexirc-bot <KenSharp> mnestorov the XMP <title> tag should be a string, and the Document Information dictionary should have a /Title where the strings are byte-for-byte identical13:01.01 
mnestorov Is it possible for this to be true, but for instance, the /Producer section to be in a new definition xmp-like section below the rest of the [Ttile, Author, CreationDate]13:01.48 
artifexirc-bot <KenSharp> ImageMagick (in later versions at least) is creating a /Title where the content is encoded in UTF-16BE but missing the byte order mark, and including a NULL terminator13:01.48 
  <KenSharp> Producer should be separate13:02.04 
mnestorov Great, sorry for rambling in that case :)13:02.20 
artifexirc-bot <KenSharp> Technically they should be byte-for-byte identical too, but the Producer is set by Ghostscript and can't fail13:02.22 
  <KenSharp> mnestorov are you up to building Ghostscript from source ? If so you could try out the latest HEAD from our Git repository and see if the 6.7.3 error goes away13:03.21 
mnestorov @ar13:03.44 
artifexirc-bot <KenSharp> International Talk Like a Pirate Day ?13:04.02 
mnestorov sorry, still sleeping13:04.03 
  :)13:04.09 
  I'll give building the latest gs from source13:04.42 
  I'm still looking for that .ps file, so that I can answer that question as well13:04.57 
artifexirc-bot <KenSharp> It would help me out to know if the 6.7.3 problem still exists, if it does, then you should probably open a bug report13:05.06 
  <KenSharp> Our boiler plate pdfa_def.ps is located in ghostpdl/lib IIRC13:05.28 
  <KenSharp> But it needs to be customised. In particular you must supply an ICC profile to be used as the OutptuIntent for the PDF/A file13:05.51 
mnestorov I'm afraid that the legacy code I'm maintaining has some form of a .ps file somewhere, and I'm trying to find it13:05.52 
artifexirc-bot <KenSharp> Oh....13:05.58 
mnestorov yeah we definitely do that13:06.00 
artifexirc-bot <KenSharp> Hmm, well the error 6.2.3 implies that either there is no OutputIntent, or the ICC profile is not a CMYK OutputIntent13:06.35 
  <KenSharp> Warning Will Robinson.....13:06.44 
  <KenSharp> Newer versions of Ghostscript ship with -dSAFER set13:06.54 
  <KenSharp> This denies access to opening arbitrary files on disk, which is one of the things that pdfa_def.ps does in order to read the ICC profile13:07.25 
  <KenSharp> If you don't set -dNOSAFER or --permit-file-read=<path to ICC profile> then you will get an error13:07.46 
  <KenSharp> D'oh ! I meant (several lines above) the ICC profile is not an RGB profile.13:09.56 
mnestorov Right, so we have a bunch if *.icc file defined, like `default_rgb.icc` or `ps_gray.icc` or `srgb.icc`. Their contents kind of escape me at the moment, but I do believe that they are created for the needs of the software. They do work on a lot of other files that are converted to PDF/A standard. The `gs` command we issue exactly is `gs -q -dBATCH13:10.10 
  -dNOPAUSE -dPDFA=1 -sProcessColorModel=DeviceRGB -sDEVICE=pdfwrite -dPDFACompatibilityPolicy=2 -dAutoFilterColorImages=false -dAutoFilterGrayImages=false -dColorImageFilter=/FlateEncode -dGrayImageFilter=/FlateEncode -dMonoImageFilter=/CCITTFaxEncode -sColorConversionStrategy=RGB -sOutputICCProfile=/path/to/icc/srgb.icc -sOutputFile=<OUTPUT>.pdf13:10.11 
  /path/to/distillerparameters_Flate_all.ps <INPUT>.pdf`13:10.11 
artifexirc-bot <KenSharp> OK I don't see anything in there which runs pdfa_def.ps but it could be in the 'distillerparameters_Flate_all.ps file13:11.19 
  <KenSharp> You don't need to set -sProcessColorModel13:11.31 
mnestorov Noted :)13:11.53 
artifexirc-bot <KenSharp> Setting OutputICCProfile won't do anything13:11.54 
  <KenSharp> The code to create an OutputIntent from an ICC profile is a little more involved than that13:12.13 
  <KenSharp> If I had to guess I would suggest whoever wrote the command line (and presumably script backing it) thought that setting -sOutputICCProfile was sufficient, I'm afraid it isn't, you really do need to run a (customised) pdfa_def.ps13:13.19 
  <KenSharp> I'd be curious about the contents of distillerparameters_Flate_all.ps just in case the code is in there13:13.43 
mnestorov coming your way13:14.05 
  `<<13:14.07 
  >> setdistillerparams13:14.09 
  `13:14.10 
  <<13:14.24 
  >> setdistillerparams13:14.26 
  :facepalm"13:14.30 
artifexirc-bot <KenSharp> Umm, that's it ?13:14.46 
mnestorov <</ColorImageFilter /FlateEncode /GrayImageFilter /FlateEncode /MonoImageFilter /CCITTFaxEncode >> setdistillerparams13:14.52 
artifexirc-bot <KenSharp> Ah 🙂13:14.57 
mnestorov I don't know why it wouldn't paste the new lines13:15.02 
  truly sorry for the spam13:15.07 
artifexirc-bot <KenSharp> IRC can be funny about leading '/'13:15.12 
  <KenSharp> and stuff13:15.15 
mnestorov I see13:15.19 
artifexirc-bot <KenSharp> OK so that's doing exactly the same as -dColorImageFilter=/FlateEncode and the similar switches on the command line you pasted13:15.52 
  <KenSharp> You don't need to do it twice 🙂13:15.58 
mnestorov :) cool, there are a bunch of things to clean now13:16.16 
artifexirc-bot <KenSharp> None of it is creating the OutputIntent though, so you really do need to do that.13:16.28 
mnestorov the command line was created when gs was version 9.2613:16.33 
artifexirc-bot <KenSharp> Without it the error 6.2.3 is pretty much waht I would expect13:16.44 
  <KenSharp> Doesn't matter which version, this has been the only way to create PDF/A since pdfwrite was able to create a PDF/A file13:17.08 
  <KenSharp> I should have asked which OS you are using, I'm guessing Linux13:17.49 
mnestorov Indeed13:17.55 
artifexirc-bot <KenSharp> Then the location of stuff depends on the package maintainer a bit, so pinch of salt time...13:18.15 
  <KenSharp> pdfa_def.ps should be in ghostpdl/lib13:18.25 
  <KenSharp> Which is usually (IIRC) in /usr/local/bin, but I'd have to run up a Linux machine to check13:18.47 
  <KenSharp> In fact let me do that13:18.54 
  <KenSharp> Hmm well that's where the binary is, or rather in my version is linked from13:20.00 
mnestorov If it's too much trouble, don't, I can try to push it there....this would mean that when gs is issued, it would know to search for pdfa_def.ps in that location13:20.04 
artifexirc-bot <KenSharp> No13:20.12 
  <KenSharp> You **always** haev to tell Ghostscript to run a specific file13:20.26 
  <KenSharp> pdfa_def.ps must be modified before you can use it13:20.37 
  <KenSharp> So I'd advise modifying it, calling it seomthing different, and putting it somewhere easy to find13:21.04 
  <KenSharp> I was just trying to find out where the blasted file actually IS.....13:21.20 
mnestorov ahaa okay I understood you13:21.44 
artifexirc-bot <KenSharp> Just a moment, I'll ask a friend 🙂13:22.32 
  <KenSharp> Hmm nobody around at present who knows the answer13:24.52 
  <KenSharp> Ah possibly /etc/ghostscript13:26.11 
  <KenSharp> Hmm, no, that's just the font maps13:26.33 
mnestorov I'm having trouble finding it on my machine as well13:27.13 
artifexirc-bot <KenSharp> try /usr/share/ghostscript13:27.39 
  <KenSharp> then the version number13:27.48 
mnestorov I can download it from your online documentation however :)13:28.04 
artifexirc-bot <KenSharp> moment, door, brb13:28.08 
  <KenSharp> pdfa_def.ps is in the documentation ? Really ?13:28.51 
mnestorov https://ghostscript.com/doc/current/Psfiles.htm13:29.00 
artifexirc-bot <KenSharp> Its in the repository sure....13:29.01 
  <KenSharp> Well who knew.....13:29.12 
mnestorov I found it here, when I click the link it wants a download13:29.13 
artifexirc-bot <KenSharp> I'd no idea there were links on the web pages. Obviously I never use those 🙂13:29.47 
mnestorov :)13:30.36 
  thank you for helping me find it!13:30.46 
artifexirc-bot <KenSharp> NP I'm glad you did13:30.52 
  <KenSharp> Anyway, practuiically all that file is loading and defining the OutptuIntent ICC Profile13:31.11 
  <KenSharp> Near the top it says: /ICCProfile (srgb.icc) % Customise13:31.26 
mnestorov Yes, I see it13:32.04 
artifexirc-bot <KenSharp> The bit inside () has to be a fully qualified path (Unix style delimiters) to the ICC profile you want to use. For RGB you need to find an RGB ICC profile.13:32.05 
mnestorov Can I use the default ones provided with the gs installation?13:32.35 
artifexirc-bot <KenSharp> And Ghostscript has to be able to read that file, which it can't do unless you either specify -dNOSAFER or, better, permit reading of the file using --permit-file-read=.....13:32.53 
  <KenSharp> You can use the default ones that Ghostscript uses, many people do. Assuming you don't care about the accuracy of the colour 😄13:33.22 
mnestorov I have been accused many times that I can't tell the difference between blue and very light to green blue, so I'm happy to use the defaults13:34.06 
artifexirc-bot <KenSharp> To be fair, most people don't care, as long as its more or less the right colour and a valid PDF/A file they are happy13:34.11 
mnestorov exactly13:34.21 
artifexirc-bot <KenSharp> The reason we have to make it possible to specify is in case someone does care about the colour fidelity13:34.45 
  <KenSharp> So you should modify the pdfa_def.ps file, put it somewhere useful, add it to the command line as an input file immediately before the input file you currently have, so that's right before <INPUT>.pdf in your current command13:36.06 
  <KenSharp> And somewhere either specify -dNOSAFER or --permit-file-read=<path to ICC profile>13:36.22 
mnestorov thank you very much, I'll fix these things :)13:37.06 
artifexirc-bot <KenSharp> OK if you do that, then that should get rid of 6.2.3 error about the profile.13:37.23 
mnestorov Than you so much Mr. KenSharp!13:37.40 
artifexirc-bot <KenSharp> If I'm right about the Title then that needs to have the current HEAD of GS built. Or wait until the next release which is due in March.13:37.50 
  <Robin_Watts> We should say "please don't use -dNOSAFER if you can avoid it, --permit-file-read is a much nicer (and more secure) solution."13:37.51 
mnestorov I'll try to build the newest gs and try out the fix and let you know if it works for my case13:37.52 
artifexirc-bot <KenSharp> If it doesn't work, then do please open a bug report, I'd like to get any other fixes in before we tag the release13:38.30 
mnestorov Okay, you got it. I'll write here in the near future to let you guys know13:38.53 
artifexirc-bot <RayJohnston> BTW, gs -h tells you (amongst all the other noise) where the LIBPATHs are15:42.08 
  <RayJohnston> (referred to as Search path:)15:42.51 
 <<<Back 1 day (to 2021/02/14)Forward 1 day (to 2021/02/16)>>> 
ghostscript.com #mupdf
Search: