Skip to content

Commit

Permalink
Drop NEWPDF=false switch for recent Ghostscript (#288)
Browse files Browse the repository at this point in the history
  • Loading branch information
maltoe authored Dec 15, 2023
1 parent 9f7b2a8 commit 6a45f52
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ config :chromic_pdf, chrome_version: "Google Chrome 120.0.6099.71"

### Changed

- Drop `-dNEWPDF=false` switch from Ghostscript >= 10.2. The old PDF interpreter has been removed and using the switch results in a warning now.
- Split `Chromic.Template.styles/1` into `page_styles/1` and `header_footer_styles/1`, and trim the stylesheets.
- Cookies set via `:set_cookie` are now `httpOnly: true` by default.

Expand Down
7 changes: 5 additions & 2 deletions lib/chromic_pdf/pdfa/ghostscript_runner.ex
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ defmodule ChromicPDF.GhostscriptRunner do

@ghostscript_bin "gs"
@ghostscript_safer_version [9, 28]
@ghostscript_new_interpreter_version [9, 56]
@ghostscript_new_interpreter_version {[9, 56], [10, 2]}

@spec run_postscript(binary(), binary()) :: binary()
def run_postscript(pdf_path, ps_path) do
Expand Down Expand Up @@ -116,7 +116,10 @@ defmodule ChromicPDF.GhostscriptRunner do
end

defp maybe_disable_new_interpreter do
if semver_compare(ghostscript_version(), @ghostscript_new_interpreter_version) in [:eq, :gt] do
{bad, good} = @ghostscript_new_interpreter_version

if semver_compare(ghostscript_version(), bad) in [:eq, :gt] &&
semver_compare(ghostscript_version(), good) == :lt do
# We get segmentation faults with the new intepreter (see https://github.com/bitcrowd/chromic_pdf/issues/153):
#
# /usr/bin/gs exited with status 139!
Expand Down

0 comments on commit 6a45f52

Please sign in to comment.