Vulkan-Docs/config/optimize-pdf

84 lines
2.7 KiB
Plaintext
Raw Normal View History

Change log for February 27, 2017 Vulkan 1.0.42 spec update: * Bump API patch number and header version number to 42 for this update (the first anniversary edition). Github Issues: * Changed asciidoctor macros so cross-page links in the standalone reference pages function properly (public issue 462). Internal Issues: * Clarified host visibility discussion for slink:VkMemoryType, flink:vkInvalidateMappedMemoryRanges, elink:VkAccessFlagBits, and the <<synchronization-framebuffer-regions,Framebuffer Region Dependencies>> section, removing duplicated information and adding a central definition in the access types section (internal issue 552). * Change description of slink:vkGetPhysicalDeviceSurfacePresentModesKHR::pname:pPresentModes to return an array of values, not structures (internal issue 699). New Extensions: * Add a NOTE to the <<extensions,Layers & Extensions>> chapter describing the experimental status of `KHX` extensions. * Add new Khronos, Khronos Experimental, and vendor Vulkan extensions for release at GDC: ** VK_KHR_descriptor_update_template ** VK_KHR_push_descriptor ** VK_KHX_device_group ** VK_KHX_device_group_creation ** VK_KHX_external_memory ** VK_KHX_external_memory_capabilities ** VK_KHX_external_memory_fd ** VK_KHX_external_memory_win32 ** VK_KHX_external_semaphore ** VK_KHX_external_semaphore_capabilities ** VK_KHX_external_semaphore_fd ** VK_KHX_external_semaphore_win32 ** VK_KHX_multiview ** VK_KHX_win32_keyed_mutex ** VK_EXT_discard_rectangles ** VK_MVK_ios_surface ** VK_MVK_macos_surface ** VK_NVX_multiview_per_view_attributes ** VK_NV_clip_space_w_scaling ** VK_NV_geometry_shader_passthrough ** VK_NV_sample_mask_override_coverage ** VK_NV_viewport_array2 ** VK_NV_viewport_swizzle * Add new GLSL vendor extensions to support new builtin variables: ** GL_EXT_device_group ** GL_EXT_multiview
2017-02-27 06:54:26 +00:00
#!/bin/bash
# Copyright (C) 2014-2016 OpenDevise Inc. and the Asciidoctor Project
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
# Optimizes and compresses the specified PDF using Ghostscript (gs).
#
# [NOTE]
# You need at least Ghostscript 9.10 in order for page labels defined in the
# PDF to be preserved (e.g., front matter pages numbered using roman numerals).
if [ -z $1 ]; then
echo "Please supply a PDF file to optimize"
exit 1
fi
if [ -z $GS ]; then
GS=gs
fi
FILE=$1
FILE_BASENAME=${FILE%.pdf}
FILE_OPTIMIZED=$FILE_BASENAME-optimized.pdf
FILE_PDFMARK=
if [ -f "$FILE_BASENAME.pdfmark" ]; then
FILE_PDFMARK="$FILE_BASENAME.pdfmark"
fi
DOWNSAMPLE_IMAGES=true
if [ -z $IMAGE_DPI ]; then
#IMAGE_DPI=150
IMAGE_DPI=300
fi
# /prepress defaults (see http://ghostscript.com/doc/current/Ps2pdf.htm)
# -d{Color,Gray,Mono}ImageDownsampleType=/Bicubic
# -dAutoFilter{Color,Gray}Images=true
# -dOptimize=true
# -dEmbedAllFonts=true
# -dSubsetFonts=true
# -dColorConversionStrategy=/LeaveColorUnchanged
# -dUCRandBGInfo=/Preserve
# -dCompressPages=true
#
# other unused settings
# -r72
#
# for info about pdfmarks, see http://milan.kupcevic.net/ghostscript-ps-pdf
#
# to convert to grayscale, add the following (though doesn't always work)
#
# -dProcessColorModel=/DeviceGray \
# -dColorConversionStrategy=/Gray \
"$GS" -q -dNOPAUSE -dBATCH -dSAFER -dNOOUTERSAVE \
-sDEVICE=pdfwrite \
-dPDFSETTINGS=/prepress \
-dCannotEmbedFontPolicy=/Warning \
-dDownsampleColorImages=$DOWNSAMPLE_IMAGES \
-dColorImageResolution=$IMAGE_DPI \
-dDownsampleGrayImages=$DOWNSAMPLE_IMAGES \
-dGrayImageResolution=$IMAGE_DPI \
-dDownsampleMonoImages=$DOWNSAMPLE_IMAGES \
-dMonoImageResolution=$IMAGE_DPI \
-sOutputFile="$FILE_OPTIMIZED" \
"$FILE" $FILE_PDFMARK
exit 0