Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docsplit images command - Added the ability to specify the page number delimiter via a command line option #110

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

BrandonNoad
Copy link

When using docsplit images to split a pdf into a series of images (e.g. foo.pdf --> foo_1.jpg, foo_2.jpg, ...), the user may want the ability to specify the page number delimiter. For example, instead of always using an underscore ('_'), the user may want to use a dash ('-') or something more complicated (e.g. foo.pdf --> foo-page-1.pdf, foo-page-2, ...).

@@ -101,6 +101,9 @@ def parse_options
opts.on('-r', '--rolling', 'generate images from each previous image') do |r|
@options[:rolling] = true
end
opts.on('--delimiter [DELIMITER]', 'set page number delimiter (eg: _, -, -Page-...)') do |d|
@options[:delimiter] = d.tr('^','')
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In order to have your delimiter start with a dash, you need to escape it with the '^' character. So, we need to strip the '^' before passing it to @options.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant